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

REGRESSION: getCanonicalPath broken when running with -classic on WinXP

XMLWordPrintable

    • 09
    • x86
    • windows_2000, windows_xp
    • Verified



      Name: nt126004 Date: 03/21/2003


      FULL PRODUCT VERSION :
      Tests 595>java -version
      java version "1.3.1_07"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_07-b02)
      Java HotSpot(TM) Client VM (build 1.3.1_07-b02, mixed mode)

      FULL OS VERSION :
      17:18:30.72>ver
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      When running with the -classic argument, File.getCanonicalPath is returning a different and invalid result as compared to running without -classic.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run the tstPath2.java with and without the -classic
      argument.

      Run without -classic:
      Tests 593>java tstPath2
      tstPath2.class path: /C:/usr/local/Java/Tests/
      ../../CanonicalPath: C:\usr\local

      Run with -classic:
      Tests 594>java -classic tstPath2
      tstPath2.class path: /C:/usr/local/Java/Tests/
      ../../CanonicalPath: C:\usr\local\Java\Tests


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      In both cases the ../../CanonicalPath: output should be C:\usr\local

      When running with -classic the ../../CanonicalPath: is the original path
      value used to create the ../../ file.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.File;

      class tstPath2
      {
         public static void main(String[] args) throws Exception
         {
            String path tstPath2.class.getProtectionDomain().getCodeSource().getLocation().getFile();
            System.out.println("tstPath2.class path: "+path);
            File dir = new File(path).getParentFile().getParentFile();
            String cdir = dir.getCanonicalPath();
            System.out.println("../../CanonicalPath: "+cdir);
         }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Don't use -classic

      Release Regression From : 1.3.1_06
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Review ID: 182857)
      ======================================================================

            sundar Sundararajan Athijegannathan
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: