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

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

XMLWordPrintable



      Name: ooR10001 Date: 06/04/2001


      javax.swing.JTable.isSelected(int row, int column) does not throw
      IllegalArgumentException when row or column are not in the valid range. It
      contradicts with current javadoc which says:

      -----------------
      isCellSelected

      public boolean isCellSelected(int row,
                                    int column)

      ...........................
        Throws:
              IllegalArgumentException - if row or column are 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.isCellSelected(-1, 0);
                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: