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

Dimuthu Gamage resolved AXIS2C-769.
-----------------------------------


Fixed in the Axis2/Java svn revision 598207

Please see the attachment of the AXIS2C-753 Jira to the relevant test case,

> Program crashes if optional attributes are not provided
> -------------------------------------------------------
>
>                 Key: AXIS2C-769
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-769
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: code generation
>    Affects Versions: Current (Nightly)
>         Environment: Windows + UNIX
>            Reporter: Michael Mole
>            Priority: Critical
>
> This is similar to AXIS2C-753.
> The generated serialize method of this complex type assumes that attributes 
> will be provided even if the WSDL specifies them as Optional.  If the WSDL 
> specifies an attribute as required, there should be some error checking that 
> provides a useful error message if it is not supplied.  Currently, the 
> program will just crash.
> I have a complex type defined as follows:
>   <complexType name="Foo">
>       <sequence>
>           <element name="my_element" type="anyType" minOccurs="0">
>           </element>
>       </sequence>
>       <attribute name="property" use="required" type="QName">
>       </attribute>
>       <attribute name="length" type="unsignedInt" use="optional">
>       </attribute>
>    </complexType>
> The generated code around both attributes looks like this:
>     text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof 
> (axis2_char_t) * (64 + strlen("length")));
>     sprintf(text_value, " ns2:length=\"%d\"", _Foo->property_length);
>     axutil_stream_write(stream, env, text_value, axutil_strlen(text_value));
>     AXIS2_FREE(env-> allocator, text_value);
> For the length attribute, this should check and only try to write to the 
> stream if the length was provided:
> Ex.
>     if ( _Foo->property_length != NULL ) {
>         ...write to stream...
>     }
> For the property attribute, this should check if the attribute was provided 
> and return an error if it was not.
> Ex.
>     if ( _Foo->property_property == NULL ) {
>         return Error;
>     }
>     else {
>         ... write to stream ...
>     }

-- 
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