users@wadl.java.net

Re: Problem generating classes when the "resources base" attribute starts with a number

From: Gerard Davison <gerard.davison_at_oracle.com>
Date: Tue, 22 May 2012 16:08:37 +0100

Hi,

I have merged in a fix for WADL-49 and WADL-50 which relate to this bug,
there are still fundamental problem with the original .wadl, I have
contacted the authors and hopefully we can get a fixed version in place.
Until then we at least get some feedback that the wadl involved is invalid.

Sorry this is not a total resolution of your problem.

Gerard

On 13/04/2012 10:44, Ismael Hasan Romero wrote:
> 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)

-- 
Gerard Davison | Senior Principal Software Engineer | +44 118 924 5095
Oracle JDeveloper Web Service, Spring, Weblogic SCA Tooling Development
Oracle Corporation UK Ltd is a company incorporated in England&  Wales.
Company Reg. No. 1782505.
Reg. office: Oracle Parkway, Thames Valley Park, Reading RG6 1RA.
Blog http://kingsfleet.blogspot.com Twitter kingsfleet