axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Trevisan (JIRA)" <>
Subject [jira] Commented: (AXIS2-3353) Use wrapper types when elements are optional (i.e.: nillable="true" or minOccurs="0"/maxOccurs="1")
Date Tue, 20 Nov 2007 17:17:45 GMT


Marco Trevisan commented on AXIS2-3353:

I'm voting for this issue to be resolved.

When a value is nillable, replacing null occurrences with special (and not-so-special in case
of boolean types) values is an information loss, and the application code needs to be reworked
in order to guess if an input value could have been null. This is especially true with nillable
boolean types, where the user code has no way to verify that a false value is either a real
"false" or null. 
It's definitely the application's work to interpret null values, not axis' work. 

We can easily produce examples where the placeholder values chosen here are also valid values
in the application:

If I read from a table the nillable field "EvaluatedSummaryIsGood", whose contract is: 
1) true: the summary has been evaluated and its value is good;
2) false: the summary has been evaluated and its value is NOT good;
3) null: the summary has not been evaluated yet.

my business logic needs to read nulls instead of  "false".

If I read from a table the nillable int field "AlgebricSumWithSaturation", whose contract
1) any integer value resulting from the sum of N terms, supporting value saturation, when
such sum has already been done
2) null, if the sum has yet to be done

the Integer.MIN_VALUE is pretty useful for me.

As you can tell, we can go on with as many examples as we want...

Best regards, 

> Use wrapper types when elements are optional (i.e.: nillable="true" or minOccurs="0"/maxOccurs="1")
> ---------------------------------------------------------------------------------------------------
>                 Key: AXIS2-3353
>                 URL:
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>    Affects Versions: 1.3
>            Reporter: Mauro Molinari
>            Priority: Critical
> As of now, Axis2 WSDL2Java uses some weird convetion about "null".
> I mean, when an element in a WSDL is marked as nillable="true" or minOccurs="0"/maxOccurs="1",
the generated Java code still uses primitives types such as int, double, short, long, float,
> Because of this, I personally experienced (and also read about here in JIRA), Axis2 uses
the following questionable convention to handle null values:
> int, short, long => Integer.MIN_VALUE, Short.MIN_VALUE, Long. MIN_VALUE
> float, double => Float.NaN, Double.NaN
> boolean => false
> Actually, these values are NOT null.
> I think Axis2 should map optional elements of type xsd:int, xsd:double, xsd:float, xsd:short,
xsd:long, xsd:boolean to, respectively: Integer, Double, Float, Short, Long, Boolean and assign
null to them when they are specified as nil or when they are not specified in the SOAP message.
> If I understood it well, Axis1 did this, didn't it?
> At least, I think Axis2 should give an option to enable this and, IMHO, I also think
it should be on by default...

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message