You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/11/11 18:13:40 UTC

svn commit: r332605 - in /webservices/axis/trunk/c: include/axis/ src/common/ src/engine/ src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ tests/auto_build/testcases/client/cpp/

Author: dicka
Date: Fri Nov 11 09:13:30 2005
New Revision: 332605

URL: http://svn.apache.org/viewcvs?rev=332605&view=rev
Log:
Further updates to resolve Jira issue AXISCPP-149. 

This update resolves memory leaks when handling arrays of complex types.

Modified:
    webservices/axis/trunk/c/include/axis/AxisUserAPI.hpp
    webservices/axis/trunk/c/include/axis/AxisUserAPIArrays.hpp
    webservices/axis/trunk/c/src/common/AxisUserAPI.cpp
    webservices/axis/trunk/c/src/engine/Axis.cpp
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ArrayParamHeaderWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ArrayParamWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ArraysClient.cpp

Modified: webservices/axis/trunk/c/include/axis/AxisUserAPI.hpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/include/axis/AxisUserAPI.hpp?rev=332605&r1=332604&r2=332605&view=diff
==============================================================================
--- webservices/axis/trunk/c/include/axis/AxisUserAPI.hpp (original)
+++ webservices/axis/trunk/c/include/axis/AxisUserAPI.hpp Fri Nov 11 09:13:30 2005
@@ -369,6 +369,7 @@
     void** m_Array; // Array of pointers to array elements
     int m_Size; // Size of array
     XSDTYPE m_Type; // XSD datatype within this array
+    bool m_belongsToAxisEngine;
 };
 
 #define AXIS_OUT_PARAM 

