[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/23974] New: new File( "name\\" ).getName() returns "" ins
From: |
trygvis at inamo dot no |
Subject: |
[Bug classpath/23974] New: new File( "name\\" ).getName() returns "" instead of "name" |
Date: |
19 Sep 2005 21:37:32 -0000 |
Even though the current behaviour seems like the most consistent behaviour it's
unconsistent with Sun's behaviour.
To illustrate the problem, add this to mauve/gnu/testlet/java/io/File/newFile.
java:
harness.check(new File("dir").getName(), "dir", "getName(): returns the
argument" );
harness.check(new File("dir/").getName(), "dir", "getName(): dir/");
harness.check(new File("dir\\").getName(), "dir\\", "getName(): dir\\");
Output with jamvm:
[mauve] PASS: gnu.testlet.java.io.File.newFile: getName(): dir/ (number 1)
[mauve] FAIL: gnu.testlet.java.io.File.newFile: getName(): dir\ (number 1)
[mauve] got but expected dir\
Output with java:
[mauve] PASS: gnu.testlet.java.io.File.newFile: getName(): dir/ (number 1)
[mauve] PASS: gnu.testlet.java.io.File.newFile: getName(): dir\ (number 1)
The code that made this issue come up was this testcase from commons-io:
public void testPrefix() throws Exception {
IOFileFilter filter = new PrefixFileFilter(new String[] { "foo", "bar"
});
assertFiltering(filter, new File("foo.test"), true);
assertFiltering(filter, new File("FOO.test"), false); //case-sensitive
assertFiltering(filter, new File("foo"), true);
assertFiltering(filter, new File("bar"), true);
assertFiltering(filter, new File("food/"), true);
assertFiltering(filter, new File("barred\\"), true);
assertFiltering(filter, new File("test"), false);
assertFiltering(filter, new File("fo_o.test"), false);
assertFiltering(filter, new File("abar.exe"), false);
filter = new PrefixFileFilter("tes");
assertFiltering(filter, new File("test"), true);
assertFiltering(filter, new File("fred"), false);
try {
new PrefixFileFilter((String) null);
fail();
} catch (IllegalArgumentException ex) {
}
}
I will check in the commons-io debian package today in pkg-java project on
alioth.debian.org including a patch to comment out the test case, but just
remove the patch and the issue should show up.
--
Summary: new File( "name\\" ).getName() returns "" instead of
"name"
Product: classpath
Version: 0.18
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: classpath
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: trygvis at inamo dot no
CC: bug-classpath at gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23974
- [Bug classpath/23974] New: new File( "name\\" ).getName() returns "" instead of "name",
trygvis at inamo dot no <=