Name: rmT116609 Date: 08/13/2002
FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
and:
java version "1.4.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14)
Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode)
FULL OPERATING SYSTEM VERSION :
Linux 2.4.x
ADDITIONAL OPERATING SYSTEMS :
Windows 2000
A DESCRIPTION OF THE PROBLEM :
Case 1:
File f1 = new File("/tmp");
File f2 = new File "/tmp/"); //note trailing slash
f1.equals(f2) is TRUE
Now consider Case 2:
f1 = new File("/tmp", "");
f2 = new File("/tmp", "/"); //note trailing slash
f1.equals(f2) is now FALSE !
Note, in both cases, the files represented are exactly
the same and in both cases one file ends with "/" while
the other does not. Regardless, equals() is true in the
former and false in the latter case.
Note, this problem happens BOTH in Win2K and linux.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample program
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: case1 and case 2 would both be true.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.*;
public class FileTest
{
public static void main (String args[])
{
// CASE 1
File f1 = new File("/tmp");
File f2 = new File("/tmp/"); //note trailing slash
System.out.println("case 1:" + f1.equals(f2));
// CASE 2
f1 = new File("/tmp", "");
f2 = new File("/tmp", "/"); //note trailing slash
System.out.println("case 2:" + f1.equals(f2));
}
}
---------- END SOURCE ----------
(Review ID: 160702)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
and:
java version "1.4.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14)
Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode)
FULL OPERATING SYSTEM VERSION :
Linux 2.4.x
ADDITIONAL OPERATING SYSTEMS :
Windows 2000
A DESCRIPTION OF THE PROBLEM :
Case 1:
File f1 = new File("/tmp");
File f2 = new File "/tmp/"); //note trailing slash
f1.equals(f2) is TRUE
Now consider Case 2:
f1 = new File("/tmp", "");
f2 = new File("/tmp", "/"); //note trailing slash
f1.equals(f2) is now FALSE !
Note, in both cases, the files represented are exactly
the same and in both cases one file ends with "/" while
the other does not. Regardless, equals() is true in the
former and false in the latter case.
Note, this problem happens BOTH in Win2K and linux.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample program
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: case1 and case 2 would both be true.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.*;
public class FileTest
{
public static void main (String args[])
{
// CASE 1
File f1 = new File("/tmp");
File f2 = new File("/tmp/"); //note trailing slash
System.out.println("case 1:" + f1.equals(f2));
// CASE 2
f1 = new File("/tmp", "");
f2 = new File("/tmp", "/"); //note trailing slash
System.out.println("case 2:" + f1.equals(f2));
}
}
---------- END SOURCE ----------
(Review ID: 160702)
======================================================================
- duplicates
-
JDK-8290499 new File(parent, "/") breaks normalization – creates File with slash at the end
- Closed