Name: rm29839 Date: 03/05/98
If you construct a java.io.File with a filename
which contains forward slashes, the filename parsing
routines getParent() and getName() don't do the
right thing, even though everything else about the
interface works fine.
Consider the following fragment:
File f = new File("C:/temp/dir1/dir2/fname");
System.out.print("Your file ")
if( f.exists())
System.out.println("exists");
else{
System.out.println("doesn't exist. Please create it.");
System.exit(0);
}
System.out.println("The parent is ["+f.getParent()+"]");
System.out.println("The name is ["+f.getName()+"]");
// parent aways returns empty
// name always contains the whole string.
At least be consistent!
(Review ID: 25941)
======================================================================
- duplicates
-
JDK-4102262 java.io.File: Inconsistent filename normalization (win32)
-
- Closed
-