summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-03-12 15:10:36 (EDT)
committerEike Stepper2008-03-12 15:10:36 (EDT)
commit864f88ae699f36488ca930feb7c4f799982ca9ce (patch)
tree39e5b80b1b21ad45ff19ef5b03586991f0e7a7fb
parentef2419ce8fe01f574c0668ff9c4a7fd3b94a0e40 (diff)
downloadcdo-864f88ae699f36488ca930feb7c4f799982ca9ce.zip
cdo-864f88ae699f36488ca930feb7c4f799982ca9ce.tar.gz
cdo-864f88ae699f36488ca930feb7c4f799982ca9ce.tar.bz2
[221149] Bug in Enum support
https://bugs.eclipse.org/bugs/show_bug.cgi?id=221149
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EnumTest.java25
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java9
2 files changed, 30 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EnumTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EnumTest.java
index 3e6c74d..0ebdf4d 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EnumTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EnumTest.java
@@ -44,6 +44,18 @@ public class EnumTest extends AbstractCDOTest
CDOResource resource = transaction.getResource("/my/resource");
Product product = (Product)resource.getContents().get(0);
assertEquals(VAT.VAT7, product.getVat());
+
+ product.setVat(VAT.VAT15);
+ transaction.commit();
+ session.close();
+ }
+
+ {
+ CDOSession session = openModel1Session();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.getResource("/my/resource");
+ Product product = (Product)resource.getContents().get(0);
+ assertEquals(VAT.VAT15, product.getVat());
session.close();
}
}
@@ -73,6 +85,19 @@ public class EnumTest extends AbstractCDOTest
Category category = (Category)resource.getContents().get(0);
Product product = category.getProducts().get(0);
assertEquals(VAT.VAT7, product.getVat());
+
+ product.setVat(VAT.VAT15);
+ transaction.commit();
+ session.close();
+ }
+
+ {
+ CDOSession session = openModel1Session();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.getResource("/my/resource");
+ Category category = (Category)resource.getContents().get(0);
+ Product product = category.getProducts().get(0);
+ assertEquals(VAT.VAT15, product.getVat());
session.close();
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
index 7f283d0..d0701b9 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
@@ -356,6 +356,11 @@ public final class CDOStore implements EStore
TRACER.format("set({0}, {1}, {2}, {3})", cdoObject, cdoFeature, index, value);
}
+ if (cdoFeature.getType() == CDOType.CUSTOM)
+ {
+ value = EcoreUtil.convertToString((EDataType)eFeature.getEType(), value);
+ }
+
CDOFeatureDelta delta = new CDOSetFeatureDeltaImpl(cdoFeature, index, value);
InternalCDORevision revision = getRevisionForWriting(cdoObject, delta);
if (cdoFeature.isReference())
@@ -371,10 +376,6 @@ public final class CDOStore implements EStore
handleContainmentAdd(cdoObject, value);
}
}
- else if (cdoFeature.getType() == CDOType.CUSTOM)
- {
- value = EcoreUtil.convertToString((EDataType)eFeature.getEType(), value);
- }
Object result = revision.set(cdoFeature, index, value);