From 1ca63f05f0ce6ae5673ce7b53c7e20b61019ebb7 Mon Sep 17 00:00:00 2001 From: Esteban Dugueperoux Date: Wed, 3 Sep 2014 14:32:52 +0200 Subject: [435532] Reordering elements in a containment feature causes DBException when audit mode is activated https://bugs.eclipse.org/bugs/show_bug.cgi?id=435532 - enhance a little ListDeltaVisitor.applyOffsetToSource/DestinationIndexes() Change-Id: I93a560200e48035bc96f00bd5dd47cb8cb6b42cb Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=435532--- .../mapping/horizontal/NonAuditListTableMapping.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditListTableMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditListTableMapping.java index ae911bda37..1badb55f3d 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditListTableMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/NonAuditListTableMapping.java @@ -711,23 +711,29 @@ public class NonAuditListTableMapping extends AbstractListTableMapping implement private void applyOffsetToSourceIndexes(int offsetBefore) { - for (ManipulationElement element : manipulations) + if (offsetBefore != 0) { - if (element.sourceIndex != ManipulationConstants.NO_INDEX) + for (ManipulationElement element : manipulations) { - element.sourceIndex += offsetBefore; + if (element.sourceIndex != ManipulationConstants.NO_INDEX) + { + element.sourceIndex += offsetBefore; + } } } } private void applyOffsetToDestinationIndexes(int offsetAfter) { - for (ManipulationElement element : manipulations) + if (offsetAfter != 0) { - if (element.destinationIndex != ManipulationConstants.NO_INDEX) + for (ManipulationElement element : manipulations) { - // apply the offset to all indices to make them relative to the new offset - element.destinationIndex += offsetAfter; + if (element.destinationIndex != ManipulationConstants.NO_INDEX) + { + // apply the offset to all indices to make them relative to the new offset + element.destinationIndex += offsetAfter; + } } } } -- cgit v1.2.3