Skip to content
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

Avoid ArrayIndexOutOfBoundsException in SpEL's Indexer #23658

Closed
wants to merge 1 commit into from

Conversation

JoyceZhan
Copy link

@JoyceZhan JoyceZhan commented Sep 18, 2019

When index == arrayLength, the array index is also out of bounds.

For this use case, a SpelEvaluationException should be thrown instead of
ArrayIndexOutOfBoundsException.

When index==arrayLength, array index is also out of bound,
SpelEvaluationException should also be thrown instead of
ArrayIndexOutOfBoundsException.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 18, 2019
@sbrannen
Copy link
Member

Can you please provide a test case that fails before the change and passes after the change?

@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) status: waiting-for-feedback We need additional information before we can continue labels Sep 18, 2019
@JoyceZhan
Copy link
Author

Can you please provide a test case that fails before the change and passes after the change?

Test case is checked in, see to IndexerTests.java

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 19, 2019
@sbrannen sbrannen changed the title Avoid ArrayIndexOutOfBoundsException from Indexer.java Avoid ArrayIndexOutOfBoundsException SpEL's Indexer Sep 19, 2019
@sbrannen
Copy link
Member

sbrannen commented Sep 19, 2019

Test case is checked in, see to IndexerTests.java

Thanks for adding the test!

This PR breaks the build due to:

  • a missing copyright header
  • a missing blank link in the imports
  • a missing newline at the end of the file

For future reference, please make sure you run ./gradlew check before pushing commits.

I'll fix those minor issues before merging.

@sbrannen sbrannen self-assigned this Sep 19, 2019
@sbrannen sbrannen added the type: enhancement A general enhancement label Sep 19, 2019
@sbrannen sbrannen added this to the 5.2 GA milestone Sep 19, 2019
@sbrannen sbrannen changed the title Avoid ArrayIndexOutOfBoundsException SpEL's Indexer Avoid ArrayIndexOutOfBoundsException in SpEL's Indexer Sep 19, 2019
@sbrannen sbrannen closed this in fde7b1e Sep 19, 2019
sbrannen added a commit that referenced this pull request Sep 19, 2019
@sbrannen
Copy link
Member

This has been merged into master in fde7b1e, and I revised the test and moved it to PropertyAccessTests in 734ceed.

Thanks!

@sbrannen sbrannen removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: feedback-provided Feedback has been provided type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants