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

File.exists() fails with relative paths after user.dir is modified

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.4.1
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_2000

      Description



      Name: rmT116609 Date: 01/23/2003


      FULL PRODUCT VERSION :
      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)


      FULL OPERATING SYSTEM VERSION : Windows 2000 Server


      A DESCRIPTION OF THE PROBLEM :
      File.exists() fails with relative paths if user.dir is set
      to a directory other than the current directory of the JVM
      process.

      Win32FileSystem.getBooleanAttributes(File f) is called
      without previously resolving the file within the user.dir.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      see example

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      public class Show
      {
       public static void main(String[] p_args)
       {
        File l_file;
        String l_strAbsolutePath;
        // ? a directory containing subdirectory subdir with file ping.txt
        // that is not the current directory of the process
        System.setProperty("user.dir", "?");
        l_file = new File("subdir", "ping.txt");
        l_strAbsolutePath = l_file.getAbsolutePath();
        System.out.println("This should be true but is " + l_file.exists());
        System.out.println("This should be true and is " + (new File
      (l_strAbsolutePath)).exists());
       }
      }

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


      (Review ID: 180301)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mr Mark Reinhold
                Reporter:
                rmandalasunw Ranjith Mandala (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: