| Summary: | IJavaArray.setValues throws exception when passing in zero-length array | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Rajeev Dayal <rdayal> |
| Component: | Debug | Assignee: | Michael Rennie <Michael_Rennie> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | Michael_Rennie |
| Version: | 3.7 | ||
| Target Milestone: | 3.8 M3 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
> This case should be handled more gracefully; that is, setValues should do
> nothing and exit early.
Agreed. Pushed fix + regression tests to master.
verified in I20111027-1800 |
Build Identifier: 20110615-0604 Calling IJavaArray.setValues(array) where array is a zero-length array results in an IndexOutOfBoundsException. This case should be handled more gracefully; that is, setValues should do nothing and exit early. The source of the problem is at ArrayReferenceImpl.java:227: 227: if (index < 0 || index >= arrayLength) { 228: throw new IndexOutOfBoundsException(JDIMessages.ArrayReferenceImpl_Invalid_index_1); 229: } In this case, index == 0, but arrayLength == 0 as well. An additional check needs to be added for the special-case of a zero-length array. Reproducible: Always