| Summary: | CascadeDeletesJUnitTestSuite fails occasionally with ArrayIndexOutOfBoundsException | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Sabine Heider <sabine.heider> |
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | tom.ware |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 383862 | ||
Here is the github change (pull request created as well): https://github.com/sabineheider/eclipselink.runtime/commit/6b0d36a178244a6c43954ce4cca7d353cd94f55f I assert that I: - authored 100% the content I am contributing - have the rights to donate the content to Eclipse - contribute the content under the EPL Checked fix into master. Reviewed by: Tom Ware reviewed user submitted fix Tested with JPA and Core LRG HANA testing done by contributor Commit 8e15437c4268aef22ce136aeceb0fa996296d392 The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
The JPA test CascadeDeletesJUnitTestSuite.testDeletePrivateOwned fails occasionally with an ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0 at java.util.Vector.get(Vector.java:694) at org.eclipse.persistence.indirection.IndirectList.get(IndirectList.java:410) at org.eclipse.persistence.testing.tests.jpa.cascadedeletes.CascadeDeletesJUnitTestSuite.testDeletePrivateOwned(CascadeDeletesJUnitTestSuite.java:141) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTestCase.java:600) at org.eclipse.persistence.testing.framework.TestExecutor.execute(TestExecutor.java:248) at org.eclipse.persistence.testing.framework.TestModel.execute(TestModel.java:211) at org.eclipse.persistence.testing.framework.TestCollection.run(TestCollection.java:313) This problem is caused by an error in the test itself. The test builds up a tree structure (simplified to relevant part): rootA | branchB / \ subbranchB1 subbranchB2 | leafB The test later accesses the first element in the list of subbranchBs that are related to branchB and implicitly assumes that always subbranchB1 is returned. Since the list is not sorted, this assumption is not always true. As a fix to this issue I would suggest to add an @OrderBy(id) annotation to the relationship between branchB and subbranchB. I'll upload a corresponding change to github.