You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Frederik Hansen <fr...@roirex.dk> on 2016/03/17 14:30:19 UTC

[Axis2] Fixed value causes Exception for non fixed values in ADB generated code

Hi

I'm using Axis 1.7.1 and found an issue using fixed values in WDSL and the 
ADB Codegenerator.

Basically when one fixed value/attribute exists, all attributes are treated 
as fixed attributes. This means, when setting the value on a non-fixed 
attribute, it set be seen as null (but set) and causing an exception.

I've attached a simplified WSDL, the generate java files, one with the 
fixed value in place, and one without, and also a diff showing the issue 
(the missing line with "this.localPersonId = param;").

I've looked in the ADB Codegen code, and IMHO the issue seems to be in 
SchemaCompiler where the code says:

            // register the fixed value if present
            if (xsElt.getFixedValue() != null) {
                metainf.registerDefaultValue(xsElt.getQName(), 
xsElt.getFixedValue());
                metainf.setFixed(true);
            }

The setFixed seems to be too broad, and maybe it can be changed into 
something following the registerNillableQName-flow, e.g. 
registerFixedQName(xsElt.getQName()).

Just to test, I've also tried version 1.7.0 and 1.6.4, there the same issue 
exists.

Hope this make sense.

Regards,
Frederik Hansen

Re: [Axis2] Fixed value causes Exception for non fixed values in ADB generated code

Posted by Andreas Veithen <an...@gmail.com>.
Could you create a JIRA issue and attach a patch?

Andreas

On Thu, Mar 17, 2016 at 1:30 PM, Frederik Hansen <fr...@roirex.dk> wrote:

> Hi
>
> I'm using Axis 1.7.1 and found an issue using fixed values in WDSL and the
> ADB Codegenerator.
>
> Basically when one fixed value/attribute exists, all attributes are
> treated as fixed attributes. This means, when setting the value on a
> non-fixed attribute, it set be seen as null (but set) and causing an
> exception.
>
> I've attached a simplified WSDL, the generate java files, one with the
> fixed value in place, and one without, and also a diff showing the issue
> (the missing line with "this.localPersonId = param;").
>
> I've looked in the ADB Codegen code, and IMHO the issue seems to be in
> SchemaCompiler where the code says:
>
>             // register the fixed value if present
>             if (xsElt.getFixedValue() != null) {
>                 metainf.registerDefaultValue(xsElt.getQName(),
> xsElt.getFixedValue());
>                 metainf.setFixed(true);
>             }
>
> The setFixed seems to be too broad, and maybe it can be changed into
> something following the registerNillableQName-flow, e.g.
> registerFixedQName(xsElt.getQName()).
>
> Just to test, I've also tried version 1.7.0 and 1.6.4, there the same
> issue exists.
>
> Hope this make sense.
>
> Regards,
> Frederik Hansen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>