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 170330 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]
better patch for CDONotificationBuilder
CDONotificationBuilderPatch.txt (text/plain), 5.96 KB, created by
Pascal Lehmann
on 2010-05-28 08:17:00 EDT
(
hide
)
Description:
better patch for CDONotificationBuilder
Filename:
MIME Type:
Creator:
Pascal Lehmann
Created:
2010-05-28 08:17:00 EDT
Size:
5.96 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.16 >diff -u -r1.16 CDONotificationBuilder.java >--- src/org/eclipse/emf/internal/cdo/CDONotificationBuilder.java 25 May 2010 08:03:10 -0000 1.16 >+++ src/org/eclipse/emf/internal/cdo/CDONotificationBuilder.java 28 May 2010 11:59:32 -0000 >@@ -25,9 +25,9 @@ > 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.spi.common.revision.InternalCDOFeatureDelta.WithIndex; > import org.eclipse.emf.cdo.view.CDOView; > > import org.eclipse.emf.common.notify.Notification; >@@ -62,6 +62,10 @@ > > private InternalCDORevision oldRevision; > >+ private CDOListFeatureDelta patchedListDelta; >+ >+ private CDOListFeatureDelta unpatchedListDelta; >+ > /** > * @since 3.0 > */ >@@ -87,6 +91,8 @@ > notification = null; > revision = null; > revisionLookedUp = false; >+ patchedListDelta = null; >+ unpatchedListDelta = null; > > this.object = object; > this.revisionDelta = revisionDelta; >@@ -108,8 +114,8 @@ > public void visit(CDOAddFeatureDelta delta) > { > EStructuralFeature feature = delta.getFeature(); >- add(new CDODeltaNotificationImpl(object, Notification.ADD, getEFeatureID(feature), getOldValue(feature), >- delta.getValue(), delta.getIndex())); >+ add(new CDODeltaNotificationImpl(object, Notification.ADD, getEFeatureID(feature), getOldValue(feature), delta >+ .getValue(), delta.getIndex())); > } > > public void visit(CDORemoveFeatureDelta delta) >@@ -123,18 +129,17 @@ > false); > } > >- Object oldValue = revision == null ? null : revision.get(feature, index); >+ // use patched index to retrieve object. >+ int patchedIndex = ((CDORemoveFeatureDelta)patchedListDelta.getListChanges().get( >+ unpatchedListDelta.getListChanges().indexOf(delta))).getIndex(); >+ Object oldValue = revision == null ? null : revision.get(feature, patchedIndex); > if (oldValue instanceof CDOID) > { >- CDOID id = (CDOID)oldValue; >- oldValue = view.getObject(id, false); >- if (oldValue == null) >+ CDOID oldValueId = (CDOID)oldValue; >+ CDOObject cdoObject = findObjectByID(oldValueId); >+ if (cdoObject != null) > { >- CDOObject cdoObject = findDetachedObjectByID(id); >- if (cdoObject != null) >- { >- oldValue = cdoObject; >- } >+ oldValue = cdoObject; > } > } > >@@ -148,7 +153,7 @@ > if (oldValue instanceof CDOID) > { > CDOID oldValueId = (CDOID)oldValue; >- CDOObject cdoObject = findDetachedObjectByID(oldValueId); >+ CDOObject cdoObject = findObjectByID(oldValueId); > if (cdoObject != null) > { > oldValue = cdoObject; >@@ -165,7 +170,7 @@ > if (oldValue instanceof CDOID) > { > CDOID oldValueId = (CDOID)oldValue; >- CDOObject cdoObject = findDetachedObjectByID(oldValueId); >+ CDOObject cdoObject = findObjectByID(oldValueId); > if (cdoObject != null) > { > oldValue = cdoObject; >@@ -177,10 +182,10 @@ > > public void visit(CDOListFeatureDelta deltas) > { >- // patch the indices on a copy to avoid duplicate patching. >- CDOListFeatureDelta workDelta = (CDOListFeatureDelta)deltas.copy(); >- patchIndices(workDelta); >- for (CDOFeatureDelta delta : workDelta.getListChanges()) >+ unpatchedListDelta = deltas; >+ patchedListDelta = (CDOListFeatureDelta)deltas.copy(); >+ patchIndices(patchedListDelta); >+ for (CDOFeatureDelta delta : deltas.getListChanges()) > { > delta.accept(this); > } >@@ -261,18 +266,15 @@ > List<?> list = (List<?>)oldValue; > if (!list.isEmpty() && list.get(0) instanceof CDOID) > { >- List<CDOObject> oldValueObjects = new ArrayList<CDOObject>(list.size()); >+ List<Object> oldValueObjects = new ArrayList<Object>(list.size()); > > @SuppressWarnings("unchecked") > List<CDOID> ids = (List<CDOID>)list; > > for (CDOID id : ids) > { >- CDOObject oldObject = findDetachedObjectByID(id); >- if (oldObject != null) >- { >- oldValueObjects.add(oldObject); >- } >+ CDOObject oldObject = findObjectByID(id); >+ oldValueObjects.add(oldObject != null ? oldObject : id); > } > > oldValue = oldValueObjects; >@@ -282,13 +284,23 @@ > add(new CDODeltaNotificationImpl(object, Notification.REMOVE_MANY, getEFeatureID(feature), oldValue, null)); > } > >+ private CDOObject findObjectByID(CDOID id) >+ { >+ CDOObject oldObject = view.getObject(id, false); >+ if (oldObject == null) >+ { >+ oldObject = findDetachedObjectByID(id); >+ } >+ return oldObject; >+ } >+ > private CDOObject findDetachedObjectByID(CDOID id) > { > if (detachedObjects != null) > { > for (CDOObject object : detachedObjects) > { >- if (object.cdoID().equals(id)) >+ if (id.equals(object.cdoID())) > { > return object; > } >@@ -308,7 +320,7 @@ > if (oldValue instanceof CDOID) > { > CDOID oldValueId = (CDOID)oldValue; >- CDOObject cdoObject = findDetachedObjectByID(oldValueId); >+ CDOObject cdoObject = findObjectByID(oldValueId); > if (cdoObject != null) > { > oldValue = cdoObject;
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