JDK-4511992 : EventHandler will throw ArrayIndexOutOfBoundsException in can't find method
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 1.4.0
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_7
  • CPU: sparc
  • Submitted: 2001-10-08
  • Updated: 2004-12-14
  • Resolved: 2004-12-14
Related Reports
Duplicate :  
Description
If the EventHandler can't find a method with the specified name passed, and you don't pass in a property name, you'll get an ArrayIndexOfBoundsException instead of an error indicating the method couldn't be found:

import javax.swing.event.*;
import javax.swing.*;
import java.beans.*;

public class Test {
    public static void main(String argv[]) {
        new Test();
    }

    public Test() {
        JTree tree = new JTree();
        tree.addTreeSelectionListener((TreeSelectionListener)EventHandler.
             create(TreeSelectionListener.class, this, "selectionChanged"));
        tree.setSelectionRow(0);
    }
}

Comments
EVALUATION This is being fixed as part of 6204552, closing as such. ###@###.### 2004-12-14 20:06:38 GMT
14-12-2004