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

Path.relativize incorect if this path contains '.'

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      A DESCRIPTION OF THE PROBLEM :
      I think it is very similar to https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6925169.
      Yet, 6925169 is marked as resolved where the bug still remains, hence a new bug report.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      On a linux machine:
      Path a = Paths.get("./a")
      Path b = Paths.get("b")
      a.relativize(b)



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      should something be along the lone of ../b or .././b


      ACTUAL -
      is ../../b which is wrong, would definitely not point to the same file if we would call

      a.normalize().resolve(b.normalize())
      assuming a and b are in folder /c/d then the above would result in /c/b instead of /c/d/b

      ---------- BEGIN SOURCE ----------
      You can take it from above
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      call normalize() before calling relativize()
      a.normalize().relativize(b) => ../b

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psonal Pallavi Sonal (Inactive)
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: