summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaspar De Groot2011-04-28 04:12:00 (EDT)
committerCaspar De Groot2011-04-28 04:12:00 (EDT)
commit32eb7d2ac2344ed42baea8c3a612acea2d84844c (patch)
tree8abd1939c0aa1e9764e081c4a74fbb0ecf3aaa4d
parentdd86bcd3afd4397736f114f050e199cfc4843692 (diff)
downloadcdo-32eb7d2ac2344ed42baea8c3a612acea2d84844c.zip
cdo-32eb7d2ac2344ed42baea8c3a612acea2d84844c.tar.gz
cdo-32eb7d2ac2344ed42baea8c3a612acea2d84844c.tar.bz2
[Bug 344072] Reattachment registers object as DIRTY even when it's not
https://bugs.eclipse.org/bugs/show_bug.cgi?id=344072
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_283985_1_Test.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_283985_3_Test.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStateMachine.java13
3 files changed, 15 insertions, 8 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_283985_1_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_283985_1_Test.java
index f93d9f8..c0d785e 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_283985_1_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_283985_1_Test.java
@@ -378,7 +378,7 @@ public class Bugzilla_283985_1_Test extends AbstractCDOTest
order2.getOrderDetails().add(detail1);
contains = order2.getOrderDetails().contains(detail1);
assertEquals(true, contains);
- assertEquals(true, CDOUtil.getCDOObject(detail1).cdoState() == CDOState.DIRTY);
+ assertEquals(true, CDOUtil.getCDOObject(detail1).cdoState() == CDOState.CLEAN);
order2.getOrderDetails().remove(detail1);
assertEquals(true, CDOUtil.getCDOObject(detail1).cdoState() == CDOState.TRANSIENT);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_283985_3_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_283985_3_Test.java
index ce40ac7..90115a4 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_283985_3_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_283985_3_Test.java
@@ -84,7 +84,7 @@ public class Bugzilla_283985_3_Test extends AbstractCDOTest
transaction.setSavepoint();
order1.getOrderDetails().add(detail1);
- assertDirty(detail1, transaction);
+ assertClean(detail1, transaction);
transaction.commit();
assertEquals(id, CDOUtil.getCDOObject(detail1).cdoID());
@@ -105,7 +105,7 @@ public class Bugzilla_283985_3_Test extends AbstractCDOTest
order1.getOrderDetails().add(detail1);
assertEquals(true, sp.getReattachedObjects().containsValue(CDOUtil.getCDOObject(detail1)));
- assertDirty(detail1, transaction);
+ assertClean(detail1, transaction);
sp.rollback();
System.out.println(CDOUtil.getCDOObject(detail1).cdoState());
@@ -128,13 +128,13 @@ public class Bugzilla_283985_3_Test extends AbstractCDOTest
order1.getOrderDetails().add(detail1);
transaction.setSavepoint();
- assertDirty(detail1, transaction);
+ assertClean(detail1, transaction);
order1.getOrderDetails().remove(detail1);
assertTransient(detail1);
transaction.getLastSavepoint().rollback();
- assertDirty(detail1, transaction);
+ assertClean(detail1, transaction);
transaction.commit();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStateMachine.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStateMachine.java
index ec80f43..cce0b27 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStateMachine.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStateMachine.java
@@ -677,9 +677,16 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
// Compute a revision delta and register it with the tx
CDORevision cleanRevision = revisionManager.getRevisionByVersion(id, revKey, -1, true);
CDORevisionDelta revisionDelta = revision.compare(cleanRevision);
- transaction.registerRevisionDelta(revisionDelta);
- transaction.registerDirty(object, null);
- changeState(object, CDOState.DIRTY);
+ if (!revisionDelta.isEmpty())
+ {
+ transaction.registerRevisionDelta(revisionDelta);
+ transaction.registerDirty(object, (CDOFeatureDelta)null);
+ changeState(object, CDOState.DIRTY);
+ }
+ else
+ {
+ changeState(object, CDOState.CLEAN);
+ }
// Add the object to the set of reattached objects
transaction.getLastSavepoint().getReattachedObjects().put(id, object);