From: Patrick Plitzner
Date: Fri, 3 Aug 2018 07:08:12 +0000 (+0200)
Subject: ref #7614 Fix possible IndexOutOfBoundException
X-Git-Tag: 5.2.0^2~44
X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/4d0daece0c7ddd6478d4d716275f495c0814c4ee?ds=sidebyside
ref #7614 Fix possible IndexOutOfBoundException
---
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4Composite.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4Composite.java
index a053fc50c..06b6db408 100644
--- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4Composite.java
+++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4Composite.java
@@ -341,7 +341,14 @@ public class BulkEditorE4Composite extends Composite {
List selection = new ArrayList<>();
int[] fullySelectedRowPositions = bodyLayer.getSelectionLayer().getFullySelectedRowPositions();
for (int i : fullySelectedRowPositions) {
- Object rowObject = bodyDataProvider.getRowObject(i);
+ /*
+ * 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(rowObject instanceof CdmBase){
selection.add((CdmBase) rowObject);
}