Skip to content

Commit 2d8966f

Browse files
JohnBergantCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent a336df9 commit 2d8966f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/main/java/org/primeframework/mvc/parameter/el/Accessor.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,16 @@ protected void setValueIntoCollection(int index, Object value) {
281281
}
282282

283283
private int validateIndex(Object key, int maximumLength) {
284-
int index = Integer.parseInt(key.toString());
284+
if (key == null) {
285+
throw new IndexExpressionException("Encountered an indexed property without an index");
286+
}
287+
288+
final int index;
289+
try {
290+
index = Integer.parseInt(key.toString());
291+
} catch (NumberFormatException e) {
292+
throw new IndexExpressionException("Encountered a non-numeric index [" + key + "]", e);
293+
}
285294

286295
if (index < 0) {
287296
throw new InvalidCollectionSizeException(index);

0 commit comments

Comments
 (0)