JDK-8071955 : javax\xml\ws\8046817\GenerateEnumSchema.java fails on Windows JDK9 builds
  • Type: Bug
  • Component: xml
  • Sub-Component: jaxb
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows
  • CPU: generic
  • Submitted: 2015-01-29
  • Updated: 2015-04-10
  • Resolved: 2015-04-10
Related Reports
Duplicate :  
Duplicate :  
Description
The javax\xml\ws\8046817\GenerateEnumSchema.java  fails on latest JDK9 builds. Most probably the failure is related to the changes introduced by JDK-8060056 , JDK-8059977.
It looks like that schemagen (com.sun.tools.internal.jxc.SchemaGenerator) tool source code needs to be examined and modified to address these changes.

Failure log:
STDOUT:
Call to schemagen: C:\jprt\T\P1\204922.aefimov\testproduct\windows_i586_6.1-product\bin\schemagen.exe TestClassType.java
Jan 29, 2015 1:21:23 PM com.sun.tools.internal.jxc.SchemaGenerator run
SEVERE: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:152)
at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:77)
at com.sun.tools.internal.jxc.SchemaGenerator.main(SchemaGenerator.java:68)
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/jprt/T/P1/204922.aefimov/testproduct/windows_i586_6.1-product/lib/modules/appmodules.jimage
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.nio.file.Paths.get(Paths.java:84)
at com.sun.tools.javac.file.Locations.getPathEntries(Locations.java:169)
at com.sun.tools.javac.file.Locations.access$300(Locations.java:87)
at com.sun.tools.javac.file.Locations$SearchPath.addFiles(Locations.java:238)
at com.sun.tools.javac.file.Locations$SearchPath.addFiles(Locations.java:244)
at com.sun.tools.javac.file.Locations$SimpleLocationHandler.handleOption(Locations.java:448)
at com.sun.tools.javac.file.Locations.handleOption(Locations.java:743)
at com.sun.tools.javac.util.BaseFileManager.handleOption(BaseFileManager.java:210)
at com.sun.tools.javac.util.BaseFileManager$1.handleFileManagerOption(BaseFileManager.java:168)
at com.sun.tools.javac.main.Option.process(Option.java:672)
at com.sun.tools.javac.main.Option$6.process(Option.java:157)
at com.sun.tools.javac.util.BaseFileManager.handleOption(BaseFileManager.java:176)
at com.sun.tools.javac.main.Arguments.processArgs(Arguments.java:297)
at com.sun.tools.javac.main.Arguments.init(Arguments.java:229)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:166)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:108)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:64)
at com.sun.tools.internal.jxc.SchemaGenerator$Runner.compile(SchemaGenerator.java:231)
... 7 more

STDERR:
java.lang.RuntimeException: schemagen failed
	at GenerateEnumSchema.runSchemaGen(GenerateEnumSchema.java:126)
	at GenerateEnumSchema.main(GenerateEnumSchema.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:745)
Comments
Reported issue was fixed as part of JDK-8076549
10-04-2015

The following fix is compatible with -source 1.6 and can be applied to standalone project: diff -r b8fbe40efa97 src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java --- a/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java Thu Feb 26 20:17:21 2015 -0800 +++ b/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java Wed Mar 04 13:49:26 2015 +0300 @@ -44,6 +44,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -139,12 +140,10 @@ aptargs.add("-cp"); aptargs.add(setClasspath(options.classpath)); // set original classpath + jaxb-api to be visible to annotation processor - if(options.targetDir!=null) { aptargs.add("-d"); aptargs.add(options.targetDir.getPath()); } - aptargs.addAll(options.arguments); String[] argsarray = aptargs.toArray(new String[aptargs.size()]); @@ -158,7 +157,13 @@ while (cl != null) { if (cl instanceof URLClassLoader) { for (URL url : ((URLClassLoader) cl).getURLs()) { - appendPath(cp, url.getPath()); + try { + appendPath(cp,new File(url.toURI()).getPath()); + } catch(URISyntaxException ex) { + /*If the URL is not properly formated - skip it*/ + LOGGER.log(Level.SEVERE, ex.getMessage(), ex); + } } } cl = cl.getParent(); The failed regression test now passes with this fix. Will work on fix for upstream project (JAXB). When it will be done - the fix will make it to JDK as part of JAXWS sync-up process.
04-03-2015

