diff options
author | Caspar De Groot | 2010-05-27 09:54:59 +0000 |
---|---|---|
committer | Caspar De Groot | 2010-05-27 09:54:59 +0000 |
commit | 82aae069ef85a9cd9f4bce1a4630a683ce249abe (patch) | |
tree | a4dfeca47bd7cb849dd5b0e2c4c6955476ae78d2 /plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal | |
parent | 1f77f45c4a5a68bdd7566e3a6dd950595431a4b0 (diff) | |
download | cdo-82aae069ef85a9cd9f4bce1a4630a683ce249abe.tar.gz cdo-82aae069ef85a9cd9f4bce1a4630a683ce249abe.tar.xz cdo-82aae069ef85a9cd9f4bce1a4630a683ce249abe.zip |
[314387] Failed writes on CDOObjects leave bad featureDeltas in transaction
https://bugs.eclipse.org/bugs/show_bug.cgi?id=314387
Diffstat (limited to 'plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal')
-rw-r--r-- | plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java index 8c75319100..e9fe8b4faf 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java @@ -41,7 +41,6 @@ import org.eclipse.emf.internal.cdo.util.FSMUtil; import org.eclipse.net4j.util.ObjectUtil; import org.eclipse.net4j.util.om.trace.ContextTracer; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; @@ -400,17 +399,24 @@ public final class CDOStore implements EStore public Object remove(InternalEObject eObject, EStructuralFeature feature, int index) { - if (FSMUtil.isNative(eObject)) - { - checkIndexOutOfBounds(eObject, feature, index); // Bugzilla 293283 - } - InternalCDOObject cdoObject = getCDOObject(eObject); if (TRACER.isEnabled()) { TRACER.format("remove({0}, {1}, {2})", cdoObject, feature, index); //$NON-NLS-1$ } + // Bugzilla 293283 / 314387 + if (feature.isMany()) + { + InternalCDORevision readLockedRevision = getRevisionForReading(cdoObject); + CDOList list = readLockedRevision.getList(feature); + int size = list.size(); + if (index < 0 || size <= index) + { + throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size); + } + } + CDOFeatureDelta delta = new CDORemoveFeatureDeltaImpl(feature, index); InternalCDORevision revision = getRevisionForWriting(cdoObject, delta); @@ -573,20 +579,6 @@ public final class CDOStore implements EStore return value; } - private void checkIndexOutOfBounds(InternalEObject eObject, EStructuralFeature feature, int index) - { - // Bugzilla 293283 - if (feature.isMany()) - { - Object o = eObject.eGet(feature); - int size = ((EList<?>)o).size(); - if (index >= size) - { - throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size); - } - } - } - private Object convertIdToObject(InternalCDOView view, EObject eObject, EStructuralFeature feature, int index, Object value) { |