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

java.io.File inconsistent when user.dir set on command line

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • None
    • core-libs

      When user.dir is set and a relative folder is created, then io and nio are not in sync on whether the folder exists.
      It seems like, the folder is created in “true” user-dir of the process.
      Interestingly, io reports that the folder is created - even so, it refers to another place.
      I’ve added a test program.

      Output without VM params
      ```
      file fileB: ./5726845098406957292
      io absolute: /Users/floriankirmaier/projects/workspace/HelloJPro/./5726845098406957292
      nio absolute: /Users/floriankirmaier/projects/workspace/HelloJPro/./5726845098406957292
      io exists: true
      nio exists: true
      ```


      Output with -Duser.dir=<dir>
      ```
      file fileB: ./5717405834156993512
      io absolute: /Users/floriankirmaier/projects/workspace/test/./5717405834156993512
      nio absolute: /Users/floriankirmaier/projects/workspace/test/./5717405834156993512
      io exists: true
      nio exists: false
      ```

      Tested on Mac and Windows

            bpb Brian Burkhalter
            fkirmaier Florian Kirmaier
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: