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

DefaultListSelectionModel.removeIndexInterval(0, Integer.MAX_VALUE) fails

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 21
    • client-libs
    • None
    • behavioral
    • low
    • For the most part, existing behaviour is being specified although there are some cases where IIOBE would not have been thrown but now are, but these are not likely to affect any real world use case.
    • Java API
    • SE

    Description

      Summary

      Update the specifications of Swing's DefaultListSelectionModel class insertIndexInterval and removeIndexInterval methods to document that they throw IndexOutOfBoundsException when input parameters index or length are negative.

      Problem

      The insertIndexInterval and removeIndexInterval methods of the DefaultListSelectionModel class throw IndexOutOfBoundsException when their input parameters index or length are negative. However this is not specified.

      Solution

      Update the spec to document IndexOutOfBoundsException is thrown when input parameters index or length are negative.

      Specification

      javax.swing.DefaultListSelectionModel

            * at index is itself selected and the selection mode is not
            * SINGLE_SELECTION, set all of the newly inserted items as selected.
            * Otherwise leave them unselected. This method is typically
            * called to sync the selection model with a corresponding change
            * in the data model.
      +     *
      +     * @throws IndexOutOfBoundsException if either {@code index}
      +     *          or {@code length} is negative
            */
           public void insertIndexInterval(int index, int length, boolean before)
      
             * Remove the indices in the interval index0,index1 (inclusive) from
            * the selection model.  This is typically called to sync the selection
            * model width a corresponding change in the data model.  Note
            * that (as always) index0 need not be <= index1.
      +     *
      +     * @throws IndexOutOfBoundsException if either index is negative
            */
           public void removeIndexInterval(int index0, int index1)

      Attachments

        Issue Links

          Activity

            People

              psadhukhan Prasanta Sadhukhan
              gmanwanisunw Girish Manwani (Inactive)
              Alexey Ivanov, Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: