Hi Davide,

No general way of handling exceptions, but you can use a custom 
deserializer to handle this case. The deserializer should check first 
for a null value (meaning the element was missing, if it's optional) 
then for an empty string. You can either apply your own deserializer on 
a case-by-case basis in the binding, or just make it the default for int 
values by using a <format>.

See 
http://jibx.sourceforge.net/binding/tutorial/binding-extend.html#serdeser

  - Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



mr.abanjo wrote:
> Hi,
> i'm trying to unmarshall a xml document that have an empty value for a 
> Integer property.
>
> JMX binding
> ....
> <value name="minchar" field="minChar" />
> ....
>
> XML
> ....
> <minchar><![CDATA[]]></minchar>
> ....
>
>
> When i try to unmarshall it, JIBX give me an error:
>
> java.lang.NumberFormatException: For input string: ""
>
> There is a way to assign a default value in this case and generally 
> when an exception occur?
> I've tryed with "default" attribute but without success.
>
> Thanks
> Davide
>
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ------------------------------------------------------------------------
>
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>   

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to