| Summary: | RemoveCrossReferences throws IllegalArgumentException for non-persistent features | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Caspar D. <caspar_d> | ||||
| Component: | cdo.core | Assignee: | Caspar D. <caspar_d> | ||||
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | saulius.tvarijonas | ||||
| Version: | 4.0 | Flags: | stepper:
review+
|
||||
| Target Milestone: | --- | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Caspar D.
While debugging this I realized that the catch {ArrayIndexOutOfBoundsEx}
clause in CDOClassInfoImpl.getFeatureIndex(EStructuralFeature) is now
unnecessary: the featureIDmappings array contains an entry for every
feature. Will patch this here as well.
### Eclipse Workspace Patch 1.0
#P org.eclipse.emf.cdo
Index: src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
===================================================================
--- src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java (revision 6984)
+++ src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java (working copy)
@@ -2085,8 +2085,10 @@
// 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);
#P org.eclipse.emf.cdo.common
Index: src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java
===================================================================
--- src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java (revision 6984)
+++ src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java (working copy)
@@ -79,15 +79,8 @@
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)
More trouble.. removeCrossReferences shouldn't touch derived features, but it does. Updated patch forthcoming. Created attachment 188118 [details]
Patch v2
Committed to trunk, rev. 7011 Available in R20110608-1407 |