aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2018-07-27 09:04:07 -0400
committerEike Stepper2018-07-27 09:04:07 -0400
commit53a0d2faf5f64226aa17775f71ee63de2353895b (patch)
treebf13d4ab78f777c52a94a7e298a8e36bcdf77c3a
parent4fd0c31bf0c5eda3b91234583e335c626209a48d (diff)
downloadcdo-53a0d2faf5f64226aa17775f71ee63de2353895b.tar.gz
cdo-53a0d2faf5f64226aa17775f71ee63de2353895b.tar.xz
cdo-53a0d2faf5f64226aa17775f71ee63de2353895b.zip
[537081] Cannot unset a Reference with external EObject as values
https://bugs.eclipse.org/bugs/show_bug.cgi?id=537081
-rw-r--r--features/org.eclipse.emf.cdo-feature/feature.xml2
-rw-r--r--features/org.eclipse.emf.cdo-feature/pom.xml2
-rw-r--r--features/org.eclipse.emf.cdo.server-feature/feature.xml2
-rw-r--r--features/org.eclipse.emf.cdo.server-feature/pom.xml2
-rw-r--r--features/org.eclipse.emf.cdo.server.embedded-feature/feature.xml2
-rw-r--r--features/org.eclipse.emf.cdo.server.embedded-feature/pom.xml2
-rw-r--r--features/org.eclipse.emf.cdo.tests-feature/feature.xml2
-rw-r--r--features/org.eclipse.emf.cdo.tests-feature/pom.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF24
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/pom.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java10
-rw-r--r--plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF52
-rw-r--r--plugins/org.eclipse.emf.cdo/pom.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java55
14 files changed, 95 insertions, 66 deletions
diff --git a/features/org.eclipse.emf.cdo-feature/feature.xml b/features/org.eclipse.emf.cdo-feature/feature.xml
index dd76d6e074..5d77738c13 100644
--- a/features/org.eclipse.emf.cdo-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo-feature/feature.xml
@@ -13,7 +13,7 @@
<feature
id="org.eclipse.emf.cdo"
label="%featureName"
- version="4.7.0.qualifier"
+ version="4.7.100.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.emf.cdo-feature/pom.xml b/features/org.eclipse.emf.cdo-feature/pom.xml
index 1229e23d1a..8d4c20dfd6 100644
--- a/features/org.eclipse.emf.cdo-feature/pom.xml
+++ b/features/org.eclipse.emf.cdo-feature/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo.features</groupId>
<artifactId>org.eclipse.emf.cdo</artifactId>
- <version>4.7.0-SNAPSHOT</version>
+ <version>4.7.100-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.emf.cdo.server-feature/feature.xml b/features/org.eclipse.emf.cdo.server-feature/feature.xml
index 4d52f1a36d..35a46f958b 100644
--- a/features/org.eclipse.emf.cdo.server-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo.server-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.emf.cdo.server"
label="%featureName"
- version="4.7.0.qualifier"
+ version="4.7.100.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.emf.cdo.license"
diff --git a/features/org.eclipse.emf.cdo.server-feature/pom.xml b/features/org.eclipse.emf.cdo.server-feature/pom.xml
index 141fdc11e8..ec2925f6f5 100644
--- a/features/org.eclipse.emf.cdo.server-feature/pom.xml
+++ b/features/org.eclipse.emf.cdo.server-feature/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo.features</groupId>
<artifactId>org.eclipse.emf.cdo.server</artifactId>
- <version>4.7.0-SNAPSHOT</version>
+ <version>4.7.100-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.emf.cdo.server.embedded-feature/feature.xml b/features/org.eclipse.emf.cdo.server.embedded-feature/feature.xml
index 5c20ea9a18..a6c80258d6 100644
--- a/features/org.eclipse.emf.cdo.server.embedded-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo.server.embedded-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.emf.cdo.server.embedded"
label="%featureName"
- version="4.7.0.qualifier"
+ version="4.7.100.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.emf.cdo.license"
diff --git a/features/org.eclipse.emf.cdo.server.embedded-feature/pom.xml b/features/org.eclipse.emf.cdo.server.embedded-feature/pom.xml
index dd9cd6af68..b13684a8d3 100644
--- a/features/org.eclipse.emf.cdo.server.embedded-feature/pom.xml
+++ b/features/org.eclipse.emf.cdo.server.embedded-feature/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo.features</groupId>
<artifactId>org.eclipse.emf.cdo.server.embedded</artifactId>
- <version>4.7.0-SNAPSHOT</version>
+ <version>4.7.100-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.emf.cdo.tests-feature/feature.xml b/features/org.eclipse.emf.cdo.tests-feature/feature.xml
index 37ea30f231..ec535cba7b 100644
--- a/features/org.eclipse.emf.cdo.tests-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo.tests-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.emf.cdo.tests"
label="%featureName"
- version="4.3.0.qualifier"
+ version="4.3.100.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.emf.cdo.tests-feature/pom.xml b/features/org.eclipse.emf.cdo.tests-feature/pom.xml
index 56697968ad..8a7bd5bba5 100644
--- a/features/org.eclipse.emf.cdo.tests-feature/pom.xml
+++ b/features/org.eclipse.emf.cdo.tests-feature/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo.features</groupId>
<artifactId>org.eclipse.emf.cdo.tests</artifactId>
- <version>4.3.0-SNAPSHOT</version>
+ <version>4.3.100-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
index 6b023ac983..e26c4a1de2 100644
--- a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.tests;singleton:=true
-Bundle-Version: 4.0.700.qualifier
+Bundle-Version: 4.0.800.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -48,17 +48,17 @@ Export-Package: base;version="4.0.200",
interface_;version="4.0.200",
interface_.impl;version="4.0.200",
interface_.util;version="4.0.200",
- org.eclipse.emf.cdo.tests;version="4.0.700",
- org.eclipse.emf.cdo.tests.bugzilla;version="4.0.700",
- org.eclipse.emf.cdo.tests.bundle;version="4.0.700";x-internal:=true,
- org.eclipse.emf.cdo.tests.config;version="4.0.700",
- org.eclipse.emf.cdo.tests.config.impl;version="4.0.700",
- org.eclipse.emf.cdo.tests.extra;version="4.0.700",
- org.eclipse.emf.cdo.tests.offline;version="4.0.700",
- org.eclipse.emf.cdo.tests.performance;version="4.0.700",
- org.eclipse.emf.cdo.tests.performance.framework;version="4.0.700",
- org.eclipse.emf.cdo.tests.revisioncache;version="4.0.700",
- org.eclipse.emf.cdo.tests.util;version="4.0.700",
+ org.eclipse.emf.cdo.tests;version="4.0.800",
+ org.eclipse.emf.cdo.tests.bugzilla;version="4.0.800",
+ org.eclipse.emf.cdo.tests.bundle;version="4.0.800";x-internal:=true,
+ org.eclipse.emf.cdo.tests.config;version="4.0.800",
+ org.eclipse.emf.cdo.tests.config.impl;version="4.0.800",
+ org.eclipse.emf.cdo.tests.extra;version="4.0.800",
+ org.eclipse.emf.cdo.tests.offline;version="4.0.800",
+ org.eclipse.emf.cdo.tests.performance;version="4.0.800",
+ org.eclipse.emf.cdo.tests.performance.framework;version="4.0.800",
+ org.eclipse.emf.cdo.tests.revisioncache;version="4.0.800",
+ org.eclipse.emf.cdo.tests.util;version="4.0.800",
reference;version="4.0.200",
reference.impl;version="4.0.200";
x-friends:="org.eclipse.emf.cdo.dawn.tests,
diff --git a/plugins/org.eclipse.emf.cdo.tests/pom.xml b/plugins/org.eclipse.emf.cdo.tests/pom.xml
index f06eea9345..5b40be3b26 100644
--- a/plugins/org.eclipse.emf.cdo.tests/pom.xml
+++ b/plugins/org.eclipse.emf.cdo.tests/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.emf.cdo.tests</artifactId>
- <version>4.0.700-SNAPSHOT</version>
+ <version>4.0.800-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java
index b6381c2436..165fbaec8d 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java
@@ -55,6 +55,7 @@ import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -395,7 +396,8 @@ public class ExternalReferenceTest extends AbstractCDOTest
CDOTransaction transaction = session.openTransaction(resourceSet);
Supplier supplier = getModel1Factory().createSupplier();
- supplier.getPurchaseOrders().add(externalObject);
+ EList<PurchaseOrder> purchaseOrders = supplier.getPurchaseOrders();
+ purchaseOrders.add(externalObject);
CDOResource resource = transaction.createResource(getResourcePath("/internal"));
resource.getContents().add(supplier);
@@ -404,6 +406,12 @@ public class ExternalReferenceTest extends AbstractCDOTest
CDORevision salesOrderRevision = CDOUtil.getCDOObject(supplier).cdoRevision();
Object externalReference = salesOrderRevision.data().get(getModel1Package().getSupplier_PurchaseOrders(), 0);
assertInstanceOf(CDOIDExternal.class, externalReference);
+
+ assertEquals(externalObject, purchaseOrders.get(0));
+ assertEquals(0, purchaseOrders.indexOf(externalObject));
+ assertEquals(0, purchaseOrders.lastIndexOf(externalObject));
+ assertTrue(purchaseOrders.contains(externalObject));
+ assertTrue(purchaseOrders.containsAll(Collections.singleton(externalObject))); // Bug 537081.
}
public void testWithXMLAndPrefetching() throws Exception
diff --git a/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF
index 9ab77b0ab3..afff752c79 100644
--- a/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo; singleton:=true
-Bundle-Version: 4.6.100.qualifier
+Bundle-Version: 4.6.200.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -10,28 +10,28 @@ Bundle-Activator: org.eclipse.emf.internal.cdo.bundle.Activator$Implementation
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)";resolution:=optional,
org.eclipse.emf.cdo.common;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.emf.cdo;version="4.6.100",
- org.eclipse.emf.cdo.eresource;version="4.6.100",
- org.eclipse.emf.cdo.eresource.impl;version="4.6.100",
- org.eclipse.emf.cdo.eresource.util;version="4.6.100",
- org.eclipse.emf.cdo.eresource.validation;version="4.6.100",
- org.eclipse.emf.cdo.etypes;version="4.6.100",
- org.eclipse.emf.cdo.etypes.impl;version="4.6.100",
- org.eclipse.emf.cdo.etypes.util;version="4.6.100",
- org.eclipse.emf.cdo.session;version="4.6.100",
- org.eclipse.emf.cdo.session.remote;version="4.6.100",
- org.eclipse.emf.cdo.transaction;version="4.6.100",
- org.eclipse.emf.cdo.util;version="4.6.100",
- org.eclipse.emf.cdo.view;version="4.6.100",
- org.eclipse.emf.internal.cdo;version="4.6.100",
- org.eclipse.emf.internal.cdo.analyzer;version="4.6.100";
+Export-Package: org.eclipse.emf.cdo;version="4.6.200",
+ org.eclipse.emf.cdo.eresource;version="4.6.200",
+ org.eclipse.emf.cdo.eresource.impl;version="4.6.200",
+ org.eclipse.emf.cdo.eresource.util;version="4.6.200",
+ org.eclipse.emf.cdo.eresource.validation;version="4.6.200",
+ org.eclipse.emf.cdo.etypes;version="4.6.200",
+ org.eclipse.emf.cdo.etypes.impl;version="4.6.200",
+ org.eclipse.emf.cdo.etypes.util;version="4.6.200",
+ org.eclipse.emf.cdo.session;version="4.6.200",
+ org.eclipse.emf.cdo.session.remote;version="4.6.200",
+ org.eclipse.emf.cdo.transaction;version="4.6.200",
+ org.eclipse.emf.cdo.util;version="4.6.200",
+ org.eclipse.emf.cdo.view;version="4.6.200",
+ org.eclipse.emf.internal.cdo;version="4.6.200",
+ org.eclipse.emf.internal.cdo.analyzer;version="4.6.200";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.ui",
- org.eclipse.emf.internal.cdo.bundle;version="4.6.100";x-friends:="org.eclipse.emf.cdo.ui",
- org.eclipse.emf.internal.cdo.messages;version="4.6.100";x-internal:=true,
- org.eclipse.emf.internal.cdo.object;version="4.6.100";
+ org.eclipse.emf.internal.cdo.bundle;version="4.6.200";x-friends:="org.eclipse.emf.cdo.ui",
+ org.eclipse.emf.internal.cdo.messages;version="4.6.200";x-internal:=true,
+ org.eclipse.emf.internal.cdo.object;version="4.6.200";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
@@ -40,13 +40,13 @@ Export-Package: org.eclipse.emf.cdo;version="4.6.100",
org.eclipse.emf.cdo.explorer,
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.edit",
- org.eclipse.emf.internal.cdo.query;version="4.6.100";
+ org.eclipse.emf.internal.cdo.query;version="4.6.200";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests.objectivity",
- org.eclipse.emf.internal.cdo.session;version="4.6.100";
+ org.eclipse.emf.internal.cdo.session;version="4.6.200";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
@@ -56,23 +56,23 @@ Export-Package: org.eclipse.emf.cdo;version="4.6.100",
org.eclipse.emf.cdo.security.ui,
org.eclipse.emf.cdo.explorer,
org.eclipse.emf.cdo.explorer.ui",
- org.eclipse.emf.internal.cdo.session.remote;version="4.6.100";
+ org.eclipse.emf.internal.cdo.session.remote;version="4.6.200";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.ui",
- org.eclipse.emf.internal.cdo.transaction;version="4.6.100";
+ org.eclipse.emf.internal.cdo.transaction;version="4.6.200";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.explorer.ui",
- org.eclipse.emf.internal.cdo.util;version="4.6.100";
+ org.eclipse.emf.internal.cdo.util;version="4.6.200";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.ui",
- org.eclipse.emf.internal.cdo.view;version="4.6.100";
+ org.eclipse.emf.internal.cdo.view;version="4.6.200";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
@@ -80,6 +80,6 @@ Export-Package: org.eclipse.emf.cdo;version="4.6.100",
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.explorer,
org.eclipse.emf.cdo.explorer.ui",
- org.eclipse.emf.spi.cdo;version="4.6.100"
+ org.eclipse.emf.spi.cdo;version="4.6.200"
Bundle-ActivationPolicy: lazy
Automatic-Module-Name: org.eclipse.emf.cdo
diff --git a/plugins/org.eclipse.emf.cdo/pom.xml b/plugins/org.eclipse.emf.cdo/pom.xml
index 56e6e57c4f..e6f81381bb 100644
--- a/plugins/org.eclipse.emf.cdo/pom.xml
+++ b/plugins/org.eclipse.emf.cdo/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.emf.cdo</artifactId>
- <version>4.6.100-SNAPSHOT</version>
+ <version>4.6.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java
index ac9b2cc975..933b658908 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOStoreImpl.java
@@ -329,18 +329,39 @@ public final class CDOStoreImpl implements CDOStore
TRACER.format("contains({0}, {1}, {2})", cdoObject, feature, value); //$NON-NLS-1$
}
- Object convertedValue = convertToCDO(cdoObject, feature, value);
+ // Don't use CDORevision.contains() for EReference features because
+ // CDOIDExternal isn't converted to an EObject and, hence, fails to compare
+ // properly to an external EObject.
InternalCDORevision revision = readRevision(cdoObject);
- boolean result = revision.contains(feature, convertedValue);
+ int size = revision.size(feature);
- // Special handling of detached (TRANSIENT) objects, see bug 354395
- if (!result && value != convertedValue && value instanceof EObject)
+ if (value == null)
{
- result = revision.contains(feature, value);
+ for (int i = 0; i < size; i++)
+ {
+ Object element = revision.get(feature, i);
+ Object emfElement = convertToEMF(eObject, revision, feature, i, element);
+ if (emfElement == null)
+ {
+ return true;
+ }
+ }
+ }
+ else
+ {
+ for (int i = 0; i < size; i++)
+ {
+ Object element = revision.get(feature, i);
+ Object emfElement = convertToEMF(eObject, revision, feature, i, element);
+ if (value.equals(emfElement))
+ {
+ return true;
+ }
+ }
}
- return result;
+ return false;
}
finally
{
@@ -753,26 +774,26 @@ public final class CDOStoreImpl implements CDOStore
*/
public Object resolveProxy(InternalCDORevision revision, EStructuralFeature feature, int index, Object value)
{
- synchronized (view.getViewMonitor())
+ if (value instanceof CDOElementProxy)
{
- view.lockView();
-
- try
+ synchronized (view.getViewMonitor())
{
- if (value instanceof CDOElementProxy)
+ view.lockView();
+
+ try
{
// Resolve proxy
CDOElementProxy proxy = (CDOElementProxy)value;
value = view.getSession().resolveElementProxy(revision, feature, index, proxy.getIndex());
}
-
- return value;
- }
- finally
- {
- view.unlockView();
+ finally
+ {
+ view.unlockView();
+ }
}
}
+
+ return value;
}
/**