Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313913 - IndexOutOfBoundsException on View Invalidation with multiple Views
Summary: IndexOutOfBoundsException on View Invalidation with multiple Views
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-21 09:48 EDT by Pascal Lehmann CLA
Modified: 2010-06-29 09:22 EDT (History)
0 users

See Also:


Attachments
TestCase (2.68 KB, text/plain)
2010-05-21 09:50 EDT, Pascal Lehmann CLA
stepper: iplog+
Details
proposed patch (2.16 KB, patch)
2010-05-21 09:51 EDT, Pascal Lehmann CLA
stepper: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Lehmann CLA 2010-05-21 09:48:14 EDT
Build Identifier: 3.0

When a remote view has to be invalidated, CDONotificationBuilder.buildNotification is called which does patch the indices (bug #306710). If there are more than one remote view present, the method is called multiple times which results in the indices patched more than needed.
This can lead to an IndexOutOfBoundsException in some of the remote views:

[ERROR] Index: 1, Size: 0
java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
	at java.util.ArrayList.add(Unknown Source)
	at org.eclipse.emf.cdo.internal.common.revision.delta.CDOAddFeatureDeltaImpl.apply(CDOAddFeatureDeltaImpl.java:50)
	at org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.apply(CDOListFeatureDeltaImpl.java:248)
	at org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl.apply(CDORevisionDeltaImpl.java:191)
	at org.eclipse.emf.internal.cdo.CDOStateMachine$InvalidateTransition.execute(CDOStateMachine.java:866)
	at org.eclipse.emf.internal.cdo.CDOStateMachine$InvalidateTransition.execute(CDOStateMachine.java:1)
	at org.eclipse.net4j.util.fsm.FiniteStateMachine.process(FiniteStateMachine.java:162)
	at org.eclipse.emf.internal.cdo.CDOStateMachine.invalidate(CDOStateMachine.java:418)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.invalidate(CDOViewImpl.java:1416)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.invalidate(CDOViewImpl.java:1367)
	at org.eclipse.emf.internal.cdo.session.CDOSessionImpl$InvalidationRunnable.run(CDOSessionImpl.java:1205)
	at org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:26)
	at org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:1)
	at org.eclipse.net4j.util.concurrent.QueueWorker.work(QueueWorker.java:75)
	at org.eclipse.net4j.util.concurrent.Worker$WorkerThread.run(Worker.java:188)

Reproducible: Always

Steps to Reproduce:
1. open transaction T and two views A and B
2. add adapters to A and B
3. make some changes on T and commit
Comment 1 Pascal Lehmann CLA 2010-05-21 09:50:36 EDT
Created attachment 169499 [details]
TestCase
Comment 2 Pascal Lehmann CLA 2010-05-21 09:51:38 EDT
Created attachment 169500 [details]
proposed patch

The patch creates a copy of the FeatureDelta proir to patching.
Comment 3 Pascal Lehmann CLA 2010-05-21 11:33:27 EDT
For patch & testcase:

1) The number of lines that you added/changed is smaller than 250.
confirmed
2) You are the only author of these changed lines.
confirmed
3) You apply the EPL to these changed lines.
confirmed
Comment 4 Eike Stepper CLA 2010-05-25 04:03:03 EDT
Thank you Pascal.

Committed to HEAD
Comment 5 Eike Stepper CLA 2010-06-29 04:35:51 EDT
Available in 3.0 GA:
http://download.eclipse.org/modeling/emf/cdo/updates/3.0-releases/