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

NullPointerException after creating a directory in JFileChooser

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.6.0_01"
      Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
      Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      If you create a new directory from with the JFileChooser you can get a NullPointerException by navigating into that directory with the keyboard and then clicking the "Open" button with the mouse.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      On Microsoft Windows.
      Run SwingSet2.
      Set the Look and Feel to Windows.
      Click the fifth tab that offers dialogs.
      Click the "Show Plain JFileChooser" button.
      Navigate to a directory in which the "New Folder" button is enabled.
      Click the "New Folder" button.
      Now, without touching the mouse, type the name of the new folder. Hit Enter to confirm the name, then hit Enter again to go into the newly created folder.
      Click the "Open" button.
      Note exception.





      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No exception -- Open button should be a no-op as it is when there is no selection.
      ACTUAL -
      Exception.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception occurred during event dispatching:
      java.lang.NullPointerException
              at javax.swing.JComponent.repaint(Unknown Source)
              at sun.swing.FilePane$2.repaintListSelection(Unknown Source)
              at sun.swing.FilePane$2.repaintSelection(Unknown Source)
              at sun.swing.FilePane$2.focusLost(Unknown Source)
              at java.awt.AWTEventMulticaster.focusLost(Unknown Source)
              at java.awt.Component.processFocusEvent(Unknown Source)
              at java.awt.Component.processEvent(Unknown Source)
              at java.awt.Container.processEvent(Unknown Source)
              at java.awt.Component.dispatchEventImpl(Unknown Source)
              at java.awt.Container.dispatchEventImpl(Unknown Source)
              at java.awt.Component.dispatchEvent(Unknown Source)
              at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
              at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Sour
      ce)
              at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
              at java.awt.Component.dispatchEventImpl(Unknown Source)
              at java.awt.Container.dispatchEventImpl(Unknown Source)
              at java.awt.Component.dispatchEvent(Unknown Source)
              at java.awt.EventQueue.dispatchEvent(Unknown Source)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
              at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
              at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
              at java.awt.Dialog$1.run(Unknown Source)
              at java.awt.Dialog$3.run(Unknown Source)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.awt.Dialog.show(Unknown Source)
              at javax.swing.JFileChooser.showDialog(Unknown Source)
              at javax.swing.JFileChooser.showOpenDialog(Unknown Source)
              at FileChooserDemo$2.actionPerformed(FileChooserDemo.java:160)
              at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
              at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
              at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
              at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
              at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
      ce)
              at java.awt.Component.processMouseEvent(Unknown Source)
              at javax.swing.JComponent.processMouseEvent(Unknown Source)
              at java.awt.Component.processEvent(Unknown Source)
              at java.awt.Container.processEvent(Unknown Source)
              at java.awt.Component.dispatchEventImpl(Unknown Source)
              at java.awt.Container.dispatchEventImpl(Unknown Source)
              at java.awt.Component.dispatchEvent(Unknown Source)
              at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
              at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
              at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
              at java.awt.Container.dispatchEventImpl(Unknown Source)
              at java.awt.Window.dispatchEventImpl(Unknown Source)
              at java.awt.Component.dispatchEvent(Unknown Source)
              at java.awt.EventQueue.dispatchEvent(Unknown Source)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
              at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
              at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
              at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
              at java.awt.EventDispatchThread.run(Unknown Source)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      n/a. Use SwingSet2.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use AWT FileDialog.

      Release Regression From : 5.0u12
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            rupashka Pavel Porvatov (Inactive)
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: