-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly set auto-growing array's element #26600
Conversation
AbstractNestablePropertyAccessor.processKeyedProperty implementations throw IllegalArgumentException, when the property expression has more than one property key and the last key causes array to grow automatically. This commit fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide a unit test that fails before the change and passes after the change -- for example, something analogous to org.springframework.beans.BeanWrapperAutoGrowingTests.getPropertyValueAutoGrowMultiDimensionalArray()
.
Thanks
Thank you very much for your review. I have added a unit test |
Prior to this commit, the implementation of processKeyedProperty() in AbstractNestablePropertyAccessor resulted in a `java.lang.IllegalArgumentException: array element type mismatch` when the property expression had more than one property key and the last key should cause the array to grow automatically. For example, given a property `int[][] multiArray` and property expression `multiArray[1][3]`, the `processKeyedProperty()` method created a new array object and assigned it to `multiArray`; whereas, the new array object should have be assigned to `multiArray[1]`. This commit fixes this issue. Closes spring-projectsgh-26600
Prior to this commit, the implementation of processKeyedProperty() in AbstractNestablePropertyAccessor resulted in a `java.lang.IllegalArgumentException: array element type mismatch` when the property expression had more than one property key and the last key should cause the array to grow automatically. For example, given a property `int[][] multiArray` and property expression `multiArray[1][3]`, the `processKeyedProperty()` method created a new array object and assigned it to `multiArray`; whereas, the new array object should have be assigned to `multiArray[1]`. This commit fixes this issue. Closes spring-projectsgh-26600
The implementation of
AbstractNestablePropertyAccessor.processKeyedProperty
results in ajava.lang.IllegalArgumentException: array element type mismatch
when the property expression has more than one property key and the last key causes the array to grow automatically.For example, given a property
int[][] multiArray = new int[2][2]
and property expressionmultiArray[1][3]
, theprocessKeyedProperty
method creates a new array object and assigns it tomultiArray
; whereas, the new array object should be assigned tomultiArray[1]
.