jaxb-ri
jaxb-ri copied to clipboard
Schema generation fails when result path contains space
Given the 'filename' variable contains path with space character, the following code:
context = JAXBContext.newInstance(klasses); context.generateSchema(new SchemaOutputResolver() { @Override public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException
{ return new StreamResult(filename); }
});
results in the following exception:
java.io.IOException: java.io.FileNotFoundException: /var/lib/jenkins/jobs/Moonshine%20REVIEW/workspace/atomikos/target/test-home/config/schema.xsd (No such file or directory) at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeTo(XmlSchemaGenerator.java:729) at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.access$800(XmlSchemaGenerator.java:505) at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator.write(XmlSchemaGenerator.java:487) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.generateSchema(JAXBContextImpl.java:832) at org.atteo.evo.config.Configuration.generateSchema(Configuration.java:222) at org.atteo.moonshine.services.Services.generateTemplateConfigurationFile(Services.java:250) at org.atteo.moonshine.services.Services.setup(Services.java:277) at org.atteo.moonshine.MoonshineImplementation.start(MoonshineImplementation.java:206) at org.atteo.moonshine.tests.MoonshineRule$1.evaluate(MoonshineRule.java:136) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:158) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)
Affected Versions
[2.2.7]
- Issue Imported From: https://github.com/javaee/jaxb-v2/issues/974
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @glassfishrobot
@glassfishrobot Commented Reported by sentinel_atteo
@glassfishrobot Commented sentinel_atteo said: As you can see the space character is somehow converted to %20.
@glassfishrobot Commented sentinel_atteo said: I think the problem is somewhere in the convertURL method of the StreamSerializer class where some weird magic is going on while extracting path to file from URL.
@glassfishrobot Commented Was assigned to yaroska
@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-974