Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4405112

Documentation for javax.swing.DefaultListModel.add(int, Object) is incorrect.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0
    • docs
    • beta
    • generic
    • generic



      Name: boT120536 Date: 01/16/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      The api documentation for javax.swing.DefaultListModel.add( int, Object )
        states that an ArrayIndexOutOfBoundsException is thrown under the conditions:
      index < 0 || index >= size(). In the sourcecode however
      javax.swing.DefaultListModel is backed by an instance of java.util.Vector and
      no additional bounds checking is performed until
      java.util.Vector.insertElementAt( Object, int ) is called and in this method
      index < 0 || index > elementCount + 1 is checked which would be equivalent to
      index < 0 || index > size() in java.swing.DefaultListModel.
      (Review ID: 114281)
      ======================================================================

            sharonz Sharon Zakhour (Inactive)
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: