Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContentResolver.resolve throws a.lang.IllegalArgumentException: Unrecognised URI when path to schema contains space #94

Closed
joelittlejohn opened this issue Jun 23, 2013 · 3 comments
Milestone

Comments

@joelittlejohn
Copy link
Owner

Original author: [email protected] (March 12, 2013 14:08:55)

What steps will reproduce the problem?

  1. Create a schema in a source directory containing a space

e.g. /acme component/widget/src/main/resources/json/someObject.json

The source directory "acme component" has a space

  1. Use maven to generate the POJOs via a Jenkins job

What is the expected output?
POJOs created with no errors

What do you see instead?
"acme component" in the path gets translated to acme%20component, ContentResolver.resolve throws an exception

java.lang.IllegalArgumentException: Unrecognised URI, can't resolve this: file:/opt/jenkins/workspace/acme%20component/widget/src/main/resources/json/someObject.json
at com.googlecode.jsonschema2pojo.ContentResolver.resolve(ContentResolver.java:69)
at com.googlecode.jsonschema2pojo.SchemaStore.create(SchemaStore.java:49)
at com.googlecode.jsonschema2pojo.SchemaStore.create(SchemaStore.java:89)
at com.googlecode.jsonschema2pojo.rules.JsonSchemaRule.apply(JsonSchemaRule.java:59)
at com.googlecode.jsonschema2pojo.rules.JsonSchemaRule.apply(JsonSchemaRule.java:30)
at com.googlecode.jsonschema2pojo.SchemaMapper.generate(SchemaMapper.java:83)
at com.googlecode.jsonschema2pojo.cli.Jsonschema2Pojo.generate(Jsonschema2Pojo.java:96)
at com.googlecode.jsonschema2pojo.maven.Jsonschema2PojoMojo.execute(Jsonschema2PojoMojo.java:277)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:182)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.lifecycle.LifecycleExecutorInterceptor.execute(LifecycleExecutorInterceptor.java:65)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at hudson.maven.agent.Main.launch(Main.java:185)
at hudson.maven.MavenBuilder.call(MavenBuilder.java:151)
at hudson.maven.Maven2Builder.call(Maven2Builder.java:77)
at hudson.maven.Maven2Builder.call(Maven2Builder.java:53)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.FileNotFoundException: /opt/jenkins/workspace/acme%20component/widget/src/main/resources/json/someObject.json (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at com.fasterxml.jackson.core.JsonFactory._optimizedStreamFromURL(JsonFactory.java:1404)
at com.fasterxml.jackson.core.JsonFactory.createJsonParser(JsonFactory.java:797)
at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:1701)
at com.googlecode.jsonschema2pojo.ContentResolver.resolve(ContentResolver

What version of the tool are you using? On what Java version? (On what
version of Maven/Ant if applicable?)
<plugin> <groupId>com.googlecode.jsonschema2pojo</groupId> <artifactId>jsonschema2pojo-maven-plugin</artifactId> <version>0.3.5</version></plugin>

Maven: 2.2.1

Pom details for the build

&lt;build&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;com.googlecode.jsonschema2pojo&lt;/groupId&gt;
            &lt;artifactId&gt;jsonschema2pojo-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;0.3.5&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;generate&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
            &lt;configuration&gt;
                &lt;sourceDirectory&gt;${basedir}/src/main/resources/json&lt;/sourceDirectory&gt;
                &lt;targetPackage&gt;com.acme&lt;/targetPackage&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;

*${basedir} in sourceDirectory above containing a space

Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=94

@joelittlejohn
Copy link
Owner Author

From [email protected] on March 12, 2013 18:10:05
Thanks for raising this. This has also been mentioned on issue #87. It looks like this is a problem upstream in Jackson:

FasterXML/jackson-core#48

We should be able to fix this by upgrading to 2.2.0 (when that release is available).

@joelittlejohn
Copy link
Owner Author

From [email protected] on March 25, 2013 21:48:48
Looks like this isn't going to be ready for 0.3.6, we're waiting on Jackson Core release 2.1.5 or 2.2.0.

@joelittlejohn
Copy link
Owner Author

From [email protected] on April 30, 2013 07:27:04
Fixed for 0.3.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant