Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2012-04-29 09:02:21 -0400
committerStefan Winkler2012-04-29 09:02:21 -0400
commit7698f3a56562e5e538ce5584e427ada9390b9e87 (patch)
treee901821bea1810d791850e910fc29ecc6a5f95c2
parentd58f2f8c74651fd147568141314eb4df614e60fa (diff)
downloadcdo-bugs/369646.tar.gz
cdo-bugs/369646.tar.xz
cdo-bugs/369646.zip
[369646] [DB] ClassCastException after setBranch when server cachebugs/369646
contains partially loaded collections https://bugs.eclipse.org/bugs/show_bug.cgi?id=369646 Proposed fix for bug: ensure that both revisions are fully loaded, before doing the compare. (makes branch switching slower, but handles PCL correctly)
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java
index dfe36a9158..55ad08cb15 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.common.CDOCommonView;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
@@ -27,6 +28,8 @@ import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.lifecycle.Lifecycle;
import org.eclipse.net4j.util.options.IOptionsContainer;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.text.MessageFormat;
import java.util.HashSet;
import java.util.Iterator;
@@ -141,12 +144,31 @@ public class View extends Lifecycle implements InternalView, CDOCommonView.Optio
}
else if (newRevision != oldRevision)
{
+ // Fix for Bugzilla 369646: ensure that revisions are fully loaded
+ ensureRevisionChunks((InternalCDORevision)newRevision);
+ ensureRevisionChunks((InternalCDORevision)oldRevision);
+
CDORevisionDelta delta = newRevision.compare(oldRevision);
allChangedObjects.add(delta);
}
}
}
+ // TODO: Eike can this be put in the Repository class?
+ /**
+ * Make sure that all lists of the given revision are fully loaded.
+ */
+ private void ensureRevisionChunks(InternalCDORevision revision)
+ {
+ for (EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(revision.getEClass()))
+ {
+ if (feature.isMany())
+ {
+ getRepository().ensureChunk(revision, feature, 0, revision.getList(feature).size());
+ }
+ }
+ }
+
private List<CDORevision> getRevisions(List<CDOID> ids)
{
return repository.getRevisionManager().getRevisions(ids, branchPoint, CDORevision.UNCHUNKED,

Back to the top