Hello,
I am trying to use wadl2java from command line to build Open Patent Services java code from their wadl and xsd descriptors. I tried wadl v 1.1.1, and 1.1.2 from the trunk.
After dealing with some issues, currently I am dealing with the following errors with both version (you can find the full traces at the end of this message):
Version 1.1.1:
Exception in thread "main" java.lang.IllegalArgumentException: JClass name 262RestServicesPublishedData contains illegal character for beginning of identifier: 2
Version 1.1.2:
Exception in thread "main" java.lang.NullPointerException
I think this is motivated because the resources base of the services is located in a directory that starts with a number. It follows the related excerpt of the wadl file:
<resources base="/2.6.2/rest-services/published-data/">
<!-- GET -->
<resource path="{ref-type}/{ref-format}/{number}/{constituents}" id="publishedDataRetrievalGET">
<doc xml:lang="en" title="Published document retrieval GET interface"/>
<param href="#ref-type"/>
<param href="#ref-format"/>
<param href="#number"/>
<param name="constituents" href="#published-data-constituents"/>
<method name="GET" href="#wpdGETPOST"/>
</resource>
......
Looking for the solution, I saw that there is a class that fixes class names when they began with a number (java/org/jvnet/ws/wadl2java/GeneratorUtil.java). Could it be that this class is not being used for some reason when generating the java classes? Is there any quick fix to this?
Thanks in advance,
Ismael
Full trace of the errors:
Version 1.1.1:
Exception in thread "main" java.lang.IllegalArgumentException: JClass name 262RestServicesPublishedData contains illegal character for beginning of identifier: 2
at com.sun.codemodel.JDefinedClass.<init>(JDefinedClass.java:219)
at com.sun.codemodel.JDefinedClass.<init>(JDefinedClass.java:170)
at com.sun.codemodel.JPackage._class(JPackage.java:174)
at com.sun.codemodel.JPackage._class(JPackage.java:158)
at org.jvnet.ws.wadl2java.Wadl2Java.generateEndpointClass(Wadl2Java.java:579)
at org.jvnet.ws.wadl2java.Wadl2Java.process(Wadl2Java.java:287)
at org.jvnet.ws.wadl2java.Main.main(Main.java:120)
Version 1.1.2:
Exception in thread "main" java.lang.NullPointerException
at org.jvnet.ws.wadl2java.ResourceClassGenerator.getMethodName(ResourceClassGenerator.java:566)
at org.jvnet.ws.wadl2java.ResourceClassGenerator.generateMethodDecl(ResourceClassGenerator.java:706)
at org.jvnet.ws.wadl2java.ResourceClassGenerator.generateMethodVariants(ResourceClassGenerator.java:550)
at org.jvnet.ws.wadl2java.ResourceClassGenerator.generateMethodDecls(ResourceClassGenerator.java:486)
at org.jvnet.ws.wadl2java.Wadl2Java.generateSubClass(Wadl2Java.java:731)
at org.jvnet.ws.wadl2java.Wadl2Java.generateEndpointClass(Wadl2Java.java:664)
at org.jvnet.ws.wadl2java.Wadl2Java.process(Wadl2Java.java:310)
at org.jvnet.ws.wadl2java.Main.main(Main.java:120)