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

Win: FileChooser does not accept valid initial directory.

    XMLWordPrintable

Details

    Description

      In an application which uses a file chooser I want to use the parent directory of a previously
      opened file as the initial directory for the file chooser. I test whether the path is
      valid before I call the setInitialDirectory method of the file chooser but for some
      valid paths this just results in a NPE. The bug should be reproducable with the attached
      program, assuming you have set up a corresponding directory structure.


      Path is valid! Initial directory: '..\JavaFX - Demos\data'

      <Some strange error message here which I was not able to copy/paste in here>

       java.lang.NullPointerException
      at com.sun.glass.ui.CommonDialogs.showFileChooser(CommonDialogs.java:120)
      at com.sun.javafx.tk.quantum.QuantumToolkit.showFileChooser(QuantumToolkit.java:1475)
      at javafx.stage.FileChooser.showDialog(FileChooser.java:285)
      at javafx.stage.FileChooser.showOpenDialog(FileChooser.java:234)
      at pixelops.FileChooserBug$1.handle(FileChooserBug.java:38)
      at pixelops.FileChooserBug$1.handle(FileChooserBug.java:1)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
      at javafx.event.Event.fireEvent(Event.java:171)
      at javafx.scene.control.MenuItem.fire(MenuItem.java:425)
      at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer.doSelect(ContextMenuContent.java:1188)
      at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer$6.handle(ContextMenuContent.java:1139)
      at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer$6.handle(ContextMenuContent.java:1137)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
      at javafx.event.Event.fireEvent(Event.java:171)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3303)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3143)
      at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3098)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1525)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2241)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:227)
      at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
      at com.sun.glass.ui.View.notifyMouse(View.java:921)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
      at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62)
      at java.lang.Thread.run(Unknown Source)
      Exception in thread "JavaFX Application Thread"

      Attachments

        Activity

          People

            pchelko Petr Pchelko (Inactive)
            dpausjfx Dr. Michael Paus (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: