axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject svn commit: r376753 - /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java
Date Fri, 10 Feb 2006 16:14:48 GMT
Author: dicka
Date: Fri Feb 10 08:14:47 2006
New Revision: 376753

URL: http://svn.apache.org/viewcvs?rev=376753&view=rev
Log:
AXISCPP-149

Correct some memory issues in generated service wrapper for rpc/encoded.
Included some formatting tidy-up.

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java?rev=376753&r1=376752&r2=376753&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java Fri
Feb 10 08:14:47 2006
@@ -288,17 +288,26 @@
         writer.write("\tint nStatus;\n");
         writer.write("\tIWrapperSoapSerializer* pIWSSZ = NULL;\n");
         writer.write("\tmc->getSoapSerializer(&pIWSSZ);\n");
-        writer.write("\tif (!pIWSSZ) return AXIS_FAIL;\n");
+        writer.write("\tif (!pIWSSZ)\n");
+        writer.write("\t{\n");
+        writer.write("\t\treturn AXIS_FAIL;\n");
+        writer.write("\t}\n");
         writer.write("\tIWrapperSoapDeSerializer* pIWSDZ = NULL;\n");
         writer.write("\tmc->getSoapDeSerializer(&pIWSDZ);\n");
-        writer.write("\tif (!pIWSDZ) return AXIS_FAIL;\n");
+        writer.write("\tif (!pIWSDZ)\n");
+        writer.write("\t{\n");
+        writer.write("\t\treturn AXIS_FAIL;\n");
+        writer.write("\t}\n");
         writer.write("\t/* check whether we have got correct message */\n");
         writer.write(
             "\tif (AXIS_SUCCESS != pIWSDZ->checkMessageBody(\""
                 + minfo.getMethodname()
                 + "\", \""
                 + wscontext.getWrapInfo().getTargetNameSpaceOfWSDL()
-                + "\")) return AXIS_FAIL;\n");
+                + "\"))\n");
+        writer.write("\t{\n");
+        writer.write("\t\treturn AXIS_FAIL;\n");
+        writer.write("\t}\n");
         writer.write(
             "\tpIWSSZ->createSoapMethod(\""
         		//Chinthana:Fixed for AXISCPP-378 
@@ -332,48 +341,83 @@
             	{
             		if (CUtils.isPointerType(param.getLangName()))
             		{
-
-		                writer.write("\t"
-								+ paraTypeName
-								+ " v"
-								+ i
-								+ " = pIWSDZ->"
-								+ CUtils.getParameterGetValueMethodName(paraTypeName, false)
-								+ "(\""
-								+ parameterName + "\",0);\n");
-            		}
+            		    writer.write("\n\t" + paraTypeName + " v" + i + " = NULL;\n");
+	        			writer.write("\t"
+	                            + paraTypeName
+	                            + " value"
+	                            + i
+	                            + " = pIWSDZ->"
+	                            + CUtils.getParameterGetValueMethodName(paraTypeName, false)
+	                            + "(\""
+	                            + parameterName + "\",0);\n");
+            			writer.write("\tif (value" + i + ")\n");
+            			writer.write("\t{\n");
+            			writer.write("\t\tv" + i + " = new char[ strlen( value" + i + " ) + 1 ];\n");
+            			writer.write("\t\tstrcpy( v" + i + ", value" + i + " );\n");
+            			writer.write("\t\tAxis::AxisDelete( (void *) value" + i + ", " + CUtils.getXSDTypeForBasicType(paraTypeName)
+ ");\n");
+            			writer.write("\t}\n");
+        			}
             		else
             		{
+            		    writer.write("\n\t" + paraTypeName + " * v" + i + " = NULL;\n");
             			writer.write("\t"
 								+ paraTypeName
-								+ "* v"
+								+ "* pValue"
 								+ i
 								+ " = pIWSDZ->"
 								+ CUtils.getParameterGetValueMethodName(paraTypeName, false)
 								+ "(\""
 								+ parameterName + "\",0);\n");
+            			writer.write("\tif (pValue" + i + ")\n");
+            			writer.write("\t{\n");
+            			writer.write("\t\tv" + i + " = new " + paraTypeName + "();");
+            			writer.write("\t\t*v" + i + " = *pValue" + i + ";\n");
+            			writer.write("\t\tAxis::AxisDelete( (void *) pValue" + i + ", " + CUtils.getXSDTypeForBasicType(paraTypeName)
+ ");\n");
+            			writer.write("\t}\n");
             		}
             	}
             	else
             	{
             		if (CUtils.isPointerType(param.getLangName()))
+            		{
+            		    writer.write("\n\t" + paraTypeName + " v" + i + " = NULL;\n");
             			writer.write("\t"
                             + paraTypeName
-                            + " v"
+                            + " value"
                             + i
                             + " = pIWSDZ->"
                             + CUtils.getParameterGetValueMethodName(paraTypeName, false)
                             + "(\""
                             + parameterName + "\",0);\n");
+            			writer.write("\tif (value" + i + ")\n");
+            			writer.write("\t{\n");
+            			writer.write("\t\tv" + i + " = new char[ strlen( value" + i + " ) + 1 ];\n");
+            			writer.write("\t\tstrcpy( v" + i + ", value" + i + " );\n");
+            			writer.write("\t\tAxis::AxisDelete( (void *) value" + i + ", " + CUtils.getXSDTypeForBasicType(paraTypeName)
+ ");\n");
+            			writer.write("\t}\n");
+            		}
             		else
+            		{
+            		    writer.write("\n\t" + paraTypeName + " v" + i);
+            		    if (!"xsd__base64Binary".equals(paraTypeName) && !"xsd__hexBinary".equals(paraTypeName)
)
+            		    {
+            		        writer.write(" = " + CUtils.getInitValue(paraTypeName));
+            		    }
+            		    writer.write(";\n");
 	            		writer.write("\t"
 							+ paraTypeName
-							+ " v"
+							+ " * pValue"
 							+ i
-							+ " = *(pIWSDZ->"
+							+ " = pIWSDZ->"
 							+ CUtils.getParameterGetValueMethodName(paraTypeName, false)
 							+ "(\""
-							+ parameterName + "\",0));\n");
+							+ parameterName + "\",0);\n");
+	            		writer.write("\tif (pValue" + i + ")\n");
+	            		writer.write("\t{\n");
+	            		writer.write("\t\tv" + i + " = *pValue" + i + ";\n");
+	            		writer.write("\t\tAxis::AxisDelete( (void *) pValue" + i + ", " + CUtils.getXSDTypeForBasicType(paraTypeName)
+ " );\n");
+	            		writer.write("\t}\n");
+            		}
             	}
             }
             else
