You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Hoan-Vu Phan (JIRA)" <ji...@apache.org> on 2012/08/21 10:20:38 UTC

[jira] [Commented] (CXF-4477) [WADL2JAVA] Generate incorrect primitive parameter type

    [ https://issues.apache.org/jira/browse/CXF-4477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13438529#comment-13438529 ] 

Hoan-Vu Phan commented on CXF-4477:
-----------------------------------

Special thanks to Sergeyb for very fast response :)
But it still does not work for my case :(
In case of form submit, for example:

<representation mediaType="application/x-www-form-urlencoded">
    <param name="param1" required="false" style="query" type="xs:long" />
</representation>

It generates:

@FormParam("param1") long param1

But it should be:
@FormParam("param1") Long param1

I found in org.apache.cxf.tools.wadlto.jaxrs.SourceGenerator

String type = enumCreated ? getTypicalClassName(name) : getPrimitiveType(paramEl, info, imports);
if (paramAnn == QueryParam.class 
    && (isRepeating || !Boolean.valueOf(paramEl.getAttribute("required")))    
    && AUTOBOXED_PRIMITIVES_MAP.containsKey(type)) {
         type = AUTOBOXED_PRIMITIVES_MAP.get(type);
}

We have a check (paramAnn == QueryParam.class) that ignore FormParam case. Am i right? Is there any reason here?
Besides, I saw in your commit, we have a check like that:

if (schemaTypesMap.containsKey(value)) {
    return schemaTypesMap.get(value);
}

It means, user can defined a customize map types. But it will ignore the name space??? Maybe we will some type conflict between difference name spaces? It's not my case, but just for you information.

Best regards.




                
> [WADL2JAVA] Generate incorrect primitive parameter type 
> --------------------------------------------------------
>
>                 Key: CXF-4477
>                 URL: https://issues.apache.org/jira/browse/CXF-4477
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS, Tooling
>    Affects Versions: 2.6.1
>            Reporter: Hoan-Vu Phan
>            Assignee: Sergey Beryozkin
>            Priority: Critical
>
> In org.apache.cxf.tools.wadlto.jaxrs.SourceGenerator we have the code like this:
> XSD_SPECIFIC_TYPE_MAP = new HashMap<String, String>();
> XSD_SPECIFIC_TYPE_MAP.put("string", "String");
> XSD_SPECIFIC_TYPE_MAP.put("decimal", "java.math.BigInteger");
> XSD_SPECIFIC_TYPE_MAP.put("integer", "long");
> If we have a wadl like this:
> <param name="param1" required="true" style="query" type="xs:int" />
> <param name="param2" required="true" style="query" type="xs:long" />
> it's always generate (String param1) and (String param2)
> So far as I know, xs:int and xs:long beside xs:string are the most usage type in WADL. But now it can not work any more!!!!
> I think this is a regression bug from
> **********************************************************
> sergeyb  08.05.12 19:25:44
> [CXF-4292] Defaulting to String when WADL Generator can not determine a class name of the primitive type
> **********************************************************
> For the solution, I think we can expand XSD_SPECIFIC_TYPE_MAP which the exactly mapping as a standard:
> http://en.wikipedia.org/wiki/Java_Architecture_for_XML_Binding
> Could you please have a look on this issue.
> Many many many thanks :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira