axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Dick (JIRA)" <axis-c-...@ws.apache.org>
Subject [jira] Commented: (AXISCPP-863) In the stub generated code, an 'OUT' parameter may be null. Before trying to copy the contents a test should be done on the size of the object.
Date Fri, 16 Dec 2005 13:59:46 GMT
    [ http://issues.apache.org/jira/browse/AXISCPP-863?page=comments#action_12360575 ] 

Adrian Dick commented on AXISCPP-863:
-------------------------------------

Following the recent modification to AXISCPP-149 for arrays, and some tidy-up of outparams,
I would expect this to now be resolved.

The testcase ElementFormDefaultTest has an example of a complex array as an outparam - if
you could take a look at this to confirm it is generating the appropriate code.

> In the stub generated code, an 'OUT' parameter may be null.  Before trying to copy the
contents a test should be done on the size of the object.
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: AXISCPP-863
>          URL: http://issues.apache.org/jira/browse/AXISCPP-863
>      Project: Axis-C++
>         Type: Bug
>   Components: Client - Stub
>  Environment: n/a
>     Reporter: Fred Preston

>
> For example:-
> Axis_Array arr2 = m_pCall->getCmplxArray((void*) Axis_DeSerialize_Items,
>                                                                                (void*)
Axis_Create_Items,
>                                                                                (void*)
Axis_Delete_Items,
>                                                                                (void*)
Axis_GetSize_Items,
>                                                                                "Items",
>                                                                                Axis_URI_Items);
> *OutValue1 = (Items_Array&) arr2;
> Becomes:-
> Axis_Array arr2 = m_pCall->getCmplxArray((void*) Axis_DeSerialize_Items,
>                                                                                (void*)
Axis_Create_Items,
>                                                                                (void*)
Axis_Delete_Items,
>                                                                                (void*)
Axis_GetSize_Items,
>                                                                                "Items",
>                                                                                Axis_URI_Items);
> if( arr2.m_Size > 0)
> {
>     *OutValue1 = (Items_Array&) arr2;
> }
> Where an 'if' is used to check that there is data to copy before trying to copy a null
pointer (NB: It is assumed that the pointer to the output parameter passed to the method has
already been set to null by the client application otherwise, on return the client code will
not know if OutValue1 contains valid data).
> OR, to be completely safe...
> if( arr2.m_Size > 0)
> {
>     *OutValue1 = (Items_Array&) arr2;
> }
> else
> {
>     OutValue1->m_Size = 0;
>     OutValue1->m_Array = NULL;
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message