eclipse-ee4j / jaxb-ri

Jaxb RI
https://eclipse-ee4j.github.io/jaxb-ri/
BSD 3-Clause "New" or "Revised" License
202 stars 110 forks source link

Schema generation fails when result path contains space #974

Open Tomas-Kraus opened 11 years ago

Tomas-Kraus commented 11 years ago

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]

Tomas-Kraus commented 5 years ago
Tomas-Kraus commented 11 years ago

@glassfishrobot Commented Reported by sentinel_atteo

Tomas-Kraus commented 11 years ago

@glassfishrobot Commented sentinel_atteo said: As you can see the space character is somehow converted to %20.

Tomas-Kraus commented 11 years ago

@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.

See: https://java.net/projects/jaxb/sources/version2/content/trunk/txw2/runtime/src/main/java/com/sun/xml/txw2/output/StreamSerializer.java?rev=4179

Tomas-Kraus commented 11 years ago

@glassfishrobot Commented Was assigned to yaroska

Tomas-Kraus commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-974