Skip to content

Commit

Permalink
Avoid ArrayIndexOutOfBoundsException from Indexer.java
Browse files Browse the repository at this point in the history
When index==arrayLength, array index is also out of bound,
SpelEvaluationException should also be thrown instead of
ArrayIndexOutOfBoundsException.
  • Loading branch information
zhanyujianjoyce committed Sep 18, 2019
1 parent a51dc84 commit 2a09a34
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -439,7 +439,7 @@ else if (arrayComponentType == Short.TYPE) {
}

private void checkAccess(int arrayLength, int index) throws SpelEvaluationException {
if (index > arrayLength) {
if (index >= arrayLength) {
throw new SpelEvaluationException(getStartPosition(), SpelMessage.ARRAY_INDEX_OUT_OF_BOUNDS,
arrayLength, index);
}
Expand Down

0 comments on commit 2a09a34

Please sign in to comment.