axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samisa Abeysinghe (JIRA)" <axis-c-...@ws.apache.org>
Subject [jira] Commented: (AXISCPP-465) Bug in SoapSerializer::addOutputParam
Date Thu, 31 Mar 2005 08:16:22 GMT
     [ http://issues.apache.org/jira/browse/AXISCPP-465?page=comments#action_61873 ]
     
Samisa Abeysinghe commented on AXISCPP-465:
-------------------------------------------

Fixing this at the generated wrapper code level is the easiest but that leavs us with memory
leaks.
Doing this at the Param class level is the cleanest but that means lots of work at this point
in time.

I propose that we do this at generated wrapper level as proposed and fix the problems at Param
level later.

> Bug in SoapSerializer::addOutputParam
> -------------------------------------
>
>          Key: AXISCPP-465
>          URL: http://issues.apache.org/jira/browse/AXISCPP-465
>      Project: Axis-C++
>         Type: Bug
>   Components: Serialization
>     Reporter: Roshan Weerasuriya
>     Assignee: Roshan Weerasuriya

>
> hi Adrian and All,
> (Adrian this is related to a change which you have done recently)
> There is a problem in SoapSerializer::addOutputParam method. But this is actualy not
a bug in this method even though I say so, that is because the following scenario.
> This is the current method...
> int SoapSerializer::addOutputParam(const AxisChar* pchName, void* pValue, 
>                                    XSDTYPE type)
> {
> ...
> ....
>   case XSD_INT:
>   case XSD_BOOLEAN:
>         pParam->m_Value.nValue = (int*)(pValue);
>         break; 
> Now the generated server side wrapper has the following code.
> int CalculatorWrapper::add(void* pMsg)
> {
> ...
> .....
> try
> {
> xsd__int ret = pWs->add(v0,v1);
> return pIWSSZ->addOutputParam("addReturn", (void*)&ret, XSD_INT); //This is wrong
because ret is a 
>                                                                    //local variable and
we pass the 
>                                                                    //address of this
to the method 
> }
> catch(...){
> }
> }
> My Suggestion:
> ==============
> There are two ways to tacke this problem.
> method 1)
> Change the SoapSerializer::addOutputParam() method as following.
> ...
> .....
> case XSD_INT:
> case XSD_BOOLEAN:
> 	//----added by roshan---
> 	{
> 	pParam->m_Value.nValue = new int();
>         *pParam->m_Value.nValue = *(int*)(pValue);
> 	//----end added by roshan---        
> 	}
>         break; 
> method 2)
> Change the wrapper generation to some thing like following:
> int CalculatorWrapper::add(void* pMsg)
> {
> ...
> .....
> try
> {
> xsd__int ret = pWs->add(v0,v1);
> xsd__int* ret2 = new xsd__int(sizeof(ret));
> *ret2 = ret;
> return pIWSSZ->addOutputParam("addReturn", (void*)ret2, XSD_INT);
> I prefer solution method2 because it doesn't look nice and doesn't look more readable
to send a local variables address to a another method, any ideas please...

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message