JDK-4464167 : JTable.editCellAt() methods does not throw IllegalArgumentException
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.6
  • CPU: sparc
  • Submitted: 2001-05-30
  • Updated: 2004-03-29
  • Resolved: 2003-06-24
Related Reports
Duplicate :  
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

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

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

Comments
EVALUATION Consolidated with three other bugs in 4883196. ###@###.### 2003-06-24
24-06-2003