Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2016-08-26 08:09:27 +0000
committerEike Stepper2016-08-26 08:09:27 +0000
commitdb5648d430418882f309c19c455032d69d4f5702 (patch)
tree151cd53b372423b2fc365e6aecbe4027532b837d /plugins
parent158fb1b47c4efc1a103713d87d234f4f8cc06bc6 (diff)
downloadcdo-db5648d430418882f309c19c455032d69d4f5702.tar.gz
cdo-db5648d430418882f309c19c455032d69d4f5702.tar.xz
cdo-db5648d430418882f309c19c455032d69d4f5702.zip
[486653] Rollback of objects in NEW state don't update correctly container field
https://bugs.eclipse.org/bugs/show_bug.cgi?id=486653
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_383370_Test.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java18
2 files changed, 16 insertions, 7 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_383370_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_383370_Test.java
index d2fd118525..93cf50777b 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_383370_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_383370_Test.java
@@ -13,7 +13,6 @@ package org.eclipse.emf.cdo.tests.bugzilla;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.tests.AbstractCDOTest;
-import org.eclipse.emf.cdo.tests.config.IConfig;
import org.eclipse.emf.cdo.tests.model1.Category;
import org.eclipse.emf.cdo.tests.model1.Company;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
@@ -30,7 +29,6 @@ import org.eclipse.emf.ecore.EObject;
*/
public class Bugzilla_383370_Test extends AbstractCDOTest
{
- @Skips(IConfig.EFFORT_MERGING)
public void testTopLevel() throws Exception
{
Category category = getModel1Factory().createCategory();
@@ -54,7 +52,6 @@ public class Bugzilla_383370_Test extends AbstractCDOTest
assertEquals(resource, category.eResource());
}
- @Skips(IConfig.EFFORT_MERGING)
public void testTopLevelWithChildren() throws Exception
{
Category category = getModel1Factory().createCategory();
@@ -83,7 +80,6 @@ public class Bugzilla_383370_Test extends AbstractCDOTest
assertEquals(category, child.eContainer());
}
- @Skips(IConfig.EFFORT_MERGING)
public void testSecondLevel() throws Exception
{
Company company = getModel1Factory().createCompany();
@@ -109,7 +105,6 @@ public class Bugzilla_383370_Test extends AbstractCDOTest
assertEquals(company, category.eContainer());
}
- @Skips(IConfig.EFFORT_MERGING)
public void testSecondLevelWithChildren() throws Exception
{
Company company = getModel1Factory().createCompany();
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 8c475d932f..5108fdc34f 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
@@ -1776,12 +1776,26 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
if (idOrObject instanceof CDOObjectImpl)
{
CDOObjectImpl impl = (CDOObjectImpl)idOrObject;
+ InternalCDORevision revision = impl.cdoRevision();
+
Resource.Internal directResource = impl.eDirectResource();
EObject container = impl.eContainer();
if (!toBeDetached.contains(directResource) && !toBeDetached.contains(container))
{
- // Unset direct resource and/or eContainer
- impl.cdoInternalSetResource(null);
+ if (revision != null)
+ {
+ // Unset direct resource and container in the revision.
+ // Later cdoInternalPostDetach() will migrate these values into the EObject.
+ // See CDOStateMachine.RollbackTransition.execute().
+ revision.setResourceID(null);
+ revision.setContainerID(null);
+ revision.setContainingFeatureID(0);
+ }
+ else
+ {
+ // Unset direct resource and eContainer in the EObject.
+ impl.cdoInternalSetResource(null);
+ }
}
}
else if (idOrObject instanceof CDOObjectWrapper)

Back to the top