Menu

Bug: java.nio.file.InvalidPathException when LAST_WORK_DIR contains Windows-style path

Anonymous
2020-08-20
2020-08-22
  • Anonymous

    Anonymous - 2020-08-20

    When I first launch the application everything and edit a GPX file opened at C:\Users\rkohanyi\Downloads everything is fine.
    After the app is closed JGPSTrackEdit.properties is updated with something like this LAST_WORK_DIR=C:\Users\rkohanyi\Downloads
    On next start this error happens

    C:\Users\rkohanyi\Apps\JGPSTrackEdit>java -jar JGPSTrackEdit-1.7.0-RC4.jar
    kohanyiDownloadsUsersAWT-EventQueue-0" java.nio.file.InvalidPathException: Illegal char <
            at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
            at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
            at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
            at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
            at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
            at java.base/java.io.File.toPath(File.java:2290)
            at jgpstrackedit.control.UIController.getWorkDir(UIController.java:919)
            at jgpstrackedit.control.UIController.<init>(UIController.java:77)
            at jgpstrackedit.view.JGPSTrackEdit.initGPSViews(JGPSTrackEdit.java:233)
            at jgpstrackedit.view.JGPSTrackEdit.<init>(JGPSTrackEdit.java:199)
            at jgpstrackedit.view.JGPSTrackEdit.<init>(JGPSTrackEdit.java:68)
            at jgpstrackedit.view.JGPSTrackEdit$129.run(JGPSTrackEdit.java:2238)
            at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
            at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
            at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
            at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
            at java.base/java.security.AccessController.doPrivileged(Native Method)
            at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
            at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
            at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
            at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
            at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
            at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
            at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
            at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
    

    My guess this relates to this feature in RC4: "Save last work dir in configuration"
    Should be easily fixable, but it's highly annoying.

     
  • Kohányi Róbert

    I'm OP, subscribing to thread.

     
  • gerdba

    gerdba - 2020-08-20

    There are two problems in the code:
    1) The properties file is saved using the code page of the operating system. Better here is to use UTF-8 for writing and reading the file.
    2) The windows backslash must be escaped by backslash. Otherwise the file path is misinterpreted.

    Sorry for that. I do the development by using a Linux machine. And mostly I do all tests there. An update will comming in the next days.

     
  • Kohányi Róbert

    Thanks for the response and your effort!

     
  • Anonymous

    Anonymous - 2020-08-22

    Please try next release JGPSTrackEdit-1.7.0-RC5.jar.

     
  • Kohányi Róbert

    Thanks, but I got the same problem.

    C:\Users\rkohanyi\Apps\JGPSTrackEdit>java -jar JGPSTrackEdit-1.7.0-RC5.jar
    kohanyidex 7: C:UsersAWT-EventQueue-0" java.nio.file.InvalidPathException: Illegal char <
    at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
    at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
    at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
    at java.base/java.io.File.toPath(File.java:2290)
    at jgpstrackedit.config.Configuration.getLastWorkDir(Configuration.java:113)
    at jgpstrackedit.config.Configuration.getProperty(Configuration.java:126)
    at jgpstrackedit.control.UIController.getWorkDir(UIController.java:917)
    at jgpstrackedit.control.UIController.<init>(UIController.java:77)
    at jgpstrackedit.view.JGPSTrackEdit.initGPSViews(JGPSTrackEdit.java:233)
    at jgpstrackedit.view.JGPSTrackEdit.<init>(JGPSTrackEdit.java:199)
    at jgpstrackedit.view.JGPSTrackEdit.<init>(JGPSTrackEdit.java:68)
    at jgpstrackedit.view.JGPSTrackEdit$129.run(JGPSTrackEdit.java:2238)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)</init></init></init>

     
  • gerdba

    gerdba - 2020-08-22

    Please try next release JGPSTrackEdit-1.7.0-RC6.jar.

     
  • Kohányi Róbert

    Thanks, it works now. Best to use forward slashes all the way :)

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB