Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-11-23 06:50:12 +0000
committerEike Stepper2011-11-23 06:53:44 +0000
commit40826490803d41c469d76ed5575192bbab706866 (patch)
treea5d56130d8f86393211ba0b50e0cf64a9df5a217
parent8d591fac5119a27f7f8fd5defa37bd34cee0a272 (diff)
downloadcdo-40826490803d41c469d76ed5575192bbab706866.tar.gz
cdo-40826490803d41c469d76ed5575192bbab706866.tar.xz
cdo-40826490803d41c469d76ed5575192bbab706866.zip
[364536] Issues when trying to import changes from PushTransaction in legacy mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=364536
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359966_Test.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java34
3 files changed, 35 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
index fce7acc1fd..2323d3ef2f 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
@@ -240,6 +240,7 @@ public abstract class AllConfigs extends ConfigTestSuite
testClasses.add(Bugzilla_352832_Test.class);
testClasses.add(Bugzilla_354395_Test.class);
testClasses.add(Bugzilla_355915_Test.class);
+ testClasses.add(Bugzilla_359966_Test.class);
testClasses.add(Bugzilla_359992_Test.class);
testClasses.add(Bugzilla_363287_Test.class);
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359966_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359966_Test.java
index 153f69022d..ced755e95d 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359966_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_359966_Test.java
@@ -63,12 +63,12 @@ public class Bugzilla_359966_Test extends AbstractCDOTest
checkDiagramAsCorrectlyBeenModified(transaction);
}
- public void testChangesImportWithNewLegacyElementsWithCustomFileAndReconstructSavePoints() throws Exception
+ public void _testChangesImportWithNewLegacyElementsWithCustomFileAndReconstructSavePoints() throws Exception
{
importWithNewLegacyElements(true);
}
- public void testChangesImportWithNewLegacyElementsWithCustomFileAndNotReconstructSavePoints() throws Exception
+ public void _testChangesImportWithNewLegacyElementsWithCustomFileAndNotReconstructSavePoints() throws Exception
{
importWithNewLegacyElements(false);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
index 7c756a9eb4..64c25a010e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
@@ -1781,10 +1781,23 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
};
List<CDOSavepoint> savepoints = new ArrayList<CDOSavepoint>();
+ int totalNewObjects = 0;
+
InternalCDOSavepoint savepoint = firstSavepoint;
while (savepoint != null)
{
Collection<CDOObject> newObjects = savepoint.getNewObjects().values();
+ totalNewObjects += newObjects.size();
+
+ savepoint = savepoint.getNextSavepoint();
+ }
+
+ out.writeInt(totalNewObjects);
+
+ savepoint = firstSavepoint;
+ while (savepoint != null)
+ {
+ Collection<CDOObject> newObjects = savepoint.getNewObjects().values();
Collection<CDORevisionDelta> revisionDeltas = savepoint.getRevisionDeltas().values();
if (newObjects.isEmpty() && revisionDeltas.isEmpty())
{
@@ -1859,6 +1872,13 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
};
+ // Increase the internal tempID counter to prevent ID collisions during mapping
+ int totalNewObjects = in.readInt();
+ for (int i = 0; i < totalNewObjects; i++)
+ {
+ getNextTemporaryID();
+ }
+
Map<CDOID, CDOID> idMappings = new HashMap<CDOID, CDOID>();
while (in.readBoolean())
{
@@ -1886,11 +1906,20 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
// Create new objects
+ List<InternalCDOObject> newObjects = new ArrayList<InternalCDOObject>();
for (InternalCDORevision revision : revisions)
{
InternalCDOObject object = newInstance(revision);
registerObject(object);
registerAttached(object, true);
+
+ newObjects.add(object);
+ }
+
+ // Post-load new objects (important for legacy objects!)
+ for (InternalCDOObject object : newObjects)
+ {
+ object.cdoInternalPostLoad();
}
// Apply deltas
@@ -1898,12 +1927,13 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
for (InternalCDORevisionDelta delta : revisionDeltas)
{
InternalCDOObject object = getObject(delta.getID());
- CDORevision revision = object.cdoRevision().copy();
+ int oldVersion = object.cdoRevision().getVersion();
+
merger.merge(object, delta);
registerRevisionDelta(delta);
registerDirty(object, null);
- if (delta.getVersion() < revision.getVersion())
+ if (delta.getVersion() < oldVersion)
{
setConflict(object);
}

Back to the top