ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cblec...@apache.org
Subject cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal BeanParamWriter.java
Date Tue, 28 Jun 2005 18:23:20 GMT
cblecken    2005/06/28 11:23:20

  Modified:    c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal
                        BeanParamWriter.java
  Log:
  Addressing the client data memory leak issues as for example in
  AXISCPP-674. This was tested with a subset of the data types
  on Windows using Purify.
  
  PR: AXISCPP-674
  Submitted by:	Carsten Blecken
  
  Revision  Changes    Path
  1.78      +38 -41    ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
  
  Index: BeanParamWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- BeanParamWriter.java	17 Jun 2005 08:11:15 -0000	1.77
  +++ BeanParamWriter.java	28 Jun 2005 18:23:20 -0000	1.78
  @@ -955,10 +955,12 @@
                                   + " = pIWSDZ->"
                                   + CUtils.getParameterGetValueMethodName(
                                           attribs[i].getTypeName(), attribs[i].isAttribute())
+ "( \""
  -                                + soapTagName + "\",0)) != NULL)\n");
  +                                + soapTagName + "\",0)) != NULL) {\n");
                           writer.write("\t\tparam->"
                                   + attribs[i].getParamNameAsMember() + " = *( "
                                   + attribs[i].getParamNameAsMember() + " );\n");
  +                        writer.write("\t\tdelete " + attribs[i].getParamNameAsMember()
+ ";\n");
  +                        writer.write("\t}\n");
                           //                                        writer.write("\t\tdelete
" +
                           // attribs[i].getParamNameAsMember()+";\n");
                       }
  @@ -1154,46 +1156,41 @@
               // Adrian - seeing problems of losing data when clearing up,
               // so temporarily remove this section, until such time as a better
               // solution is found
  -            //		for(int i = 0; i< attribs.length;i++){
  -            //			if(attribs[i].isArray()){
  -            //				if ( attribs[i].isSimpleType())
  -            //				{
  -            //					writer.write("\tdelete []
  -            // (("+attribs[i].getTypeName()+"*)"+attribs[i].getParamNameAsMember()+".m_Array);\n");
  -            //				}
  -            //				else
  -            //				{
  -            //					if( isNillable())
  -            //					{
  -            //						writer.write("\tdelete
  -            // "+attribs[i].getParamNameAsMember()+".m_Array;\n");
  -            //					}
  -            //					else
  -            //					{
  -            //						writer.write("\tdelete []
  -            // (("+attribs[i].getTypeName()+"*)"+attribs[i].getParamNameAsMember()+".m_Array);\n");
  -            //					}
  -            //				}
  -            //			}
  -            //			else if (attribs[i].isAnyType()){
  -            //				writer.write("\tif ("+attribs[i].getParamNameAsMember()+") \n\t{
  -            // \n");
  -            //				writer.write("\t\tfor (int i=0;
  -            // i<"+attribs[i].getParamNameAsMember()+"->_size; i++)\n\t\t{\n");
  -            //				writer.write("\t\t\tif
  -            // ("+attribs[i].getParamNameAsMember()+"->_array[i]) delete []
  -            // "+attribs[i].getParamNameAsMember()+"->_array[i];\n");
  -            //				writer.write("\t\t}\n");
  -            //				writer.write("\t\tdelete
  -            // "+attribs[i].getParamNameAsMember()+";\n");
  -            //				writer.write("\t}\n");
  -            //				
  -            //			}
  -            //			else if (!attribs[i].isSimpleType()){
  -            //				writer.write("\tdelete
  -            // "+attribs[i].getParamNameAsMember()+";\n");
  -            //			}
  -            //		}
  +            for(int i = 0; i< attribs.length;i++){
  +            	if(attribs[i].isArray()){
  +            		if ( attribs[i].isSimpleType())
  +            		{
  +            			writer.write("\tdelete [] (("+attribs[i].getTypeName()+"*)"+attribs[i].getParamNameAsMember()+".m_Array);\n");
  +            				}
  +            				else
  +            				{
  +            					if( isNillable())
  +            					{
  +            						writer.write("\tdelete "+attribs[i].getParamNameAsMember()+".m_Array;\n");
  +            					}
  +            					else
  +            					{
  +            						writer.write("\tdelete [] (("+attribs[i].getTypeName()+"*)"+attribs[i].getParamNameAsMember()+".m_Array);\n");
  +            					}
  +            				}
  +            			}
  +            			else if (attribs[i].isAnyType()){
  +            				writer.write("\tif ("+attribs[i].getParamNameAsMember()+") \n\t{\n");
  +            				writer.write("\t\tfor (int i=0; i<"+attribs[i].getParamNameAsMember()+"->_size;
i++)\n\t\t{\n");
  +            				writer.write("\t\t\tif ("+attribs[i].getParamNameAsMember()+"->_array[i])
delete [] "+attribs[i].getParamNameAsMember()+"->_array[i];\n");
  +            				writer.write("\t\t}\n");
  +            				writer.write("\t\tdelete "+attribs[i].getParamNameAsMember()+";\n");
  +            				writer.write("\t}\n");
  +            				
  +            			}
  +            			else if (!attribs[i].isSimpleType()){
  +            				writer.write("\tdelete "+attribs[i].getParamNameAsMember()+";\n");
  +            			} else if (CUtils.isPointerType(attribs[i].getTypeName())) {
  +            				// found pointer type
  +            				// System.out.println("Pointer type found " + attribs[i].getTypeName()
+ " " + attribs[i].getParamNameAsMember());
  +            				writer.write("\tdelete "+attribs[i].getParamNameAsMember()+";\n");
  +            			}
  +            		}
               writer.write("}\n");
           }
           catch (IOException e)
  
  
  

Mime
View raw message