Duplicate :
|
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) ======================================================================