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

Keystroke.getKeyStroke(String) can throw uncaught runtime exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0
    • client-libs
    • None
    • merlin
    • generic
    • generic

      If KeyStroke.getKeyStroke(String) is passed an empty string, a NoSuchElementException will be thrown by StringTokenizer.nextToken(). The getKeyStroke method wrongly assumes that null will be returned if there aren't any tokens.

      Here's the test case:

         import javax.swing.KeyStroke;

         public class KeyStrokeTest {
              public static void main(String[] args) {
                  KeyStroke ks = KeyStroke.getKeyStroke("");
              }
         }

            svioletsunw Scott Violet (Inactive)
            tballsunw Tom Ball (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: