[ 
https://issues.apache.org/jira/browse/AXIS2C-753?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dimuthu Gamage updated AXIS2C-753:
----------------------------------

    Attachment: case19.tar.gz

Fixed in the Axis2/Java svn commit 598206 and 598207.
There introduces new functions to set nillable.

When serializing, if the value of sub element 'x' is not valid

 x will not be serialized, if minOccurs=0
 x will not be serialized if both nillable=true and minOccurs=0
 x will be serialized as <x 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:nil="1" /> if 
nillable=true and minOccurs not 0
 returns error if neither minOccurs=0 nor nillable=true

Thanks
Dimuthu

> Program crashes if optional elements are not provided
> -----------------------------------------------------
>
>                 Key: AXIS2C-753
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-753
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: code generation
>    Affects Versions: 1.1.0
>            Reporter: Michael Mole
>            Priority: Critical
>         Attachments: case19.tar.gz
>
>
> I am using the code generation tool from approx. 11/1/2007 Axis2/Java nightly 
> snapshot.  I am using it to generate C databindings
> My generated adb databinding code is writing elements in the serialize method 
> even when minOccurs="0".  I think if anything has a minOccurs="0", the 
> generated serialize should check if the element has been provided by 
> surrounding the code block with an "if ( foo-element !- NULL )".  Otherwise, 
> the program will crash if the optional element has not been provided. 
> I have a datatype defined as follows:
>   <complexType name="Foo">
>     <sequence>
>       <element name="foo-element" type="foo_type"
>           minOccurs="0">
>       </element>
>     </sequence>
>   </complexType>
> In my serialize method I'm seeing something like this:
>                         start_input_str = "<ns2:foo-element";
>                             
>                         start_input_str_len = axutil_strlen(start_input_str);
>                         end_input_str = "</ns2:foo-element>";
>                         end_input_str_len = axutil_strlen(end_input_str);
>                      
>                             axutil_stream_write(stream, env, start_input_str, 
> start_input_str_len);
>                             
>                             adb_foo-element_serialize(_Foo->foo-element, 
>                                                                               
>    env, current_node,
>                                       AXIS2_FALSE
>                                     );
>                             
>                             axutil_stream_write(stream, env, end_input_str, 
> end_input_str_len);

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to