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

java.awt.List class doc

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.2.0
    • docs
    • beta
    • generic
    • generic

      The java.awt.List class' method add(String item, int index) which states:

      "Adds the specified item to the the scrolling list at the position
       indicated by the index. The index is zero-based. If value of the
       index is less than -1 then an ArrayIndexOutOfBoundsException is thrown.
       If value of the index is greater than the number of items in the
       list then the item is added to the end."

      should be saying:

      "Adds the specified item to the the scrolling list at the position
       indicated by the index. The index is zero-based. If value of the
       index is less than 0 or greater than the number of items in the
       list then the item is added to the end."

      Please notice that no exception is thrown by this method.

      ------------------------------------------------------------------------

      The method makeVisible(int index) which states:

      "Makes the item at the specified index visible."

      should add the following line:

      "ArrayIndexOutOfBoundsException is thrown if the index is less
       than 0 or greater than the number of items in the list."

      ------------------------------------------------------------------------

      A similar token also applies to the following methods:

      replaceItem(String newValue, int index)
      makeVisible(int index)

      which also throws ArrayIndexOutOfBoundsException.

            sharonz Sharon Zakhour (Inactive)
            rphamsunw Roger Pham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: