Uploaded image for project: 'Pivot'
  1. Pivot
  2. PIVOT-515

org.apache.pivot.collections.ArrayList bounds checking issue

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.5.1
    • Component/s: core-collections
    • Environment:
      Java(TM) SE Runtime Environment (build 1.6.0_19-b04) MS Windows XP x64 SP2

      Description

      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);
      }

        Attachments

        1. ListTest.zip
          2 kB
          Christopher James Bartlett

          Activity

            People

            • Assignee:
              grandinj Noel Grandin
              Reporter:
              cbartlett Christopher James Bartlett
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: