Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2011-09-28 04:08:09 +0000
committerPawel Piech2011-09-28 04:08:09 +0000
commit2ef2c06e33b8053d996be7955a3bfb0623baac34 (patch)
treeede2dac95f9b8213ec8b285820d0000c5cede274
parent472eea319d490fe2300465bfcde19fce457b9724 (diff)
downloadeclipse.platform.debug-20110928-0408.tar.gz
eclipse.platform.debug-20110928-0408.tar.xz
eclipse.platform.debug-20110928-0408.zip
[flex-hierarchy] AIOB exception while using viewer with filtersv20110928-0408
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java4
2 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java
index 67b65d111..296ca6e8b 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java
@@ -133,4 +133,20 @@ public class FilterTransformTests extends TestCase {
boolean added = transform.addFilteredIndex(TreePath.EMPTY, 0, element0);
assertFalse("Filter should not be added - should already have been there", added);
}
+
+
+ /**
+ * Test to make sure that setModelChildCount() updates internal arrays appropriately.
+ * See bug 200325.
+ */
+ public void testRegression200325() {
+ transform.setModelChildCount(TreePath.EMPTY, 2);
+ try {
+ transform.addFilteredIndex(TreePath.EMPTY, 3, new Object());
+ } catch (ArrayIndexOutOfBoundsException e) {
+ fail("AIOOBE Exception should not be thrown here, " +
+ "setModelChildCount should leave " +
+ "FilterTransform$Node in a consistent state");
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java
index 28abfc69d..547a7ea5c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java
@@ -261,11 +261,15 @@ public class FilterTransform {
// trim
if (i == 0) {
filteredIndexes = null;
+ filteredElements = null;
return;
} else {
int[] temp = new int[i + 1];
System.arraycopy(filteredIndexes, 0, temp, 0, temp.length);
filteredIndexes = temp;
+ Object[] temp2 = new Object[i + 1];
+ System.arraycopy(filteredElements, 0, temp2, 0, temp2.length);
+ filteredElements = temp2;
}
}
}

Back to the top