JDK-4682626 : REGRESSION:dialog does not appear when attempting keymap.addActionForKeyStroke
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1
  • Priority: P1
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2002-05-09
  • Updated: 2002-05-09
  • Resolved: 2002-05-09
###@###.### 2002-05-09

J2SE Version (please include all output from java -version flag):
  java version "1.4.1-beta"
  Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b10)
  Java HotSpot(TM) Client VM (build 1.4.1-beta-b10, mixed mode)

Does this problem occur on J2SE 1.4?  Yes / No (pick one)
 No. It works fine with 1.4.1 build04. This regression introdcued
 since build05.

Operating System Configuration Information (be specific):
 Windows 2000 build 2195 SP2

Hardware Configuration Information (be specific):
 Intel pentium III 866 Mhz, 256 MB RAM, 20 Gig HD

Bug Description:
 In 1.3 and 1.4, a simple dialog appears.  Since 1.4.1 build 05,
 you see a stack trace from a null pointer exception.

 1.4.1 build05:
  H:\CAP\bug\mapinfo>k:\b05\binaries\win\bin\java KeyMapBugIn141beta6
  About to attempt keymap.addActionForKeyStroke.....
  Exception in thread "main" java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:386)
        at javax.swing.text.JTextComponent$DefaultKeymap.addActionForKeyStroke(J
        at KeyMapBugIn141beta6.<init>(KeyMapBugIn141beta6.java:70)
        at KeyMapBugIn141beta6.main(KeyMapBugIn141beta6.java:86)

 1.4.1 build04:
  H:\CAP\bug\mapinfo>k:\b04\binaries\win\bin\java KeyMapBugIn141beta6
  About to attempt keymap.addActionForKeyStroke.....
  Successfully attempted keymap.addActionForKeyStroke.

 And the simple dialog appears.

Steps to Reproduce (be specific): 

  Run Attached program(KeyMapBugIn141beta6.java) in shipping 1.4 and 1.4.1 b10.

EVALUATION AWT did not putback into build 5 of hopper, but swing did. ###@###.### 2002-05-09 This is happening because of the fix for 4518346. In an attempt to make keybindings more understandable, especially in so far as what the UI is responsible for installing and uninstalling, Swing added the notion of the InputMap and ActionMap. This allowed for a richer way of registering bindings than that of the Keymap classes defined in the text package. Because the text components now use the InputMap/ActionMap it is unnecessary for them to use Keymaps. Additionally using Keymaps and Actionmap/InputMap at the same time is wasteful and unnecessarily costly. To this end we removed the keyBindings that the UIs were created for the Keymap. While this change has negatively effected this app, and we apologize for this, we never speced the contents of the Keymap so that to rely on a certain binding always existing is incorrect. This code should be testing for a valid Action before placing it into the ActionMap. ###@###.### 2002-05-09