@@ -389,7 +433,7 @@
                     {
                         containedType = CUtils.getclass4qname(qname);
                         
-                        writer.write("\t" + containedType + "_Array * v" + i +" = new " +
containedType + "_Array();\n");
+                        writer.write("\n\t" + containedType + "_Array * v" + i +" = new "
+ containedType + "_Array();\n");
                         writer.write(
                             "\t"
                                 + "Axis_Array * RetArray"
@@ -427,7 +471,7 @@
                 {
                     //for complex types 
                     writer.write(
-                        "\t"
+                        "\n\t"
                             + paraTypeName
                             + " *v"
                             + i
@@ -446,8 +490,10 @@
                             + ");\n");
                 }
         }
-        writer.write(
-            "\tif (AXIS_SUCCESS != (nStatus = pIWSDZ->getStatus())) return nStatus;\n");
+        writer.write("\tif (AXIS_SUCCESS != (nStatus = pIWSDZ->getStatus()))\n");
+        writer.write("\t{\n");
+        writer.write("\t\treturn nStatus;\n");
+        writer.write("\t}\n");
         // Multiples parameters so fill the methods prototype
         if (isAllTreatedAsOutParams)
         {
@@ -712,8 +758,10 @@
                 writeExceptions(faultType, faultInfoName, paramName, langName);
             }
         }
-        writer.write("\tcatch(...){\n"); //nithya
-        writer.write("\t}\n"); //nithya
+        writer.write("\tcatch(...)\n");
+        writer.write("\t{\n");
+        writer.write("\t\treturn AXIS_FAIL;\n");
+        writer.write("\t}\n");
         //write end of method
         writer.write("}\n");
     }
@@ -755,6 +803,7 @@
                     + ");\n");
             writer.write("\t\tthrow AxisServiceException(AXISC_SERVICE_THROWN_EXCEPTION);\n");
             writer.write("\t\t}\n");
+            writer.write("\t\treturn AXIS_FAIL;\n");
             writer.write("\t}\n");
             writer.write("\n");
         }



Mime
View raw message