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

Path.relativize incorect if this path contains '.'

XMLWordPrintable

    • x86_64
    • windows_7

      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


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

              Created:
              Updated:
              Resolved: