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

NPE thrown when overriding setUI method of JFileChooser

XMLWordPrintable

      NPE thrown when overriding NewFolderAction inner class of MetalFileChooserUI.
      Steps to reproduce:
      -------------------
      1) Compile and run the attahced code.
      2) This will open JFileChooser.
      3) Click "New Folder Button", it will give the following exception :

      Exception occurred during event dispatching:
      java.lang.NullPointerException
              at javax.swing.plaf.metal.MetalFileChooserUI$FileRenderer.getListCellRen
      dererComponent(MetalFileChooserUI.java:1137)
              at javax.swing.plaf.basic.BasicListUI.paintCell(BasicListUI.java:126)
              at javax.swing.plaf.basic.BasicListUI.paint(BasicListUI.java:215)
              at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
              at javax.swing.JComponent.paintComponent(JComponent.java:541)
              at javax.swing.JComponent.paint(JComponent.java:808)
              at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4795)

              at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4748)
              at javax.swing.JComponent._paintImmediately(JComponent.java:4692)
              at javax.swing.JComponent.paintImmediately(JComponent.java:4495)
              at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)

              at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(System
      EventQueueUtilities.java:117)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
              at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
      read.java:201)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
      ad.java:151)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
      ad.java:141)
              at java.awt.Dialog$1.run(Dialog.java:540)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
              at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
      read.java:201)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
      ad.java:151)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)

              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)

              at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

            Unassigned Unassigned
            mjoshisunw Mayank Joshi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: