Misleading error message in cxf-codegen-plugin URISyntaxException: Illegal 
character when path contains \
---------------------------------------------------------------------------------------------------------

                 Key: CXF-2632
                 URL: https://issues.apache.org/jira/browse/CXF-2632
             Project: CXF
          Issue Type: Bug
          Components: Tooling
    Affects Versions: 2.2.5
            Reporter: Christian Schneider


When using the cxf-cogegen-plugin you can use \ in path to wsdls. As long as 
the file is found it works well. But when the file is not found you do not get 
an error message like file not found but something like
"java.net.URISyntaxException: Illegal character in path at index 4: 
wsdl\HelloWorld.wsdl".

I think this is because WsdlOption.getWsdlURI first tries to find a ffile with 
the given name. When it does not find a file it tries to resolve a url with the 
name. As long as the url is valid you get a reasonable exception. If it 
contains characters like \ you get the exception above. I think we should 
improve this. For example we could catch the IllegalArgumentException and throw 
a new exception like:
File <path> not found and path is also no valid url. 
Together with the Illegalargumentexception this would be clearer to end users.

Any opinions how to handle this?

java.lang.IllegalArgumentException
        at java.net.URI.create(URI.java:842)
        at java.net.URI.resolve(URI.java:1028)
        at org.apache.cxf.maven_plugin.WsdlOption.getWsdlURI(WsdlOption.java:86)
        at 
org.apache.cxf.maven_plugin.WSDL2JavaMojo.callWsdl2Java(WSDL2JavaMojo.java:391)
        at 
org.apache.cxf.maven_plugin.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:359)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:191)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
        at 
org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
        at 
org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
        at 
org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
        at 
org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
        at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
        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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:408)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:351)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:31)
Caused by: java.net.URISyntaxException: Illegal character in path at index 4: 
fsrc\mHelloWor
        at java.net.URI$Parser.fail(URI.java:2809)
        at java.net.URI$Parser.checkChars(URI.java:2982)
        at java.net.URI$Parser.parseHierarchical(URI.java:3066)
        at java.net.URI$Parser.parse(URI.java:3024)
        at java.net.URI.<init>(URI.java:578)
        at java.net.URI.create(URI.java:840)
        ... 26 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to