Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-3 Support JDK 9 on Geode
  3. GEODE-5892

File's absolute path does not change after user.dir is changed in jdk11

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      File relativeFile1 = new File("abc.txt");
      System.setProperty("user.dir", "/somewhereElse");
      File relativeFile2 = new File("abc.txt");
      System.out.println(relativeFile1.getAbsolutePath());
      System.out.println(relativeFile2.getAbsolutePath());
      

      pre jdk11, the code above will print out "/somewhereElse/abc.txt" in both lines, even though the relativeFile objects still point to the files under the old user.dir. But in jdk11, the above code will print out "old user.dir/abc.txt" in both lines.

      dynamically change user.dir would not affect the relative file's absolute path anymore.

      Attachments

        Issue Links

          Activity

            People

              jinmeiliao Jinmei Liao
              jinmeiliao Jinmei Liao
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 50m
                  1h 50m