ref #7614 Catch negative index when getting the row object
authorPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 3 Aug 2018 08:40:29 +0000 (10:40 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 3 Aug 2018 08:40:29 +0000 (10:40 +0200)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorConfigLabelAccumulator.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4Composite.java

index 5a5cdb3755d103a10dee35b351dd3531f060ce10..13a0a4ba751f1cab240bd7f9e9359401fec35ccd 100644 (file)
@@ -37,7 +37,10 @@ public class BulkEditorConfigLabelAccumulator implements IConfigLabelAccumulator
 
     @Override
     public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
-        CdmBase rowObject = dataProvider.getRowObject(natTable.getRowIndexByPosition(rowPosition));
+        if(rowPosition<0){
+            return;
+        }
+        CdmBase rowObject = dataProvider.getRowObject(rowPosition);
         if(input.getMergeCandidates().contains(rowObject)){
             configLabels.addLabel(BulkEditorE4Composite.CANDIDATE_LABEL);
         }
index 658be7326ff80456b66d41a5765c42c52904fe87..4b1824e4d073fe3c6b01f5bc4c47e32a1f57799c 100644 (file)
@@ -341,14 +341,10 @@ public class BulkEditorE4Composite extends Composite {
         List<CdmBase> selection = new ArrayList<>();
         int[] fullySelectedRowPositions = bodyLayer.getSelectionLayer().getFullySelectedRowPositions();
         for (int i : fullySelectedRowPositions) {
-            /*
-             * Differentiation between "index" and "position" is important here
-             * "position" is the current visible index "index" refers to the
-             * underlying data model deleting an entity could lead to an
-             * IndexOutOfBoundExceptions if the position is used
-             */
-            int rowIndexByPosition = natTable.getRowIndexByPosition(i);
-            Object rowObject = bodyDataProvider.getRowObject(rowIndexByPosition);
+            if(i<0){
+                continue;
+            }
+            Object rowObject = bodyDataProvider.getRowObject(i);
             if(rowObject instanceof CdmBase){
                 selection.add((CdmBase) rowObject);
             }