Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon McDuff2009-01-01 15:17:26 +0000
committerSimon McDuff2009-01-01 15:17:26 +0000
commite98bbf757597400506f269a7723abfa9c5a5a5c0 (patch)
treefb14c7903c8211663ef4e16280ed0370b2848f4b
parentf2495e877db47f4a789b0456ac76344f7554a76c (diff)
downloadcdo-e98bbf757597400506f269a7723abfa9c5a5a5c0.tar.gz
cdo-e98bbf757597400506f269a7723abfa9c5a5a5c0.tar.xz
cdo-e98bbf757597400506f269a7723abfa9c5a5a5c0.zip
[259695] ClassCastException on BasicEMap.clear
https://bugs.eclipse.org/bugs/show_bug.cgi?id=259695
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_259695_Test.java57
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java16
3 files changed, 76 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java
index e351af85c2..b222f6f925 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java
@@ -32,6 +32,8 @@ import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_254489_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_255662_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_256141_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_258278_Test;
+import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_258933_Test;
+import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_259695_Test;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTestSuite;
@@ -111,6 +113,7 @@ public abstract class AllTestsAllConfigs extends ConfigTestSuite
testClasses.add(Bugzilla_255662_Test.class);
testClasses.add(Bugzilla_256141_Test.class);
testClasses.add(Bugzilla_258278_Test.class);
+ testClasses.add(Bugzilla_259695_Test.class);
// TODO testClasses.add(NonCDOResourceTest.class);
// TODO testClasses.add(GeneratedEcoreTest.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_259695_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_259695_Test.java
new file mode 100644
index 0000000000..cc5c4f0d44
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_259695_Test.java
@@ -0,0 +1,57 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.tests.bugzilla;
+
+import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.CDOTransaction;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.model4.GenRefMapNonContained;
+import org.eclipse.emf.cdo.tests.model4.GenRefSingleContained;
+
+import org.eclipse.emf.ecore.EObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * ClassCastException on BasicEMap.clear
+ *
+ * @see https://bugs.eclipse.org/259695
+ * @author Simon McDuff
+ */
+public class Bugzilla_259695_Test extends AbstractCDOTest
+{
+ public void testBugzilla_259695_ClassCast() throws InterruptedException
+ {
+ CDOSession session = openSession();
+ session.getPackageRegistry().putEPackage(getModel4InterfacesPackage());
+ session.getPackageRegistry().putEPackage(getModel4Package());
+
+ CDOTransaction transaction = session.openTransaction();
+
+ CDOResource resource1 = transaction.createResource("test1");
+
+ GenRefMapNonContained elementA = getModel4Factory().createGenRefMapNonContained();
+ resource1.getContents().add(elementA);
+ List<EObject> expectedValue = new ArrayList<EObject>();
+ for (int i = 0; i < 10; i++)
+ {
+ GenRefSingleContained value = getModel4Factory().createGenRefSingleContained();
+ elementA.getElements().put(String.valueOf(i), value);
+ resource1.getContents().add(value);
+ expectedValue.add(value);
+ }
+ elementA.getElements().clear();
+ transaction.commit();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
index dce81f2bcb..bdf0633457 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
@@ -635,6 +635,22 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
size = delegateEList.size();
}
+ // Temporary fix. A fix should be available in EMF for that.
+ @Override
+ protected BasicEList<Entry<Object, Object>> newList()
+ {
+ return new BasicEList<Entry<Object, Object>>()
+ {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Object[] newData(int listCapacity)
+ {
+ return new BasicEMap.Entry[listCapacity];
+ }
+ };
+ }
+
private void checkListForReading()
{
if (!FSMUtil.isTransient(CDOObjectImpl.this))

Back to the top