Community
Participate
Working Groups
When removing from a list using an index as described in feature added for bug 249037, an ArrayIndexOutOfBoundsException will occur if the list broken in the database and the OrderCorrectionType is READ_WRITE. By broken, I mean the index values used for the list in the database table are not sequential or one is null. ArrayIndexOutOfBoundsException is thrown when an object has been removed and EclipseLink tries to fix the list (due to the READ_WRITE): java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.Vector.get(Vector.java:696) at org.eclipse.persistence.indirection.IndirectList.get(IndirectList.java:384) at org.eclipse.persistence.mappings.CollectionMapping.compareObjectsAndWrite(CollectionMapping.java:561) at org.eclipse.persistence.mappings.OneToManyMapping.postUpdate(OneToManyMapping.java:1015) at org.eclipse.persistence.descriptors.DescriptorQueryManager.postUpdate(DescriptorQueryManager.java:924) at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1157) at org.eclipse.persistence.queries.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:84) at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:287) at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58) at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:675) at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:589) at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:109) at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:86) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2898) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1167) at org.eclipse.persistence.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:233) at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:163) at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:116) at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:3260) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1413)
Created attachment 183873 [details] test case and proposed fix
Checked into 2.2 revision 8567
Checked into 2.1.3, revision 8971
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink