-
Bug
-
Resolution: Fixed
-
P3
-
1.1, 1.1.1, 1.1.2
-
b01
-
x86, sparc
-
generic, solaris_2.5.1, windows_95
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2014711 | 1.2.0 | Michael Mccloskey | P3 | Resolved | Fixed | 1.2beta4 |
Name: akC57697 Date: 04/02/97
The java.io.File renameTo() does not work properly with non-canonical
pathnames.The method should convert given pathname to canonical one,
then rename.
______________________ TestRenNeg.java _________________________________
import java.io.*;
public class TestRenNeg {
public static void main(String[] args){
try {
File f1 = new File("\\c:\\From");
File f2 = new File("\\c:\\To");
if (f1.exists() || f2.exists() ) {
System.out.println("Test not applicable - directories exist ");
return;
}
System.out.println("Create :"+f1.mkdir());
System.out.println("Does it exist as directory ? :"+f1.exists()+" "+f1.isDirectory());
System.out.println("Rename:" +f1.renameTo(f2));
} catch (Exception e) {System.out.println("Unexpected "+e);}
}
}
______________________ Output ________________________________________
Create :true
Does it exist as directory ? :true true
Rename:false
______________________________________________________________________
======================================================================
- backported by
-
JDK-2014711 java.io.File.renameTo should work with non-canonical pathnames
- Resolved
- duplicates
-
JDK-4047777 File names with a leading slash before a drive letter are not always handled.
- Closed
-
JDK-4127582 File.delete() doesn't work with same name used for File.mkdir() on Windows
- Closed
- relates to
-
JDK-4042593 java.io.File delete should work with non-canonical pathnames
- Closed