jaxb
  1. jaxb
  2. JAXB-974

Schema generation fails when result path contains space

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2.7
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      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)

        Activity

        Hide
        sentinel_atteo added a comment -

        As you can see the space character is somehow converted to %20.

        Show
        sentinel_atteo added a comment - As you can see the space character is somehow converted to %20.
        Hide
        sentinel_atteo added a comment -

        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

        Show
        sentinel_atteo added a comment - 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

          People

          • Assignee:
            Iaroslav Savytskyi
            Reporter:
            sentinel_atteo
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: