summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaspar De Groot2011-03-22 22:50:27 (EDT)
committerCaspar De Groot2011-03-22 22:50:27 (EDT)
commitfc1a4ccc5e533db089f4e8cb752f196e9c5d7b21 (patch)
treee859d58db221782ecdd2f493bb34b63d8b512765
parent57a633079bb99025ded65b073164fbcf43ed4752 (diff)
downloadcdo-fc1a4ccc5e533db089f4e8cb752f196e9c5d7b21.zip
cdo-fc1a4ccc5e533db089f4e8cb752f196e9c5d7b21.tar.gz
cdo-fc1a4ccc5e533db089f4e8cb752f196e9c5d7b21.tar.bz2
[Bug 339313] Revision may contain CDOList with uninitialized values
https://bugs.eclipse.org/bugs/show_bug.cgi?id=339313
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadRevisionsIndication.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_339313_Test.java61
3 files changed, 70 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadRevisionsIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadRevisionsIndication.java
index 9025188..8dc6756 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadRevisionsIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadRevisionsIndication.java
@@ -300,8 +300,14 @@ public class LoadRevisionsIndication extends CDOReadIndication
Collection<?> c = (Collection<?>)value;
for (Object e : c)
{
- CDOID id = (CDOID)e;
- prefetchRevisionChild(depth, id, additionalRevisions, map);
+ // If this revision was loaded with referenceChunk != UNCHUNKED, then
+ // some elements might be uninitialized, i.e. not instanceof CDOID.
+ // (See bug 339313.)
+ if (e instanceof CDOID)
+ {
+ CDOID id = (CDOID)e;
+ prefetchRevisionChild(depth, id, additionalRevisions, map);
+ }
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
index 7bb53e6..259539e 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
@@ -213,5 +213,6 @@ public abstract class AllConfigs extends ConfigTestSuite
testClasses.add(Bugzilla_338884_Test.class);
testClasses.add(Bugzilla_338779_Test.class);
testClasses.add(Bugzilla_339461_Test.class);
+ testClasses.add(Bugzilla_339313_Test.class);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_339313_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_339313_Test.java
new file mode 100644
index 0000000..106768d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_339313_Test.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Caspar De Groot - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.bugzilla;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+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.model1.Category;
+import org.eclipse.emf.cdo.tests.model1.Model1Factory;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.util.CommitException;
+
+/**
+ * @author Caspar De Groot
+ */
+public class Bugzilla_339313_Test extends AbstractCDOTest
+{
+ public void test() throws CommitException
+ {
+ CDOID topObjectID = null;
+
+ {
+ CDOSession session = openSession();
+ CDOTransaction tx = session.openTransaction();
+ CDOResource resource = tx.createResource(getResourcePath("test"));
+
+ Model1Factory factory = getModel1Factory();
+ Category c = factory.createCategory();
+ c.getCategories().add(factory.createCategory());
+ c.getCategories().add(factory.createCategory());
+ resource.getContents().add(c);
+
+ tx.commit();
+
+ topObjectID = CDOUtil.getCDOObject(c).cdoID();
+ session.close();
+ }
+
+ clearCache(getRepository().getRevisionManager());
+
+ {
+ CDOSession session = openSession();
+ CDOBranch main = session.getBranchManager().getMainBranch();
+ CDORevision rev = session.getRevisionManager().getRevision(topObjectID, main.getHead(), 1, 1, true);
+ msg(rev);
+ session.close();
+ }
+ }
+}