summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaspar De Groot2011-02-03 05:28:19 (EST)
committerCaspar De Groot2011-02-03 05:28:19 (EST)
commite4be8aa572fcab52b8e6e471411870d175b81503 (patch)
tree6306b1208803d5c370df9ee412a81c0ac47ce52e
parenta2562b8ee8589e0b1add8f1390ff10478d6c2277 (diff)
downloadcdo-e4be8aa572fcab52b8e6e471411870d175b81503.zip
cdo-e4be8aa572fcab52b8e6e471411870d175b81503.tar.gz
cdo-e4be8aa572fcab52b8e6e471411870d175b81503.tar.bz2
[335815] RemoveCrossReferences throws IllegalArgumentException for non-persistent features
https://bugs.eclipse.org/bugs/show_bug.cgi?id=335815
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java13
2 files changed, 13 insertions, 11 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java
index 8995c32..9f7d5b6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java
@@ -79,15 +79,8 @@ public class CDOClassInfoImpl extends AdapterImpl implements CDOClassInfo
public int getFeatureIndex(EStructuralFeature feature)
{
- try
- {
- int featureID = getEClass().getFeatureID(feature);
- return getFeatureIndex(featureID);
- }
- catch (ArrayIndexOutOfBoundsException ex)
- {
- throw new IllegalStateException("Feature not mapped: " + feature, ex); //$NON-NLS-1$
- }
+ int featureID = getEClass().getFeatureID(feature);
+ return getFeatureIndex(featureID);
}
public int getFeatureIndex(int featureID)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
index 3dfba47..f403539 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
@@ -2082,11 +2082,20 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
{
EReference reference = (EReference)it.feature();
+ // Don't touch derived references -- user app might not like this.
+ // And don't touch unchangeable references either.
+ if (reference.isDerived() || !reference.isChangeable())
+ {
+ continue;
+ }
+
// In the case of DIRTY, we must investigate further: Is the referencer dirty
// because a reference to the referencedObject was added? Only in this case
// should we remove it. If this is not the case (i.e. it is dirty in a different
- // way, we must ignore it.)
- if (referencer.cdoState() == CDOState.DIRTY)
+ // way), we skip it. (If the reference is not persistent, then this exception
+ // doesn't apply: it must be removed for sure.)
+ //
+ if (referencer.cdoState() == CDOState.DIRTY && EMFUtil.isPersistent(reference))
{
InternalCDORevision cleanRevision = getSession().getRevisionManager().getRevisionByVersion(
referencer.cdoID(), referencer.cdoRevision(), CDORevision.UNCHUNKED, true);