Hi,

 

I am trying to use JiBX to marshal an object containing an array. Some
elements of the array are null. This results in null pointer exceptions
in the marshalling code.

 

My original mapping looked like this:

 

    <!-- Mapping for com.cisco.nm.acs.im.common.EnumDefinition -->
    <mapping name="EnumDefinition"
class="com.cisco.nm.acs.im.common.EnumDefinition"
extends="com.cisco.nm.acs.im.common.PredefinedValueDefinition">
        <structure
map-as="com.cisco.nm.acs.im.common.PredefinedValueDefinition"/>
        <structure name="enumValues" usage="optional">
            <collection field="enumValues" usage="optional"/>
        </structure>
    </mapping>

I realised that although the collection itself was marked as optional
the elements of it weren't. Since the elements of the array were a
single type, I modified the mapping as follows:

 

    <!-- Mapping for com.cisco.nm.acs.im.common.EnumDefinition -->
    <mapping name="EnumDefinition"
class="com.cisco.nm.acs.im.common.EnumDefinition"
extends="com.cisco.nm.acs.im.common.PredefinedValueDefinition">
        <structure
map-as="com.cisco.nm.acs.im.common.PredefinedValueDefinition"/>
        <structure name="enumValues" usage="optional">
            <collection field="enumValues" usage="optional">
                <structure type="com.cisco.nm.acs.im.common.EnumValue"
usage="optional"/>
            </collection>
        </structure>
    </mapping>

However, I am still getting null pointer exceptions, so this approach
didn't work. Is it possible in JiBX to marshal an array with null
elements or do I need to remove those elements prior to marshalling?

 

Thanks,

 

Ian Cotton.

 

 

 

Ian Cotton
Software Engineer
Product Development

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
Phone :+44-20-8824-9219
Mobile :+44-7730-304406



United Kingdom
www.cisco.com/global/UK/ <http://www.cisco.com/global/UK/> 

 

 

This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.




 

<<image001.gif>>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to