org.apache.pivot.collections.ArrayList bounds checking issue
------------------------------------------------------------
Key: PIVOT-515
URL: https://issues.apache.org/jira/browse/PIVOT-515
Project: Pivot
Issue Type: Bug
Components: core-collections
Affects Versions: 1.5
Environment: Java(TM) SE Runtime Environment (build 1.6.0_19-b04) MS
Windows XP x64 SP2
Reporter: Chris Bartlett
Priority: Minor
Fix For: 1.5, 1.6
Bounds checking on ArrayList fails under certain circumstances.
Appears to happen when add() and/or insert() methods of ArrayList are used, and
not when data is passed to a constructor
jUnit test demonstrating the issue will be attached in a follow up post.
public void simpleTest() {
org.apache.pivot.collections.List<String> pivot1 = new
org.apache.pivot.collections.ArrayList<String>("A", "B", "C");
// Throws java.lang.IndexOutOfBoundsException
pivot1.get(3);
org.apache.pivot.collections.List<String> pivot2 = new
org.apache.pivot.collections.ArrayList<String>();
// Returns null
System.out.println(pivot2.get(0));
pivot2.add("A");
pivot2.add("B");
pivot2.add("C");
// Returns null
System.out.println(pivot2.get(3));
java.util.List<String> java = new java.util.ArrayList<String>();
// Throws java.lang.IndexOutOfBoundsException
java.get(0);
java.add("A");
java.add("B");
java.add("C");
// Throws java.lang.IndexOutOfBoundsException
java.get(3);
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.