Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331144 - ArrayIndexOutOfBoundsException when removing from a broken index list
Summary: ArrayIndexOutOfBoundsException when removing from a broken index list
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-25 12:37 EST by Chris Delahunt CLA
Modified: 2022-06-09 10:21 EDT (History)
0 users

See Also:


Attachments
test case and proposed fix (4.58 KB, patch)
2010-11-25 12:45 EST, Chris Delahunt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Delahunt CLA 2010-11-25 12:37:23 EST
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)
Comment 1 Chris Delahunt CLA 2010-11-25 12:45:28 EST
Created attachment 183873 [details]
test case and proposed fix
Comment 2 Chris Delahunt CLA 2010-11-25 13:25:15 EST
Checked into 2.2 revision 8567
Comment 3 Chris Delahunt CLA 2011-02-18 13:42:20 EST
Checked into 2.1.3, revision 8971
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:21:10 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink