Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 167345 Details for
Bug 306710
IndexOutOfBoundsException upon invalidation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch Proposal for the Notification Builder
patch_306710.txt (text/plain), 7.51 KB, created by
Michael Szediwy
on 2010-05-06 13:08:52 EDT
(
hide
)
Description:
Patch Proposal for the Notification Builder
Filename:
MIME Type:
Creator:
Michael Szediwy
Created:
2010-05-06 13:08:52 EDT
Size:
7.51 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.emf.cdo >Index: src/org/eclipse/emf/internal/cdo/CDONotificationBuilder.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDONotificationBuilder.java,v >retrieving revision 1.14 >diff -u -r1.14 CDONotificationBuilder.java >--- src/org/eclipse/emf/internal/cdo/CDONotificationBuilder.java 21 Apr 2010 06:57:57 -0000 1.14 >+++ src/org/eclipse/emf/internal/cdo/CDONotificationBuilder.java 6 May 2010 16:57:34 -0000 >@@ -25,6 +25,7 @@ > import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta; > import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta; > import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta; >+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.WithIndex; > import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; > import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager; > import org.eclipse.emf.cdo.view.CDOView; >@@ -34,6 +35,8 @@ > import org.eclipse.emf.ecore.EcorePackage; > import org.eclipse.emf.ecore.InternalEObject; > >+import java.util.ArrayList; >+import java.util.List; > import java.util.Set; > > /** >@@ -42,6 +45,14 @@ > */ > public class CDONotificationBuilder implements CDOFeatureDeltaVisitor > { >+ >+ public class IndexData >+ { >+ >+ public int size; >+ >+ } >+ > private CDOView view; > > private InternalEObject object; >@@ -126,13 +137,10 @@ > oldValue = view.getObject(id, false); > if (oldValue == null) > { >- for (CDOObject detachedObject : detachedObjects) >+ CDOObject cdoObject = findDetachedObjectsByCDOId(id); >+ if (cdoObject != null) > { >- if (detachedObject.cdoID().equals(id)) >- { >- oldValue = detachedObject; >- break; >- } >+ oldValue = cdoObject; > } > } > } >@@ -143,29 +151,162 @@ > public void visit(CDOSetFeatureDelta delta) > { > EStructuralFeature feature = delta.getFeature(); >- add(new CDODeltaNotificationImpl(object, NotificationImpl.SET, getEFeatureID(feature), getOldValue(feature), delta >- .getValue())); >+ >+ Object oldValue = getOldValue(feature); >+ >+ if (oldValue instanceof CDOID) >+ { >+ CDOID oldValueId = (CDOID)oldValue; >+ CDOObject cdoObject = findDetachedObjectsByCDOId(oldValueId); >+ if (cdoObject != null) >+ { >+ oldValue = cdoObject; >+ } >+ } >+ add(new CDODeltaNotificationImpl(object, NotificationImpl.SET, getEFeatureID(feature), oldValue, delta.getValue())); > } > > public void visit(CDOUnsetFeatureDelta delta) > { > EStructuralFeature feature = delta.getFeature(); >- add(new CDODeltaNotificationImpl(object, NotificationImpl.UNSET, getEFeatureID(feature), getOldValue(feature), null)); >+ >+ Object oldValue = getOldValue(feature); >+ >+ if (oldValue instanceof CDOID) >+ { >+ CDOID oldValueId = (CDOID)oldValue; >+ CDOObject cdoObject = findDetachedObjectsByCDOId(oldValueId); >+ if (cdoObject != null) >+ { >+ oldValue = cdoObject; >+ } >+ } >+ >+ add(new CDODeltaNotificationImpl(object, NotificationImpl.UNSET, getEFeatureID(feature), oldValue, null)); > } > > public void visit(CDOListFeatureDelta deltas) > { >+ >+ patchIndices(deltas); >+ > for (CDOFeatureDelta delta : deltas.getListChanges()) > { > delta.accept(this); > } > } > >+ private void patchIndices(CDOListFeatureDelta deltas) >+ { >+ List<CDOFeatureDelta> rest = new ArrayList<CDOFeatureDelta>(); >+ rest.addAll(deltas.getListChanges()); >+ for (CDOFeatureDelta delta : deltas.getListChanges()) >+ { >+ rest.remove(delta); >+ if (delta instanceof CDOAddFeatureDelta) >+ { >+ CDOAddFeatureDelta addDelta = (CDOAddFeatureDelta)delta; >+ for (CDOFeatureDelta cdoFeatureDelta : rest) >+ { >+ if (cdoFeatureDelta instanceof CDOClearFeatureDelta) >+ { >+ break; >+ } >+ >+ if (cdoFeatureDelta instanceof WithIndex) >+ { >+ WithIndex withIndex = (WithIndex)cdoFeatureDelta; >+ withIndex.adjustAfterRemoval(addDelta.getIndex()); >+ } >+ } >+ >+ } >+ else if (delta instanceof CDORemoveFeatureDelta) >+ { >+ CDORemoveFeatureDelta removeDelta = (CDORemoveFeatureDelta)delta; >+ for (CDOFeatureDelta cdoFeatureDelta : rest) >+ { >+ if (cdoFeatureDelta instanceof CDOClearFeatureDelta) >+ { >+ break; >+ } >+ if (cdoFeatureDelta instanceof WithIndex) >+ { >+ WithIndex withIndex = (WithIndex)cdoFeatureDelta; >+ withIndex.adjustAfterAddition(removeDelta.getIndex()); >+ } >+ } >+ } >+ else if (delta instanceof CDOClearFeatureDelta) >+ { >+ // Nothing to do :-) >+ >+ } >+ else if (delta instanceof CDOMoveFeatureDelta) >+ { >+ CDOMoveFeatureDelta moveDelta = (CDOMoveFeatureDelta)delta; >+ >+ for (CDOFeatureDelta cdoFeatureDelta : rest) >+ { >+ >+ if (cdoFeatureDelta instanceof CDOClearFeatureDelta) >+ { >+ break; >+ } >+ >+ if (cdoFeatureDelta instanceof WithIndex) >+ { >+ WithIndex withIndex = (WithIndex)cdoFeatureDelta; >+ withIndex.adjustAfterAddition(moveDelta.getOldPosition()); >+ withIndex.adjustAfterRemoval(moveDelta.getNewPosition()); >+ } >+ } >+ >+ } >+ } >+ } >+ > public void visit(CDOClearFeatureDelta delta) > { >+ > EStructuralFeature feature = delta.getFeature(); >- add(new CDODeltaNotificationImpl(object, NotificationImpl.REMOVE_MANY, getEFeatureID(feature), >- getOldValue(feature), null)); >+ Object oldValue = getOldValue(feature); >+ if (oldValue instanceof List<?>) >+ { >+ List<?> idList = (List<?>)oldValue; >+ if (!idList.isEmpty() && idList.get(0) instanceof CDOID) >+ { >+ List<CDOObject> oldValueObjects = new ArrayList<CDOObject>(idList.size()); >+ List<CDOID> cdoIdList = (List<CDOID>)idList; >+ for (CDOID cdoId : cdoIdList) >+ { >+ CDOObject oldObject = findDetachedObjectsByCDOId(cdoId); >+ if (oldObject != null) >+ { >+ oldValueObjects.add(oldObject); >+ } >+ } >+ oldValue = oldValueObjects; >+ } >+ >+ } >+ >+ add(new CDODeltaNotificationImpl(object, NotificationImpl.REMOVE_MANY, getEFeatureID(feature), oldValue, null)); >+ } >+ >+ private CDOObject findDetachedObjectsByCDOId(CDOID cdoid) >+ { >+ if (detachedObjects != null) >+ { >+ for (CDOObject cdoObject : detachedObjects) >+ { >+ if (cdoObject.cdoID().equals(cdoid)) >+ { >+ return cdoObject; >+ } >+ } >+ } >+ return null; > } > > public void visit(CDOContainerFeatureDelta delta) >@@ -174,6 +315,17 @@ > if (oldRevision != null) > { > oldValue = oldRevision.getContainerID(); >+ >+ if (oldValue instanceof CDOID) >+ { >+ CDOID oldValueId = (CDOID)oldValue; >+ CDOObject cdoObject = findDetachedObjectsByCDOId(oldValueId); >+ if (cdoObject != null) >+ { >+ oldValue = cdoObject; >+ } >+ } >+ > } > > add(new CDODeltaNotificationImpl(object, NotificationImpl.SET, EcorePackage.eINSTANCE.eContainmentFeature(),
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 306710
:
165282
|
167345
|
170330
|
170332
|
170958
|
171709