You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Reguel Wermelinger (JIRA)" <ji...@apache.org> on 2018/01/31 09:53:00 UTC

[jira] [Commented] (CXF-6134) Apache CXF generating constructor with duplicate argument names causing compilation error

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

Reguel Wermelinger commented on CXF-6134:
-----------------------------------------

I'm also facing this issue with CXF 3.2.1. The problem is in the fault.vm template within `cxf-tools-wsdlto-frontend-jaxws-3.2.1.jar/org.apache.cxf.tools.wsdlto.frontend.jaxws.template/fault.vm`

The constructor parameters must be set to qualified `java.lang.Throwable`type to avoid conflicts with local `Throwable` type in the same package. A patched version of the template is attache to the issue:

[^fault.vm]

A sample WSDL that causes this error is here:

[^portalWebStartable.wsdl]

^Workaround: enable autoNameResolution and reserve the Throwable name of your WSDL. Eg.^
{code:java}
<extraargs>
 <extraarg>-autoNameResolution</extraarg>
 <extraarg>-reserveClass</extraarg> 
  <extraarg>ch.ivy.ws.addon.Throwable</extraarg>
</extraargs>{code}

> Apache CXF generating constructor with duplicate argument names causing compilation error
> -----------------------------------------------------------------------------------------
>
>                 Key: CXF-6134
>                 URL: https://issues.apache.org/jira/browse/CXF-6134
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.7.11, 3.0.2
>            Reporter: Marcel Overdijk
>            Priority: Major
>         Attachments: fault.vm, portalWebStartable.wsdl
>
>
> I'm using the cxf-codegen-plugin plugin to generate a web service client.
> For many wsdl's this goes fine but I have one causing problems.
> It is a wsdl containing fault messages defined like: 
> {code}
> <message name="CustomerNotFoundException">
>     <part name="message" type="xs:string" />
> </message>
> {code}
> The generated Java file looks like:
> {code}
> @WebFault(name = "message", targetNamespace = "http://www.w3.org/2001/XMLSchema")
> public class CustomerNotFoundException extends Exception {
>     private java.lang.String message;
>     public CustomerNotFoundException() {
>         super();
>     }
>     public CustomerNotFoundException(String message) {
>         super(message);
>     }
>     public CustomerNotFoundException(String message, Throwable cause) {
>         super(message, cause);
>     }
>     public CustomerNotFoundException(String message, java.lang.String message) {
>         super(message);
>         this.message = message;
>     }
>     public CustomerNotFoundException(String message, java.lang.String message, Throwable cause) {
>         super(message, cause);
>         this.message = message;
>     }
>     ..
> }
> {code}
> Which fails compilation because of the duplicate message argument of the CustomerNotFoundException constructor.
> In my pom I've added:
> {code}
> <extraargs>
>     <extraarg>-allowElementReferences</extraarg>
>     <extraarg>-autoNameResolution</extraarg>
>     <extraarg>-verbose</extraarg>
> </extraargs>
> {code}
> But this does not help.
> I even tried custom bindings but it does not seem possible to change argument name of a constructor of a generated exception.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)