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

javax.swing.JTable.isColumnSelected() does not throw IAE

XMLWordPrintable



      Name: ooR10001 Date: 06/04/2001


      javax.swing.JTable.isColumnSelected(int column) does not throw
      IllegalArgumentException when column is not in the valid range. It
      contradicts with current javadoc which says:

      -----------------
      isColumnSelected

      public boolean isColumnSelected(int column)

      ...........................
        Throws:
              IllegalArgumentException - if column is not in the valid range
      -----------------

      Following test shows the bug:
      --------------- test.java --------------------
      import javax.swing.JTable;
      import javax.swing.table.DefaultTableModel;

      public class test {

        public static void main(String[] args) {
            JTable c = new JTable(new DefaultTableModel(1, 1));
            try {
                c.isColumnSelected(-1);
                System.out.println("Exception is not thrown");
            } catch (IllegalArgumentException iae) {
            }
        }

      }
      ----------------------------------------------

      Output:
      ------------------------------
      % java -version

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

      % java test

      Exception is not thrown

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

      ======================================================================

            shickeysunw Shannon Hickey (Inactive)
            oovsunw Oov Oov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: