Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
Linux V. 10.0, Apache Axis2 SNAPSHOT build May 16th, 2007
Description
I raised this JIRA first under the Axis2 topic (as I thought generation takes place there) but it was rejected and I was asked to re-JIRA it here.
#######################################
I guess I found a problem in generated sources. I try to get in touch with Axis and play around with all the things... I have a service that returns an array of structures that contain all possible datatypes - also float and double.
I used this class for generating the wsdl:
public class Dat{
public long l;
public short s;
public int i;
public String str;
public float fl;
public double dl;
}
The generated wsdl shows
<xs:element name="Dat" type="ns:Dat" />
<xs:complexType name="Dat">
<xs:sequence>
<xs:element name="dl" type="xs:double" />
<xs:element name="fl" type="xs:float" />
<xs:element name="i" type="xs:int" />
<xs:element name="str" nillable="true" type="xs:string" />
<xs:element name="l" type="xs:long" />
<xs:element name="s" type="xs:short" />
</xs:sequence>
</xs:complexType>
When you generate C-Server stubs the constructor function
shows:
AXIS2_EXTERN axis2_Dat_t* AXIS2_CALL
axis2_Dat_create(
const axutil_env_t *env )
{
axis2_Dat_t *Dat = NULL;
AXIS2_ENV_CHECK(env, NULL);
Dat = (axis2_Dat_t *) AXIS2_MALLOC(env->
allocator, sizeof(axis2_Dat_t));
/* *********** missing ***********
- memset( Dat, 0, sizeof(axis2_Dat_t));
- ********************************
*/
if(NULL == Dat)
{ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } return Dat;
}
For more safety it would be desirable if the generation would add the memset() call. Alternatively it could be possible to use an allocation method that leaves the allocated memory initialized.... (calloc() ?)