Re: WSDL2Java Integer.MIN_VALUE for optional xsd:int

2008-03-09 Thread Amila Suriarachchi
On Thu, Mar 6, 2008 at 11:18 PM, ahong <[EMAIL PROTECTED]> wrote:

>
> I'm migrating from Axis2 1.1 to 1.3 and notice that WSDL2Java, with adb,
> will
> set an optional xsd:int element value to Integer.MIN_VALUE if it's absent.
> This is a change from the previous in 1.1, which is uninitialized and
> defined by the language (in this case the uninitialized int has value 0).
> Can someone please explain the rationale for this change, since it breaks
> my
> code which assumes a 0 for default.


This is the reason for this.

if your element is optional then their is a possibility to receive a Xml
null value to your element
i.e xsi:nil="true"
So if we use 0 for received null values then you don't know that whether you
received a null or a 0.

So when receiving a null it sets to Integer.MIN_VALUE then you know you have
received an XML null value.

Here in xml even it is possible to receive null values for primitive types.

But if you use jdk 1.5 better to use the Wrapped type elements as Mauro has
said.

thanks,
Amila.

>
>
> I can change the WSDL to have a default value for optional element, but
> it's
> still a bug that default value setting in the WSDL has no effect at
> runtime,
> e.g.,
>   default="10" />
> does not initialize localSkipInterval to 10 as expected.
>
> %%
> --
> View this message in context:
> http://www.nabble.com/WSDL2Java-Integer.MIN_VALUE-for-optional-xsd%3Aint-tp15879664p15879664.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.


Re: WSDL2Java Integer.MIN_VALUE for optional xsd:int

2008-03-07 Thread ahong

Thanks for the reply.  Please note that I've file a JIRA Axis2-3579 which
includes a proposed fix.
-- 
View this message in context: 
http://www.nabble.com/WSDL2Java-Integer.MIN_VALUE-for-optional-xsd%3Aint-tp15879664p15901236.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: WSDL2Java Integer.MIN_VALUE for optional xsd:int

2008-03-07 Thread Mauro Molinari

ahong ha scritto:

I'm migrating from Axis2 1.1 to 1.3 and notice that WSDL2Java, with adb, will
set an optional xsd:int element value to Integer.MIN_VALUE if it's absent. 
This is a change from the previous in 1.1, which is uninitialized and
defined by the language (in this case the uninitialized int has value 0). 
Can someone please explain the rationale for this change, since it breaks my

code which assumes a 0 for default.

I can change the WSDL to have a default value for optional element, but it's
still a bug that default value setting in the WSDL has no effect at runtime,
e.g.,
 
does not initialize localSkipInterval to 10 as expected.

%%


I never agreed with the Integer.MIN_VALUE convention adopted in Axis2, 
so I opened a bug some time ago:

https://issues.apache.org/jira/browse/AXIS2-3353

In a recent Axis2 nightly build, you can use WSDL2Java -Euwc parameter 
so that optional parameters (those with minOccurs="0" or nillable="true" 
attributes) are translated into Integer rather than int and they are set 
to null if not specified.


Please note that your project must use a Java5 compiler to compile ADB 
code generated with -Euwc parameter.


Cheers.

--
Mauro Molinari
Software Developer
[EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



WSDL2Java Integer.MIN_VALUE for optional xsd:int

2008-03-06 Thread ahong

I'm migrating from Axis2 1.1 to 1.3 and notice that WSDL2Java, with adb, will
set an optional xsd:int element value to Integer.MIN_VALUE if it's absent. 
This is a change from the previous in 1.1, which is uninitialized and
defined by the language (in this case the uninitialized int has value 0). 
Can someone please explain the rationale for this change, since it breaks my
code which assumes a 0 for default.

I can change the WSDL to have a default value for optional element, but it's
still a bug that default value setting in the WSDL has no effect at runtime,
e.g.,
 
does not initialize localSkipInterval to 10 as expected.

%%
-- 
View this message in context: 
http://www.nabble.com/WSDL2Java-Integer.MIN_VALUE-for-optional-xsd%3Aint-tp15879664p15879664.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]