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

JTable.editCellAt() methods does not throw IllegalArgumentException

    XMLWordPrintable

    Details

      Description



      Name: ooR10001 Date: 05/30/2001


      javax.swing.JTable.editCellAt(int, int) and javax.swing.JTable.editCellAt(int,
      int, EventObject) methods should throw IllegalArgumentException when first two
      parameters are not in valid range but in fact no exception thrown.

      Javadoc says:

      -------------
      editCellAt

      public boolean editCellAt(int row,
                                int column)

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

      .........
      editCellAt

      public boolean editCellAt(int row,
                                int column,
                                EventObject e)

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

      This test shows a 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();
            c.setModel(new DefaultTableModel(2, 2));
            c.editCellAt(-1, 3);
            c.editCellAt(0, 10, new java.util.EventObject(c));
            System.out.println("No exception thrown");
        }

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

      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

      No exception thrown

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

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: