The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
In JDK 6, this test passes on linux/solaris and fails on windows.
In JDK 7, this test has an @ignore. If that is removed, the test fails on all platforms.
Comments
SUGGESTED FIX
diff -r bdfa48f80c82 test/tools/javac/api/T6397104.java
--- a/test/tools/javac/api/T6397104.java Wed May 11 14:55:02 2011 -0700
+++ b/test/tools/javac/api/T6397104.java Tue May 24 11:57:46 2011 -0700
@@ -26,10 +26,10 @@
* @bug 6397104
* @summary JSR 199: JavaFileManager.getFileForOutput should have sibling argument
* @author Peter von der Ah\u00e9
- * @ignore this test should be rewritten when fixing 6473901
*/
import java.io.File;
+import java.net.URI;
import java.util.Arrays;
import javax.tools.*;
import javax.tools.JavaFileManager.Location;
@@ -52,10 +52,14 @@
: fm.getJavaFileObjectsFromFiles(Arrays.asList(siblingFile)).iterator().next();
FileObject fileObject =
fm.getFileForOutput(location, "java.lang", relName, sibling);
- if (!fileObject.toUri().getPath().equals(expectedPath))
- throw new AssertionError("Expected " + expectedPath +
- ", got " + fileObject.toUri().getPath());
- System.out.format("OK: (%s, %s) => %s%n", siblingFile, relName, fileObject.toUri());
+
+ File expectedFile = new File(expectedPath).getCanonicalFile();
+ File fileObjectFile = new File(fileObject.toUri()).getCanonicalFile();
+
+ if (!fileObjectFile.equals(expectedFile))
+ throw new AssertionError("Expected " + expectedFile +
+ ", got " + fileObjectFile);
+ System.out.format("OK: (%s, %s) => %s%n", siblingFile, relName, fileObjectFile);
}
void test(boolean hasLocation, File siblingFile, String relName, String expectedPath)
20-05-2011
SUGGESTED FIX
- Fix the test to expect FileObject.toUri() to return an absolute URI instead of a relative URI.
- Remove the @ignore from the test
20-05-2011
EVALUATION
The problem is that the test calls FileObject.toUri() and expects to get back a relative URI, which it does on JDK 6 on linux/solaris, but not on JDK 6 on windows, nor on JDK 7.
In JDK 6 on windows, the FileObject's path contains \\ chars which are illegal in a URI, which causes FileObject.toUri() to return an absolute URI instead of a relative URI.
In JDK 7, FileObject.toUri() has been fixed to return an absolute URI - See:
6419926 JSR 199: FileObject.toUri() generates URI without schema (Solaris)