Modified: webservices/axis/trunk/c/include/axis/AxisUserAPIArrays.hpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/include/axis/AxisUserAPIArrays.hpp?rev=332605&r1=332604&r2=332605&view=diff
==============================================================================
--- webservices/axis/trunk/c/include/axis/AxisUserAPIArrays.hpp (original)
+++ webservices/axis/trunk/c/include/axis/AxisUserAPIArrays.hpp Fri Nov 11 09:13:30 2005
@@ -51,6 +51,11 @@
     xsd__duration_Array(xsd__duration_Array & original);
     
     /**
+     * Destructor
+     */
+    ~xsd__duration_Array();
+    
+    /**
      * Populate the array from a c-style array
      * 
      * @param array is a c-style array of pointers to the xsd_duration data.
@@ -81,6 +86,11 @@
     xsd__dateTime_Array(xsd__dateTime_Array & original);
     
     /**
+     * Destructor
+     */
+    ~xsd__dateTime_Array();
+    
+    /**
      * Populate the array from a c-style array
      * 
      * @param array is a c-style array of pointers to the xsd_duration data.
@@ -109,6 +119,11 @@
      * @param orginal Axis_Array to copy.
      */
     xsd__time_Array(xsd__time_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__time_Array();
     
     /**
      * Populate the array from a c-style array
@@ -139,6 +154,11 @@
      * @param orginal Axis_Array to copy.
      */
     xsd__date_Array(xsd__date_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__date_Array();
     
     /**
      * Populate the array from a c-style array
@@ -169,6 +189,12 @@
      * @param orginal Axis_Array to copy.
      */
     xsd__gYearMonth_Array(xsd__gYearMonth_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__gYearMonth_Array();
+    
     
     /**
      * Populate the array from a c-style array
@@ -199,6 +225,11 @@
      * @param orginal Axis_Array to copy.
      */
     xsd__gYear_Array(xsd__gYear_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__gYear_Array();
     
     /**
      * Populate the array from a c-style array
@@ -229,6 +260,11 @@
      * @param orginal Axis_Array to copy.
      */
     xsd__gMonthDay_Array(xsd__gMonthDay_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__gMonthDay_Array();
     
     /**
      * Populate the array from a c-style array
@@ -259,6 +295,11 @@
      * @param orginal Axis_Array to copy.
      */
     xsd__gDay_Array(xsd__gDay_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__gDay_Array();
     
     /**
      * Populate the array from a c-style array
@@ -289,6 +330,11 @@
      * @param orginal Axis_Array to copy.
      */
     xsd__gMonth_Array(xsd__gMonth_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__gMonth_Array();
     
     /**
      * Populate the array from a c-style array
@@ -319,6 +365,11 @@
      * @param original xsd__string_Array to copy.
      */
     xsd__string_Array(xsd__string_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__string_Array();
     
     /**
      * Populate the array from a c-style array
@@ -349,6 +400,11 @@
      * @param original xsd__normalizedString_Array to copy.
      */
     xsd__normalizedString_Array(xsd__normalizedString_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__normalizedString_Array();
     
     /**
      * Populate the array from a c-style array
@@ -379,6 +435,11 @@
      * @param original xsd__token_Array to copy.
      */
     xsd__token_Array(xsd__token_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__token_Array();
     
     /**
      * Populate the array from a c-style array
@@ -410,6 +471,12 @@
      */
     xsd__language_Array(xsd__language_Array & original);
     
+        
+    /**
+     * Destructor
+     */
+    ~xsd__language_Array();
+    
     /**
      * Populate the array from a c-style array
      * 
@@ -439,6 +506,11 @@
      * @param original xsd__Name_Array to copy.
      */
     xsd__Name_Array(xsd__Name_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__Name_Array();
     
     /**
      * Populate the array from a c-style array
@@ -469,6 +541,11 @@
      * @param original xsd__NCName_Array to copy.
      */
     xsd__NCName_Array(xsd__NCName_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__NCName_Array();
     
     /**
      * Populate the array from a c-style array
@@ -499,6 +576,11 @@
      * @param original xsd__ID_Array to copy.
      */
     xsd__ID_Array(xsd__ID_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__ID_Array();
     
     /**
      * Populate the array from a c-style array
@@ -529,6 +611,11 @@
      * @param original xsd__IDREF_Array to copy.
      */
     xsd__IDREF_Array(xsd__IDREF_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__IDREF_Array();
     
     /**
      * Populate the array from a c-style array
@@ -559,6 +646,11 @@
      * @param original xsd__IDREFS_Array to copy.
      */
     xsd__IDREFS_Array(xsd__IDREFS_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__IDREFS_Array();
     
     /**
      * Populate the array from a c-style array
@@ -589,6 +681,11 @@
      * @param original xsd__ENTITY_Array to copy.
      */
     xsd__ENTITY_Array(xsd__ENTITY_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__ENTITY_Array();
     
     /**
      * Populate the array from a c-style array
@@ -619,6 +716,11 @@
      * @param original xsd__ENTITIES_Array to copy.
      */
     xsd__ENTITIES_Array(xsd__ENTITIES_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__ENTITIES_Array();
     
     /**
      * Populate the array from a c-style array
@@ -649,6 +751,11 @@
      * @param original xsd__NMTOKEN_Array to copy.
      */
     xsd__NMTOKEN_Array(xsd__NMTOKEN_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__NMTOKEN_Array();
     
     /**
      * Populate the array from a c-style array
@@ -679,6 +786,12 @@
      * @param original xsd__NMTOKENS_Array to copy.
      */
     xsd__NMTOKENS_Array(xsd__NMTOKENS_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__NMTOKENS_Array();
+    
     /**
      * Populate the array from a c-style array
      * 
@@ -708,6 +821,11 @@
      * @param original xsd__boolean_Array to copy.
      */
     xsd__boolean_Array(xsd__boolean_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__boolean_Array();
     
     /**
      * Populate the array from a c-style array
@@ -738,6 +856,11 @@
      * @param original xsd__base64Binary_Array to copy.
      */
     xsd__base64Binary_Array(xsd__base64Binary_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__base64Binary_Array();
     
     /**
      * Populate the array from a c-style array
@@ -768,6 +891,11 @@
      * @param original xsd__hexBinary_Array to copy.
      */
     xsd__hexBinary_Array(xsd__hexBinary_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__hexBinary_Array();
     
     /**
      * Populate the array from a c-style array
@@ -798,6 +926,11 @@
      * @param original xsd__float_Array to copy.
      */
     xsd__float_Array(xsd__float_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__float_Array();
     
     /**
      * Populate the array from a c-style array
@@ -830,6 +963,11 @@
     xsd__decimal_Array(xsd__decimal_Array & original);
     
     /**
+     * Destructor
+     */
+    ~xsd__decimal_Array();
+    
+    /**
      * Populate the array from a c-style array
      * 
      * @param array is a c-style array of pointers to the xsd__decimal data.
@@ -858,6 +996,11 @@
      * @param original xsd__integer_Array to copy.
      */
     xsd__integer_Array(xsd__integer_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__integer_Array();
     
     /**
      * Populate the array from a c-style array
@@ -888,6 +1031,11 @@
      * @param original xsd__nonPositiveInteger_Array to copy.
      */
     xsd__nonPositiveInteger_Array(xsd__nonPositiveInteger_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__nonPositiveInteger_Array();
     
     /**
      * Populate the array from a c-style array
@@ -918,6 +1066,11 @@
      * @param original xsd__negativeInteger_Array to copy.
      */
     xsd__negativeInteger_Array(xsd__negativeInteger_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__negativeInteger_Array();
     
     /**
      * Populate the array from a c-style array
@@ -948,6 +1101,11 @@
      * @param original xsd__long_Array to copy.
      */
     xsd__long_Array(xsd__long_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__long_Array();
     
     /**
      * Populate the array from a c-style array
@@ -978,6 +1136,11 @@
      * @param original xsd__int_Array to copy.
      */
     xsd__int_Array(xsd__int_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__int_Array();
     
     /**
      * Populate the array from a c-style array
@@ -1008,6 +1171,11 @@
      * @param original xsd__short_Array to copy.
      */
     xsd__short_Array(xsd__short_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__short_Array();
     
     /**
      * Populate the array from a c-style array
@@ -1038,6 +1206,11 @@
      * @param original xsd__byte_Array to copy.
      */
     xsd__byte_Array(xsd__byte_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__byte_Array();
     
     /**
      * Populate the array from a c-style array
@@ -1068,6 +1241,11 @@
      * @param original xsd__nonNegativeInteger_Array to copy.
      */
     xsd__nonNegativeInteger_Array(xsd__nonNegativeInteger_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__nonNegativeInteger_Array();
     
     /**
      * Populate the array from a c-style array
@@ -1098,6 +1276,11 @@
      * @param original xsd__unsignedLong_Array to copy.
      */
     xsd__unsignedLong_Array(xsd__unsignedLong_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__unsignedLong_Array();
     
     /**
      * Populate the array from a c-style array
@@ -1128,6 +1311,11 @@
      * @param original xsd__unsignedInt_Array to copy.
      */
     xsd__unsignedInt_Array(xsd__unsignedInt_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__unsignedInt_Array();
     
     /**
      * Populate the array from a c-style array
@@ -1158,6 +1346,11 @@
      * @param original xsd__unsignedByte_Array to copy.
      */
     xsd__unsignedByte_Array(xsd__unsignedByte_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__unsignedByte_Array();
     
     /**
      * Populate the array from a c-style array
@@ -1188,6 +1381,11 @@
      * @param original xsd__unsignedShort_Array to copy.
      */
     xsd__unsignedShort_Array(xsd__unsignedShort_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__unsignedShort_Array();
     
     /**
      * Populate the array from a c-style array
@@ -1218,6 +1416,11 @@
      * @param original xsd__positiveInteger_Array to copy.
      */
     xsd__positiveInteger_Array(xsd__positiveInteger_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__positiveInteger_Array();
     
     /**
      * Populate the array from a c-style array
@@ -1248,6 +1451,11 @@
      * @param original xsd__double_Array to copy.
      */
     xsd__double_Array(xsd__double_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__double_Array();
     
     /**
      * Populate the array from a c-style array
@@ -1278,6 +1486,11 @@
      * @param original xsd__anyURI_Array to copy.
      */
     xsd__anyURI_Array(xsd__anyURI_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__anyURI_Array();
     
     /**
      * Populate the array from a c-style array
@@ -1308,6 +1521,11 @@
      * @param original xsd__QName_Array to copy.
      */
     xsd__QName_Array(xsd__QName_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__QName_Array();
     
     /**
      * Populate the array from a c-style array
@@ -1338,6 +1556,11 @@
      * @param original xsd__NOTATION_Array to copy.
      */
     xsd__NOTATION_Array(xsd__NOTATION_Array & original);
+        
+    /**
+     * Destructor
+     */
+    ~xsd__NOTATION_Array();
     
     /**
      * Populate the array from a c-style array

Modified: webservices/axis/trunk/c/src/common/AxisUserAPI.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/common/AxisUserAPI.cpp?rev=332605&r1=332604&r2=332605&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/common/AxisUserAPI.cpp (original)
+++ webservices/axis/trunk/c/src/common/AxisUserAPI.cpp Fri Nov 11 09:13:30 2005
@@ -65,6 +65,7 @@
     m_Array = NULL;
     m_Size = 0;
     m_Type = XSD_UNKNOWN;
+    m_belongsToAxisEngine = true;
 }
 
 Axis_Array::Axis_Array(Axis_Array & original)
@@ -72,6 +73,7 @@
     m_Array = NULL;
     m_Size = 0;
     m_Type = XSD_UNKNOWN;
+    m_belongsToAxisEngine = true;
     clone(original);
 }
 
@@ -85,6 +87,7 @@
     clear();
     m_Size = size;
     m_Type = type;
+    m_belongsToAxisEngine = true;
     
     if (size == 0)
     {
@@ -658,8 +661,15 @@
 			}
             m_Size = 0;
         }
-        delete [] m_Array;
-        m_Array = NULL;
+        if (m_belongsToAxisEngine == true)
+        {
+            delete [] m_Array;
+        }
+        else
+        {   // Warning!!  This could introduce memory leaks if used incorrectly!!!
+            m_Array = NULL;
+            m_belongsToAxisEngine = true;
+        }
     }
 }
 
@@ -676,6 +686,11 @@
     }
 }
 
+xsd__duration_Array::~xsd__duration_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__duration_Array::set(xsd__duration** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_DURATION);
@@ -700,6 +715,11 @@
     }
 }
 
+xsd__dateTime_Array::~xsd__dateTime_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__dateTime_Array::set(xsd__dateTime** array, int size)
 {
    Axis_Array::set((void**)array, size, XSD_DATETIME);
@@ -724,6 +744,11 @@
     }
 }
 
+xsd__time_Array::~xsd__time_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__time_Array::set(xsd__time** array, int size)
 {
    Axis_Array::set((void**)array, size, XSD_TIME);
@@ -748,6 +773,11 @@
     }
 }
 
+xsd__date_Array::~xsd__date_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__date_Array::set(xsd__date** array, int size)
 {
    Axis_Array::set((void**)array, size, XSD_DATE);
@@ -772,6 +802,11 @@
     }
 }
 
+xsd__gYearMonth_Array::~xsd__gYearMonth_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__gYearMonth_Array::set(xsd__gYearMonth** array, int size)
 {
    Axis_Array::set((void**)array, size, XSD_GYEARMONTH);
@@ -796,6 +831,11 @@
     }
 }
 
+xsd__gYear_Array::~xsd__gYear_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__gYear_Array::set(xsd__gYear** array, int size)
 {
    Axis_Array::set((void**)array, size, XSD_GYEAR);
@@ -820,6 +860,11 @@
     }
 }
 
+xsd__gMonthDay_Array::~xsd__gMonthDay_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__gMonthDay_Array::set(xsd__gMonthDay** array, int size)
 {
    Axis_Array::set((void**)array, size, XSD_GMONTHDAY);
@@ -843,6 +888,12 @@
         clone(original);
     }
 }
+
+xsd__gMonth_Array::~xsd__gMonth_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__gMonth_Array::set(xsd__gMonth** array, int size)
 {
    Axis_Array::set((void**)array, size, XSD_GMONTH);
@@ -867,6 +918,11 @@
     }
 }
 
+xsd__gDay_Array::~xsd__gDay_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__gDay_Array::set(xsd__gDay** array, int size)
 {
    Axis_Array::set((void**)array, size, XSD_GDAY);
@@ -891,6 +947,11 @@
     }
 }
 
+xsd__string_Array::~xsd__string_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__string_Array::set(xsd__string* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_STRING);
@@ -915,6 +976,11 @@
     }
 }
 
+xsd__normalizedString_Array::~xsd__normalizedString_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__normalizedString_Array::set(xsd__normalizedString* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_NORMALIZEDSTRING);
@@ -939,6 +1005,11 @@
     }
 }
 
+xsd__token_Array::~xsd__token_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__token_Array::set(xsd__token* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_TOKEN);
@@ -963,6 +1034,11 @@
     }
 }
 
+xsd__language_Array::~xsd__language_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__language_Array::set(xsd__language* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_LANGUAGE);
@@ -987,6 +1063,11 @@
     }
 }
 
+xsd__Name_Array::~xsd__Name_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__Name_Array::set(xsd__Name* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_NAME);
@@ -1011,6 +1092,11 @@
     }
 }
 
+xsd__NCName_Array::~xsd__NCName_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__NCName_Array::set(xsd__NCName* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_NCNAME);
@@ -1035,6 +1121,11 @@
     }
 }
 
+xsd__ID_Array::~xsd__ID_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__ID_Array::set(xsd__ID* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_ID);
@@ -1059,6 +1150,11 @@
     }
 }
 
+xsd__IDREF_Array::~xsd__IDREF_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__IDREF_Array::set(xsd__IDREF* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_IDREF);
@@ -1083,6 +1179,11 @@
     }
 }
 
+xsd__IDREFS_Array::~xsd__IDREFS_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__IDREFS_Array::set(xsd__IDREFS* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_IDREFS);
@@ -1107,6 +1208,11 @@
     }
 }
 
+xsd__ENTITY_Array::~xsd__ENTITY_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__ENTITY_Array::set(xsd__ENTITY* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_ENTITY);
@@ -1131,6 +1237,11 @@
     }
 }
 
+xsd__ENTITIES_Array::~xsd__ENTITIES_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__ENTITIES_Array::set(xsd__ENTITIES* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_ENTITIES);
@@ -1155,6 +1266,11 @@
     }
 }
 
+xsd__NMTOKEN_Array::~xsd__NMTOKEN_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__NMTOKEN_Array::set(xsd__NMTOKEN* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_NMTOKEN);
@@ -1179,6 +1295,11 @@
     }
 }
 
+xsd__NMTOKENS_Array::~xsd__NMTOKENS_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__NMTOKENS_Array::set(xsd__NMTOKENS* array, int size)
 {
  Axis_Array::set((void**)array, size, XSD_NMTOKEN);
@@ -1203,6 +1324,11 @@
     }
 }
 
+xsd__boolean_Array::~xsd__boolean_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__boolean_Array::set(xsd__boolean** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_BOOLEAN);
@@ -1227,6 +1353,11 @@
     }
 }
 
+xsd__base64Binary_Array::~xsd__base64Binary_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__base64Binary_Array::set(xsd__base64Binary** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_BASE64BINARY);
@@ -1251,6 +1382,11 @@
     }
 }
 
+xsd__hexBinary_Array::~xsd__hexBinary_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__hexBinary_Array::set(xsd__hexBinary** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_HEXBINARY);
@@ -1275,6 +1411,11 @@
     }
 }
 
+xsd__float_Array::~xsd__float_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__float_Array::set(xsd__float** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_FLOAT);
@@ -1299,6 +1440,11 @@
     }
 }
 
+xsd__decimal_Array::~xsd__decimal_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__decimal_Array::set(xsd__decimal** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_DECIMAL);
@@ -1323,6 +1469,11 @@
     }
 }
 
+xsd__integer_Array::~xsd__integer_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__integer_Array::set(xsd__integer** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_INTEGER);
@@ -1347,6 +1498,11 @@
     }
 }
 
+xsd__nonPositiveInteger_Array::~xsd__nonPositiveInteger_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__nonPositiveInteger_Array::set(xsd__nonPositiveInteger** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_NONPOSITIVEINTEGER);
@@ -1371,6 +1527,11 @@
     }
 }
 
+xsd__negativeInteger_Array::~xsd__negativeInteger_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__negativeInteger_Array::set(xsd__negativeInteger** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_NEGATIVEINTEGER);
@@ -1395,6 +1556,11 @@
     }
 }
 
+xsd__long_Array::~xsd__long_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__long_Array::set(xsd__long** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_LONG);
@@ -1419,6 +1585,11 @@
     }
 }
 
+xsd__int_Array::~xsd__int_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__int_Array::set(xsd__int** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_INT);
@@ -1443,6 +1614,11 @@
     }
 }
 
+xsd__short_Array::~xsd__short_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__short_Array::set(xsd__short** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_SHORT);
@@ -1467,6 +1643,11 @@
     }
 }
 
+xsd__byte_Array::~xsd__byte_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__byte_Array::set(xsd__byte** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_BYTE);
@@ -1491,6 +1672,11 @@
     }
 }
 
+xsd__nonNegativeInteger_Array::~xsd__nonNegativeInteger_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__nonNegativeInteger_Array::set(xsd__nonNegativeInteger** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_NONNEGATIVEINTEGER);
@@ -1515,6 +1701,11 @@
     }
 }
 
+xsd__unsignedLong_Array::~xsd__unsignedLong_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__unsignedLong_Array::set(xsd__unsignedLong** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_UNSIGNEDLONG);
@@ -1539,6 +1730,11 @@
     }
 }
 
+xsd__unsignedInt_Array::~xsd__unsignedInt_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__unsignedInt_Array::set(xsd__unsignedInt** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_UNSIGNEDINT);
@@ -1563,6 +1759,11 @@
     }
 }
 
+xsd__unsignedShort_Array::~xsd__unsignedShort_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__unsignedShort_Array::set(xsd__unsignedShort** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_UNSIGNEDSHORT);
@@ -1587,6 +1788,11 @@
     }
 }
 
+xsd__unsignedByte_Array::~xsd__unsignedByte_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__unsignedByte_Array::set(xsd__unsignedByte** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_UNSIGNEDBYTE);
@@ -1611,6 +1817,11 @@
     }
 }
 
+xsd__positiveInteger_Array::~xsd__positiveInteger_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__positiveInteger_Array::set(xsd__positiveInteger** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_POSITIVEINTEGER);
@@ -1635,6 +1846,11 @@
     }
 }
 
+xsd__double_Array::~xsd__double_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__double_Array::set(xsd__double** array, int size)
 {
 	Axis_Array::set((void**)array, size, XSD_DOUBLE);
@@ -1659,6 +1875,11 @@
     }
 }
 
+xsd__anyURI_Array::~xsd__anyURI_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__anyURI_Array::set(xsd__anyURI* array, int size)
 {
     Axis_Array::set((void**)array, size, XSD_ANYURI);
@@ -1683,6 +1904,11 @@
     }
 }
 
+xsd__QName_Array::~xsd__QName_Array()
+{
+    // Parent Axis_Array will carry out full clear up
+}
+
 void xsd__QName_Array::set(xsd__QName* array, int size)
 {
     Axis_Array::set((void**)array, size, XSD_QNAME);
@@ -1705,6 +1931,11 @@
     {
         clone(original);
     }
+}
+
+xsd__NOTATION_Array::~xsd__NOTATION_Array()
+{
+    // Parent Axis_Array will carry out full clear up
 }
 
 void xsd__NOTATION_Array::set(xsd__NOTATION* array, int size)

Modified: webservices/axis/trunk/c/src/engine/Axis.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/engine/Axis.cpp?rev=332605&r1=332604&r2=332605&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/engine/Axis.cpp (original)
+++ webservices/axis/trunk/c/src/engine/Axis.cpp Fri Nov 11 09:13:30 2005
@@ -511,218 +511,149 @@
 
 void Axis::AxisDelete(void *pValue, XSDTYPE type)
 {
-    switch (type)
+    if (pValue != NULL)
     {
-        case XSD_DURATION:
+        switch (type)
         {
-            if (pValue != NULL)
+            case XSD_DURATION:
             {
                 delete (xsd__duration*) pValue;
                 pValue = NULL;
+    			break;
             }
-			break;
-        }
-        case XSD_DATETIME:
-        {
-            if (pValue != NULL)
+            case XSD_DATETIME:
             {
                 delete (xsd__dateTime*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_TIME:
-        {
-            if (pValue != NULL)
+            case XSD_TIME:
             {
                 delete (xsd__time*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_DATE:
-        {
-            if (pValue != NULL)
+            case XSD_DATE:
             {
                 delete (xsd__date*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_GYEARMONTH:
-        {
-            if (pValue != NULL)
+            case XSD_GYEARMONTH:
             {
                 delete (xsd__gYearMonth*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_GYEAR:
-        {
-            if (pValue != NULL)
+            case XSD_GYEAR:
             {
                 delete (xsd__gYear*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_GMONTHDAY:
-        {
-            if (pValue != NULL)
+            case XSD_GMONTHDAY:
             {
                 delete (xsd__gMonthDay*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_GDAY:
-        {
-            if (pValue != NULL)
+            case XSD_GDAY:
             {
                 delete (xsd__gDay*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_GMONTH:
-        {
-            if (pValue != NULL)
+            case XSD_GMONTH:
             {
                 delete (xsd__gMonth*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_STRING:
-        {
-            if (pValue != NULL)
+            case XSD_STRING:
             {
                 delete [] (xsd__string) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_NORMALIZEDSTRING:
-        {
-            if (pValue != NULL)
+            case XSD_NORMALIZEDSTRING:
             {
                 delete [] (xsd__normalizedString) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_TOKEN:
-        {
-            if (pValue != NULL)
+            case XSD_TOKEN:
             {
                 delete [] (xsd__token) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_LANGUAGE:
-        {
-            if (pValue != NULL)
+            case XSD_LANGUAGE:
             {
                 delete [] (xsd__language) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_NAME:
-        {
-            if (pValue != NULL)
+            case XSD_NAME:
             {
                 delete [] (xsd__Name) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_NCNAME:
-        {
-            if (pValue != NULL)
+            case XSD_NCNAME:
             {
                 delete [] (xsd__NCName) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_ID:
-        {
-            if (pValue != NULL)
+            case XSD_ID:
             {
                 delete [] (xsd__ID) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_IDREF:
-        {
-            if (pValue != NULL)
+            case XSD_IDREF:
             {
                 delete [] (xsd__IDREF) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_IDREFS:
-        {
-            if (pValue != NULL)
+            case XSD_IDREFS:
             {
                 delete [] (xsd__IDREFS) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_ENTITY:
-        {
-            if (pValue != NULL)
+            case XSD_ENTITY:
             {
                 delete [] (xsd__ENTITY) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_ENTITIES:
-        {
-            if (pValue != NULL)
+            case XSD_ENTITIES:
             {
                 delete [] (xsd__ENTITIES) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_NMTOKEN:
-        {
-            if (pValue != NULL)
+            case XSD_NMTOKEN:
             {
                 delete [] (xsd__NMTOKEN) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_NMTOKENS:
-        {
-            if (pValue != NULL)
+            case XSD_NMTOKENS:
             {
                 delete [] (xsd__NMTOKENS) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_BOOLEAN:
-        {
-            if (pValue != NULL)
+            case XSD_BOOLEAN:
             {
                 delete (xsd__boolean*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_BASE64BINARY:
-        {
-            if (pValue != NULL)
+            case XSD_BASE64BINARY:
             {
 				if(	((xsd__base64Binary*) pValue)->__ptr != NULL)
 				{
@@ -732,12 +663,9 @@
 
                 delete (xsd__base64Binary*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_HEXBINARY:
-        {
-            if (pValue != NULL)
+            case XSD_HEXBINARY:
             {
 				if(	((xsd__hexBinary*) pValue)->__ptr != NULL)
 				{
@@ -747,188 +675,136 @@
 
                 delete (xsd__hexBinary*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_FLOAT:
-        {
-            if (pValue != NULL)
+            case XSD_FLOAT:
             {
                 delete (xsd__float*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_DECIMAL:
-        {
-            if (pValue != NULL)
+            case XSD_DECIMAL:
             {
                 delete (xsd__decimal*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_NONPOSITIVEINTEGER:
-        {
-            if (pValue != NULL)
+            case XSD_NONPOSITIVEINTEGER:
             {
                 delete (xsd__nonPositiveInteger*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_NEGATIVEINTEGER:
-        {
-            if (pValue != NULL)
+            case XSD_NEGATIVEINTEGER:
             {
                 delete (xsd__negativeInteger*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_INTEGER:
-        {
-            if (pValue != NULL)
+            case XSD_INTEGER:
             {
                 delete (xsd__integer*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_LONG:
-        {
-            if (pValue != NULL)
+            case XSD_LONG:
             {
                 delete (xsd__long*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_INT:
-        {
-            if (pValue != NULL)
+            case XSD_INT:
             {
                 delete (xsd__int*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_SHORT:
-        {
-            if (pValue != NULL)
+            case XSD_SHORT:
             {
                 delete (xsd__short*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_BYTE:
-        {
-            if (pValue != NULL)
+            case XSD_BYTE:
             {
                 delete (xsd__byte*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_NONNEGATIVEINTEGER:
-        {
-            if (pValue != NULL)
+            case XSD_NONNEGATIVEINTEGER:
             {
                 delete (xsd__nonNegativeInteger*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_UNSIGNEDLONG:
-        {
-            if (pValue != NULL)
+            case XSD_UNSIGNEDLONG:
             {
                 delete (xsd__unsignedLong*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_UNSIGNEDINT:
-        {
-            if (pValue != NULL)
+            case XSD_UNSIGNEDINT:
             {
                 delete (xsd__unsignedInt*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_UNSIGNEDSHORT:
-        {
-            if (pValue != NULL)
+            case XSD_UNSIGNEDSHORT:
             {
                 delete (xsd__unsignedShort*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_UNSIGNEDBYTE:
-        {
-            if (pValue != NULL)
+            case XSD_UNSIGNEDBYTE:
             {
                 delete (xsd__unsignedByte*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_POSITIVEINTEGER:
-        {
-            if (pValue != NULL)
+            case XSD_POSITIVEINTEGER:
             {
                 delete (xsd__positiveInteger*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_DOUBLE:
-        {
-            if (pValue != NULL)
+            case XSD_DOUBLE:
             {
                 delete (xsd__double*) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_ANYURI:
-        {
-            if (pValue != NULL)
+            case XSD_ANYURI:
             {
                 delete [] (xsd__anyURI) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_QNAME:
-        {
-            if (pValue != NULL)
+            case XSD_QNAME:
             {
                 delete [] (xsd__QName) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
-        }
-        case XSD_NOTATION:
-        {
-            if (pValue != NULL)
+            case XSD_NOTATION:
             {
                 delete [] (xsd__NOTATION) pValue;
                 pValue = NULL;
+                break;
             }
-         break;
+            case USER_TYPE:
+                // The USER_TYPE object should be cleared by the Application
+                break;
+            case XSD_ARRAY:
+            {
+                delete (Axis_Array*) pValue;
+                pValue = NULL;
+                break;
+            }
+            case XSD_ANY:
+            case ATTACHMENT:
+            case XSD_UNKNOWN:
+            default:
+    			;
         }
-        case USER_TYPE:
-            // The USER_TYPE object should be cleared by the Application
-            break;
-        case XSD_ARRAY:
-        case XSD_ANY:
-        case ATTACHMENT:
-        case XSD_UNKNOWN:
-        default:
-			;
     }
 }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ArrayParamHeaderWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ArrayParamHeaderWriter.java?rev=332605&r1=332604&r2=332605&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ArrayParamHeaderWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ArrayParamHeaderWriter.java Fri Nov 11 09:13:30 2005
@@ -180,10 +180,9 @@
         	writer.write("class " + classname + " : public Axis_Array\n");
         	writer.write("{\n");
         	writer.write("\tpublic:\n");
-        	writer.write("\t\t" + classname +"();\n");
-        	writer.write("\t\t" + classname + "(" + classname + " & original);\n");
-        	writer.write("\t\tvoid set(" + attribs[0].getTypeName() + "** array, const int size);\n");
-        	writer.write("\t\tconst "+ attribs[0].getTypeName() + "** get(int & size) const;\n");
+        	this.writeConstructors();
+        	this.writeDestructors();
+        	this.writeMethods();
             writer.write("};\n\n");
         }
         catch (IOException e)
@@ -193,13 +192,44 @@
     }
 
     protected void writeConstructors() throws WrapperFault
-    {}
+    {
+        try
+        {
+            writer.write("\t\t" + classname +"();\n");
+            writer.write("\t\t" + classname + "(" + classname + " & original);\n");
+        }
+        catch (IOException e)
+        {
+            throw new WrapperFault(e);
+        }
+    }
 
     protected void writeDestructors() throws WrapperFault
-    {}
+    {
+        try
+        {
+            writer.write("\t\t~" + classname + "();\n");
+        }
+        catch (IOException e)
+        {
+            throw new WrapperFault(e);
+        }
+    }
 
     protected void writeMethods() throws WrapperFault
-    {}
+    {
+        try
+        {
+            writer.write("\t\tvoid set(" + attribs[0].getTypeName() + "** array, const int size);\n");
+            writer.write("\t\tconst "+ attribs[0].getTypeName() + "** get(int & size) const;\n");
+            writer.write("\t\tvoid clone(" + classname + " & original);\n");
+            writer.write("\t\tvoid clear();\n");
+        }
+        catch (IOException e)
+        {
+            throw new WrapperFault(e);
+        }
+    }
 
     protected String getFileType()
     {

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ArrayParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ArrayParamWriter.java?rev=332605&r1=332604&r2=332605&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ArrayParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ArrayParamWriter.java Fri Nov 11 09:13:30 2005
@@ -77,13 +77,84 @@
     protected void writeMethods() throws WrapperFault
     {
         this.writeConstructors();
+        this.writeDestructors();
         
+            this.writeSetMethod();
+            this.writeGetMethod();
+            this.writeCloneMethod();
+            this.writeClearMethod();
+    }
+
+    
+    
+    /**
+     * @throws WrapperFault
+     * 
+     */
+    protected void writeClearMethod() throws WrapperFault
+    {
         try
         {
-            writer.write("void " + classname + "::" + "set(" + attribs[0].getTypeName() + "** array, const int size)\n");
+            writer.write("void " + classname + "::clear()\n");
+            writer.write("{\n");
+            writer.write("\tif (m_Array != NULL)\n");
+            writer.write("\t{\n");
+            writer.write("\t\tif (m_Size > 0)\n");
+            writer.write("\t\t{\n");
+            writer.write("\t\t\tfor (int count = 0 ; count < m_Size ; count++)\n");
+            writer.write("\t\t\t{\n");
+            writer.write("\t\t\t\tif (m_Array[count] != NULL)\n");
+            writer.write("\t\t\t\t{\n");
+            writer.write("\t\t\t\t\tdelete ((" + attribs[0].getTypeName() + "**) m_Array)[count];\n");
+            writer.write("\t\t\t\t\tm_Array[count] = NULL;\n");
+            writer.write("\t\t\t\t}\n");
+            writer.write("\t\t\t}\n");
+            writer.write("\t\t}\n");
+            writer.write("\t\tif (m_belongsToAxisEngine == false)\n");
+            writer.write("\t\t{\n");
+            writer.write("\t\t\tdelete [] m_Array;\n");
+            writer.write("\t\t\tm_Array = NULL;\n");
+            writer.write("\t\t\tm_Size = 0;\n");
+            writer.write("\t\t}\n");
+            writer.write("\t\telse\n");
+            writer.write("\t\t{\n");
+            writer.write("\t\t\t// Allow the engine to clear up it's memory\n");
+            writer.write("\t\t\tAxis_Array::clear();\n");
+            writer.write("\t\t}\n");
+            writer.write("\t\tm_belongsToAxisEngine = false;\n");
+            writer.write("\t}\n");
+            writer.write("}\n\n");
+        }
+        catch (IOException e)
+        {
+            throw new WrapperFault(e);
+        }        
+    }
+    /**
+     * @throws IOException
+     */
+    protected void writeCloneMethod() throws WrapperFault
+    {
+        // Write clone method
+        try
+        {
+            writer.write("void " + classname + "::clone(" + classname + " & original)\n");
             writer.write("{\n");
-            writer.write("\tAxis_Array::set((void**)array, size, USER_TYPE);\n");
+            writer.write("\tset((" + attribs[0].getTypeName() + "**) original.m_Array, original.m_Size);\n");
             writer.write("}\n\n");
+        }
+        catch (IOException e)
+        {
+            throw new WrapperFault(e);
+        }
+    }
+    /**
+     * @throws IOException
+     */
+    protected void writeGetMethod() throws WrapperFault
+    {
+        try
+        {
             writer.write("const " + attribs[0].getTypeName() + "** " + classname + "::" + "get(int & size) const\n");
             writer.write("{\n");
             writer.write("\tXSDTYPE type;\n");
@@ -94,11 +165,46 @@
         {
             throw new WrapperFault(e);
         }
-
     }
-
-    
-    
+    /**
+     * @throws IOException
+     */
+    protected void writeSetMethod() throws WrapperFault
+    {
+        try
+        {
+            writer.write("void " + classname + "::" + "set(" + attribs[0].getTypeName() + "** array, const int size)\n");
+            writer.write("{\n");
+            writer.write("\tclear();\n");
+            writer.write("\tm_Size = size;\n");
+            writer.write("\tm_Type = USER_TYPE;\n\n");
+            writer.write("\tif (m_Size == 0)\n");
+            writer.write("\t{\n");
+            writer.write("\t\tm_Array = NULL;\n");
+            writer.write("\t}\n");
+            writer.write("\telse\n");
+            writer.write("\t{\n");
+            writer.write("\t\tm_Array = new void*[m_Size];\n");
+            writer.write("\t\tfor (int count = 0 ; count < m_Size ; count++ )\n");
+            writer.write("\t\t{\n");
+            writer.write("\t\t\tif (array[count] == NULL)\n");
+            writer.write("\t\t\t{\n");
+            writer.write("\t\t\t\tm_Array[count] = NULL;\n");
+            writer.write("\t\t\t}\n");
+            writer.write("\t\t\telse\n");
+            writer.write("\t\t\t{\n");
+            writer.write("\t\t\t\t((" + attribs[0].getTypeName() + "**) m_Array)[count] =\n");
+            writer.write("\t\t\t\t\tnew " + attribs[0].getTypeName() + "(*((" + attribs[0].getTypeName() + "**) array)[count]);\n");
+            writer.write("\t\t\t}\n");
+            writer.write("\t\t}\n");
+            writer.write("\t}\n");
+            writer.write("}\n\n");
+        }
+        catch (IOException e)
+        {
+            throw new WrapperFault(e);
+        }
+    }
     protected void writeConstructors() throws WrapperFault
     {
         try
@@ -106,9 +212,12 @@
             writer.write(classname + "::" + classname + "()\n");
             writer.write("{\n");
             writer.write("\tm_Type = USER_TYPE;\n");
+            writer.write("\tm_belongsToAxisEngine = false;\n");
             writer.write("}\n\n");
             writer.write(classname + "::" + classname + "(" + classname + " & original)\n");
             writer.write("{\n");
+            writer.write("\tm_Type = USER_TYPE;\n");
+            writer.write("\tm_belongsToAxisEngine = false;\n");
             writer.write("\tclone(original);\n");
             writer.write("}\n\n");
         }
@@ -118,6 +227,22 @@
         }
         
     }
+    
+    protected void writeDestructors() throws WrapperFault
+    {
+        try
+        {
+            writer.write(classname + "::~" + classname + "()\n");
+            writer.write("{\n");
+            writer.write("\tclear();\n");
+            writer.write("}\n\n");
+        }
+        catch (IOException e)
+        {
+            throw new WrapperFault(e);
+        }
+    }
+    
     /* (non-Javadoc)
      * @see org.apache.axis.wsdl.wsdl2ws.BasicFileWriter#getFilePath()
      */

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java?rev=332605&r1=332604&r2=332605&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java Fri Nov 11 09:13:30 2005
@@ -618,6 +618,7 @@
                         + "m_pCall->getBasicArray("
                         + CUtils.getXSDTypeForBasicType(containedType) + ", \""
                         + returntype.getParamName() + "\", 0);\n");
+                writer.write ("\t\t\t\tRetArray.clone(*RetAxisArray);\n\t\t\t}\n");
             }
             else
             {
@@ -631,9 +632,10 @@
                         + ", (void*) Axis_GetSize_" + containedType + ", \""
                         + returntype.getParamName() + "\", Axis_URI_"
                         + containedType + ");\n");
-	            
+                writer.write("\t\t\tRetArray->clone(*(" + containedType + "_Array *)RetAxisArray);\n");
+				writer.write("\t\t\t((" + containedType + "_Array *)RetAxisArray)->clear();\n");
             }
-            writer.write ("\t\t\t\tRetArray.clone(*RetAxisArray);\n\t\t\t}\n");
+            
             writer.write ("\t\t\t\tAxis::AxisDelete( (void *)RetAxisArray, XSD_ARRAY);\n\t\t\t}\n");
             writer.write("\t\t}\n");
             writer.write("\tm_pCall->unInitialize();\n");

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java?rev=332605&r1=332604&r2=332605&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java Fri Nov 11 09:13:30 2005
@@ -929,29 +929,32 @@
 		    String containedType = null;
 		    if (CUtils.isSimpleType (qname))
 		    {
-			containedType = CUtils.getclass4qname (qname);
-			writer.write ("\t\t\tAxis_Array * RetAxisArray = m_pCall->getBasicArray(" 
-					+ CUtils.getXSDTypeForBasicType (containedType) 
-					+ ", \"" + returntype.getParamName () + "\", 0);\n");
+				containedType = CUtils.getclass4qname (qname);
+				writer.write ("\t\t\tAxis_Array * RetAxisArray = m_pCall->getBasicArray(" 
+						+ CUtils.getXSDTypeForBasicType (containedType) 
+						+ ", \"" + returntype.getParamName () + "\", 0);\n");
+				writer.write ("\t\t\tRetArray->clone(*RetAxisArray);\n");
 		    }
 		    else
 		    {
-			containedType = qname.getLocalPart ();
-			writer.write("\t\t\tAxis_Array * RetAxisArray = m_pCall->getCmplxArray((void*) Axis_DeSerialize_"
-					+ containedType 
-					+ ", (void*) Axis_Create_"
-				      + containedType
-				      + ", (void*) Axis_Delete_"
-				      + containedType
-				      + ", (void*) Axis_GetSize_"
-				      + containedType
-				      + ", \""
-				      + returntype.getElementNameAsString ()
-				      + "\", Axis_URI_"
-				      + containedType
-				      + ");\n");
+				containedType = qname.getLocalPart ();
+				writer.write("\t\t\tAxis_Array * RetAxisArray = m_pCall->getCmplxArray((void*) Axis_DeSerialize_"
+						+ containedType 
+						+ ", (void*) Axis_Create_"
+					      + containedType
+					      + ", (void*) Axis_Delete_"
+					      + containedType
+					      + ", (void*) Axis_GetSize_"
+					      + containedType
+					      + ", \""
+					      + returntype.getElementNameAsString ()
+					      + "\", Axis_URI_"
+					      + containedType
+					      + ");\n");
+				writer.write("\t\t\tRetArray->clone(*(" + containedType + "_Array *)RetAxisArray);\n");
+				writer.write("\t\t\t((" + containedType + "_Array *)RetAxisArray)->clear();\n"); 
+				
 		    }
-		    writer.write ("\t\t\tRetArray->clone(*RetAxisArray);\n");
 		    writer.write ("\t\t\tAxis::AxisDelete( (void *)RetAxisArray, XSD_ARRAY);\n");
 		    writer.write ("\t\t}\n");
 		    writer.write ("\t}\n");

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ArraysClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ArraysClient.cpp?rev=332605&r1=332604&r2=332605&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ArraysClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ArraysClient.cpp Fri Nov 11 09:13:30 2005
@@ -28,6 +28,7 @@
 void testAxis_ArrayCopying();
 void testComplexTypeWithSimpleArray();
 void testArrayOfComplexType();
+void testCopyingArrayOfComplexType();
 
 int main(int argc, char* argv[])
 {
@@ -48,6 +49,7 @@
     testAxis_ArrayCopying();
 	testComplexTypeWithSimpleArray();
 	testArrayOfComplexType();
+	testCopyingArrayOfComplexType();
 
     bool bSuccess = false;
     int iRetryIterationCount = 3;
@@ -55,25 +57,26 @@
     {
         try
         {
+			int count = 0;
             sprintf(endpoint, "%s", url);
             Arrays ws(endpoint);
 
             int arraySize = 3;
             xsd__int_Array inputArray;
             xsd__int** array = new xsd__int*[arraySize];
-            for (int count = 0 ; count < arraySize ; count++)
+            for (count = 0 ; count < arraySize ; count++)
             {
                 array[count] = new xsd__int(count);
             }
             inputArray.set(array, arraySize);
-            
+
             xsd__int_Array * outputArray = ws.simpleArray(&inputArray);
             int outputSize = 0;
             const xsd__int** output = outputArray->get(outputSize);
             cout << "Array size = " << outputSize << endl;
             if (output != NULL)
             {
-                for (int count = 0 ; count < outputSize ; count++)
+                for (count = 0 ; count < outputSize ; count++)
                 {
                     if (output[count] != NULL)
                     {
@@ -89,11 +92,13 @@
             {
                 cout << "NULL array" << endl;
             }
+			delete outputArray;
             
 
 			ComplexTypeWithSimpleArray * inputComplexType = new ComplexTypeWithSimpleArray;
 			inputComplexType->setsimpleType(&inputArray);
 			ComplexTypeWithSimpleArray * outputComplexType = ws.complexTypeWithSimpleArray(inputComplexType);
+			outputArray = outputComplexType->getsimpleType();
 			if (outputComplexType != NULL)
 			{
 				output = outputArray->get(outputSize);
@@ -122,6 +127,13 @@
 				cout << "NULL complex type" << endl;
 			}
 
+			// Clean up simple input array
+			for (count = 0 ; count < arraySize ; count++)
+			{
+				delete array[count];
+			}
+			delete [] array;
+
 			delete inputComplexType;
 			delete outputComplexType;
 
@@ -158,6 +170,14 @@
 			{
 				cout << "NULL array" << endl;
 			}
+			delete complexOutputAxis_Array;
+
+			// Clean up complex input array
+			for (count = 0 ; count < inputSize ; count++)
+			{
+				delete complexInputArray[count];
+			}
+			delete [] complexInputArray;
 
             bSuccess = 1;
         }
@@ -258,7 +278,7 @@
     // Alter the content of the original array, this should no longer affect the Axis_Array object
     for (count = 0 ; count < unitTestInputSize ; count++ )
     {
-        unitTestActualArray[count] = new xsd__int(count * 1000);
+        *unitTestActualArray[count] = count * 1000;
     }
 
     // Verify the correct data is available, and not the altered content
@@ -326,6 +346,11 @@
 
     unitTest_Axis_Array.set(unitTestActualArray, unitTestInputSize);
 
+	// Clean up the input array
+	delete unitTestActualArray[0];
+	delete unitTestActualArray[2];
+	delete [] unitTestActualArray;
+
     // Verify the correct data is available
     int size;
     const xsd__int** unitTestOutputArray = unitTest_Axis_Array.get(size);
@@ -409,6 +434,13 @@
 		array[count] = new xsd__int(count);
 	}
 	inputArray.set(array, inputSize);
+	
+	// Clear up the input array
+	for (count = 0 ; count < inputSize ; count++ )
+	{
+		delete array[count];
+	}
+	delete [] array;
 
 	complexType.setsimpleType(&inputArray);
 
@@ -473,5 +505,41 @@
 	{
 		cout << "NULL array" << endl;
 	}
+
+	// Delete contents of input array - NOTE: this will also be output array!
+	for (count = 0 ; count < inputSize ; count ++ )
+	{
+		delete inputArray[count];
+	}
+	delete [] inputArray;
+
+}
+
+void testCopyingArrayOfComplexType()
+{
+	ComplexTypeWithSimpleElement_Array * array = new ComplexTypeWithSimpleElement_Array();
+	int count = 0;
+	int inputSize = 3;
+	ComplexTypeWithSimpleElement** inputArray = new ComplexTypeWithSimpleElement*[inputSize];
+	for (count = 0 ; count < inputSize ; count++)
+	{
+		inputArray[count] = new ComplexTypeWithSimpleElement();
+		inputArray[count]->setsimpleType(count);
+	}
+	array->set(inputArray, inputSize);
+
+	ComplexTypeWithSimpleElement_Array * copyArray = new ComplexTypeWithSimpleElement_Array();
+	copyArray->clone(*array);
+	copyArray->clear();
+	delete (Axis_Array*) copyArray;
+	delete array;
+
+	// Delete contents of input array
+	for (count = 0 ; count < inputSize ; count ++ )
+	{
+		delete inputArray[count];
+	}
+	delete [] inputArray;
+
 }