JDK-2210049 : tools/javac/api/T6397104.java fails
  • Type: Backport
  • Backport of: JDK-7046929
  • Component: tools
  • Sub-Component: javac
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2011-05-20
  • Updated: 2011-11-29
  • Resolved: 2011-11-02
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.

To download the current JDK release, click here.
JDK 6 JDK 8
6u30 b10Fixed 8Fixed
Comments
EVALUATION The fix for this differs from the fix for JDK 7/8 because JDK 6 has bug 6419926 JSR 199: FileObject.toUri() generates URI without schema (Solaris) which affects this test.
20-05-2011

SUGGESTED FIX diff -r d1de139d856c test/tools/javac/api/T6397104.java --- a/test/tools/javac/api/T6397104.java Wed May 18 22:22:42 2011 -0700 +++ b/test/tools/javac/api/T6397104.java Mon May 23 14:52:41 2011 -0700 @@ -6,6 +6,7 @@ */ import java.io.File; +import java.net.URI; import java.util.Arrays; import javax.tools.*; import javax.tools.JavaFileManager.Location; @@ -28,7 +29,15 @@ : fm.getJavaFileObjectsFromFiles(Arrays.asList(siblingFile)).iterator().next(); FileObject fileObject = fm.getFileForOutput(location, "java.lang", relName, sibling); - if (!fileObject.toUri().getPath().equals(expectedPath)) + + URI expectedURI = new File(expectedPath).toURI(); + URI fileObjectURI = fileObject.toUri(); + if (!fileObjectURI.equals(expectedURI) && + // This is a special case workaround for the 2nd test, caused by bug: + // 6419926 JSR 199: FileObject.toUri() generates URI without schema (Solaris) + // ie, the URI for "baz.xml" is incorrectly generated as "baz.xml" instead of the abs URI + // which is expected. + !fileObjectURI.getPath().equals(expectedPath)) throw new AssertionError("Expected " + expectedPath + ", got " + fileObject.toUri().getPath()); System.out.format("OK: (%s, %s) => %s%n", siblingFile, relName, fileObject.toUri());
20-05-2011