Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2017-01-02 11:31:23 -0500
committerEike Stepper2017-01-02 11:31:23 -0500
commit514e37b086e63350159b4ba5a3b1fe43ac6fe1b1 (patch)
treead9f3c4133b194446d038ba02cb5590defe57626
parentb405558680f88029ca96294e99e3b9daa25da76a (diff)
downloadcdo-514e37b086e63350159b4ba5a3b1fe43ac6fe1b1.tar.gz
cdo-514e37b086e63350159b4ba5a3b1fe43ac6fe1b1.tar.xz
cdo-514e37b086e63350159b4ba5a3b1fe43ac6fe1b1.zip
[509822] Duplicate feature deltas in CDOSavepoint.getAllRevisionDeltas()
https://bugs.eclipse.org/bugs/show_bug.cgi?id=509822
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java
index b6f5af508c..5471afcffc 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java
@@ -37,6 +37,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -516,9 +517,14 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
return Collections.unmodifiableMap(getRevisionDeltas2());
}
- // We need to combined the result for all delta in different Savepoint
+ InternalCDOSavepoint firstSavePoint = getFirstSavePoint();
+ boolean multiSavepoint = firstSavePoint.getNextSavepoint() != null;
+ Set<CDOFeatureDelta> originalFeatureDeltas = multiSavepoint ? new HashSet<CDOFeatureDelta>() : null;
+
+ // We need to combine the results for all deltas in different savepoints.
Map<CDOID, CDORevisionDelta> allRevisionDeltas = CDOIDUtil.createMap();
- for (InternalCDOSavepoint savepoint = getFirstSavePoint(); savepoint != null; savepoint = savepoint.getNextSavepoint())
+
+ for (InternalCDOSavepoint savepoint = firstSavePoint; savepoint != null; savepoint = savepoint.getNextSavepoint())
{
for (CDORevisionDelta revisionDelta : savepoint.getRevisionDeltas2().values())
{
@@ -528,14 +534,25 @@ public class CDOSavepointImpl extends CDOUserSavepointImpl implements InternalCD
CDORevisionDeltaImpl oldRevisionDelta = (CDORevisionDeltaImpl)allRevisionDeltas.get(id);
if (oldRevisionDelta == null)
{
+ if (multiSavepoint)
+ {
+ for (CDOFeatureDelta featureDelta : revisionDelta.getFeatureDeltas())
+ {
+ originalFeatureDeltas.add(featureDelta);
+ }
+ }
+
allRevisionDeltas.put(id, revisionDelta.copy());
}
else
{
- for (CDOFeatureDelta delta : revisionDelta.getFeatureDeltas())
+ for (CDOFeatureDelta featureDelta : revisionDelta.getFeatureDeltas())
{
- CDOFeatureDelta copy = ((InternalCDOFeatureDelta)delta).copy();
- oldRevisionDelta.addFeatureDelta(copy, null);
+ if (!multiSavepoint || originalFeatureDeltas.add(featureDelta))
+ {
+ CDOFeatureDelta copy = ((InternalCDOFeatureDelta)featureDelta).copy();
+ oldRevisionDelta.addFeatureDelta(copy, null);
+ }
}
}
}

Back to the top