The following fix solves the problem in JDK9 schemagen tool: diff -r 3b14b7c9c719 src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java --- a/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java Mon Jan 26 12:36:37 2015 +0300 +++ b/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java Wed Feb 18 19:20:16 2015 +0300 @@ -44,6 +44,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -158,7 +157,12 @@ while (cl != null) { if (cl instanceof URLClassLoader) { for (URL url : ((URLClassLoader) cl).getURLs()) { - appendPath(cp, url.getPath()); + try { + appendPath(cp, Paths.get(url.toURI()).toString()); + } catch(URISyntaxException ex) { + /*If the URL is not properly formated - skip it*/ + LOGGER.log(Level.SEVERE, ex.getMessage(), ex); + } } } cl = cl.getParent(); But this fix can't be applied to upstream jaxb project, because there is no java.nio.file.Paths in JDK6
18-02-2015

Output on Windows with debug added to SchemaGenerator: Feb 14, 2015 12:52:21 PM com.sun.tools.internal.jxc.SchemaGenerator$Runner compile SEVERE: Recognized Options: Feb 14, 2015 12:52:22 PM com.sun.tools.internal.jxc.SchemaGenerator$Runner compile SEVERE: -cp Feb 14, 2015 12:52:22 PM com.sun.tools.internal.jxc.SchemaGenerator$Runner compile SEVERE: /E:/tests/schemagen_failure/fvb/lib/modules/appmodules.jimage;/E:/tests/schemagen_failure/fvb/lib/tools.jar;/E:/tests/schemagen_failure/fvb/classes;/E:/tests/schemagen_failure/fvb/lib/modules/extmodules.jimage Feb 14, 2015 12:52:22 PM com.sun.tools.internal.jxc.SchemaGenerator$Runner compile SEVERE: Class Names: Feb 14, 2015 12:52:22 PM com.sun.tools.internal.jxc.SchemaGenerator run SEVERE: null java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:151) at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:76) at com.sun.tools.internal.jxc.SchemaGenerator.main(SchemaGenerator.java:67) Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 2: /E:/tests/schemagen_failure/fvb/lib/modules/appmodules.jimage at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182) at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153) at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94) at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255) at java.nio.file.Paths.get(Paths.java:84) at com.sun.tools.javac.file.Locations.getPathEntries(Locations.java:169) at com.sun.tools.javac.file.Locations.access$300(Locations.java:87) at com.sun.tools.javac.file.Locations$SearchPath.addFiles(Locations.java:238) at com.sun.tools.javac.file.Locations$SearchPath.addFiles(Locations.java:244) at com.sun.tools.javac.file.Locations$SimpleLocationHandler.handleOption(Locations.java:448) at com.sun.tools.javac.file.Locations.handleOption(Locations.java:743) at com.sun.tools.javac.util.BaseFileManager.handleOption(BaseFileManager.java:210) at com.sun.tools.javac.util.BaseFileManager$1.handleFileManagerOption(BaseFileManager.java:168) at com.sun.tools.javac.main.Option.process(Option.java:672) at com.sun.tools.javac.main.Option$6.process(Option.java:157) at com.sun.tools.javac.util.BaseFileManager.handleOption(BaseFileManager.java:176) at com.sun.tools.javac.main.Arguments.processArgs(Arguments.java:297) at com.sun.tools.javac.main.Arguments.init(Arguments.java:229) at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:166) at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:108) at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:64) at com.sun.tools.internal.jxc.SchemaGenerator$Runner.compile(SchemaGenerator.java:247) ... 7 more
14-02-2015

It seams like the source of incorrect file path that breaks the schemagen run is recognisedOptions in internal JavacOptions class in com/sun/tools/internal/jxc/SchemaGenerator.java: On Linux these options contains the following: -cp /home/aefimov/Oracle/bugs/schemagen_URL_test_failure/dev/build/linux-x86_64-normal-server-release/images/jdk/lib/modules/appmodules.jimage:/home/aefimov/Oracle/bugs/schemagen_URL_test_failure/dev/build/linux-x86_64-normal-server-release/images/jdk/lib/tools.jar:/home/aefimov/Oracle/bugs/schemagen_URL_test_failure/dev/build/linux-x86_64-normal-server-release/images/jdk/classes:/home/aefimov/Oracle/bugs/schemagen_URL_test_failure/dev/build/linux-x86_64-normal-server-release/images/jdk/lib/modules/extmodules.jimage Will check on Windows platform
13-02-2015

The following call to schemagen tool is failing with the same error [1] with JDK9b42 on Win7-x64 (no error on 9b41): schemagen TestClassType.java Seems like the problem is not with test, but with SchemaGen tool itself that was introduced between 9b41 and 9b42. [1]: SEVERE: null java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:151) at com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:76) at com.sun.tools.internal.jxc.SchemaGenerator.main(SchemaGenerator.java:67) Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 2: /E:/bundles/9b42/lib/modules/appmodules.jimage at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182) at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153) at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94) at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255) at java.nio.file.Paths.get(Paths.java:84) at com.sun.tools.javac.file.Locations.getPathEntries(Locations.java:169) at com.sun.tools.javac.file.Locations.access$300(Locations.java:87) at com.sun.tools.javac.file.Locations$SearchPath.addFiles(Locations.java:238) at com.sun.tools.javac.file.Locations$SearchPath.addFiles(Locations.java:244) at com.sun.tools.javac.file.Locations$SimpleLocationHandler.handleOption(Locations.java:448) at com.sun.tools.javac.file.Locations.handleOption(Locations.java:743) at com.sun.tools.javac.util.BaseFileManager.handleOption(BaseFileManager.java:210) at com.sun.tools.javac.util.BaseFileManager$1.handleFileManagerOption(BaseFileManager.java:168) at com.sun.tools.javac.main.Option.process(Option.java:672) at com.sun.tools.javac.main.Option$6.process(Option.java:157) at com.sun.tools.javac.util.BaseFileManager.handleOption(BaseFileManager.java:176) at com.sun.tools.javac.main.Arguments.processArgs(Arguments.java:297) at com.sun.tools.javac.main.Arguments.init(Arguments.java:229) at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:166) at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:108) at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:64) at com.sun.tools.internal.jxc.SchemaGenerator$Runner.compile(SchemaGenerator.java:235) ... 7 more
13-02-2015