axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r478106 [1/3] - /webservices/axis/trunk/c/src/soap/xsd/
Date Wed, 22 Nov 2006 10:11:42 GMT
Author: nadiramra
Date: Wed Nov 22 02:11:36 2006
New Revision: 478106

URL: http://svn.apache.org/viewvc?view=rev&rev=478106
Log:
AXISCPP-1008 memory leak in error paths of xsd types

Modified:
    webservices/axis/trunk/c/src/soap/xsd/AnyURI.cpp
    webservices/axis/trunk/c/src/soap/xsd/Base64Binary.cpp
    webservices/axis/trunk/c/src/soap/xsd/Boolean.cpp
    webservices/axis/trunk/c/src/soap/xsd/Date.cpp
    webservices/axis/trunk/c/src/soap/xsd/DateTime.cpp
    webservices/axis/trunk/c/src/soap/xsd/Decimal.cpp
    webservices/axis/trunk/c/src/soap/xsd/Double.cpp
    webservices/axis/trunk/c/src/soap/xsd/Duration.cpp
    webservices/axis/trunk/c/src/soap/xsd/Float.cpp
    webservices/axis/trunk/c/src/soap/xsd/GDay.cpp
    webservices/axis/trunk/c/src/soap/xsd/GMonth.cpp
    webservices/axis/trunk/c/src/soap/xsd/GMonthDay.cpp
    webservices/axis/trunk/c/src/soap/xsd/GYear.cpp
    webservices/axis/trunk/c/src/soap/xsd/GYearMonth.cpp
    webservices/axis/trunk/c/src/soap/xsd/HexBinary.cpp
    webservices/axis/trunk/c/src/soap/xsd/IAnySimpleType.cpp
    webservices/axis/trunk/c/src/soap/xsd/Int.cpp
    webservices/axis/trunk/c/src/soap/xsd/Integer.cpp
    webservices/axis/trunk/c/src/soap/xsd/Long.cpp
    webservices/axis/trunk/c/src/soap/xsd/NOTATION.cpp
    webservices/axis/trunk/c/src/soap/xsd/NonNegativeInteger.cpp
    webservices/axis/trunk/c/src/soap/xsd/Short.cpp
    webservices/axis/trunk/c/src/soap/xsd/String.cpp
    webservices/axis/trunk/c/src/soap/xsd/Time.cpp
    webservices/axis/trunk/c/src/soap/xsd/XSD_QName.cpp

Modified: webservices/axis/trunk/c/src/soap/xsd/AnyURI.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/AnyURI.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/AnyURI.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/AnyURI.cpp Wed Nov 22 02:11:36 2006
@@ -17,142 +17,132 @@
 
 AXIS_CPP_NAMESPACE_START
 
-    AnyURI::AnyURI()
-    {
-    }
-
-    AnyURI::AnyURI(const xsd__anyURI value)
-    {
-        if (value)
-        {
-            setNil(false);            
-            serialize(value);
-        }
-    }
+AnyURI::AnyURI()
+{
+}
+
+AnyURI::AnyURI(const xsd__anyURI value)
+{
+    if (value)
+    {
+        setNil(false);            
+        serialize(value);
+    }
+}
+
+XSDTYPE AnyURI::getType()
+{
+    return XSD_ANYURI;
+}
+
+xsd__anyURI AnyURI::getAnyURI()
+{
+    if (isNil())
+        return NULL;
+    else
+        return deserializeAnyURI(m_Buf);
+}
+
+void * AnyURI::getValue()
+{
+    return (void*) getAnyURI();
+}
+
+AxisChar* AnyURI::serialize(const xsd__anyURI value) throw (AxisSoapException)
+{
+    AxisString exceptionMessage;
+    char lengthAsString[100];
     
-    XSDTYPE AnyURI::getType()
-    {
-        return XSD_ANYURI;
-    }
-
-    xsd__anyURI AnyURI::getAnyURI()
-    {
-        if (isNil())
-        {
-            return NULL;
-        }
-        else
-        {
-            return deserializeAnyURI(m_Buf);
-        }
-    }
-
-    void * AnyURI::getValue()
-    {
-        return (void*) getAnyURI();
-    }
-
-    AxisChar* AnyURI::serialize(const xsd__anyURI value) throw (AxisSoapException)
-    {
-        MinLength* minLength= getMinLength();
-        if (minLength->isSet())
-        {
-            if (strlen(value) < (unsigned int) minLength->getMinLength())
-            {
-                AxisString exceptionMessage =
-                "Length of value to be serialized is shorter than MinLength specified for this type.  Minlength = ";
-                AxisChar* length = new AxisChar[10];
-                sprintf(length, "%d", minLength->getMinLength());
-                exceptionMessage += length;
-                exceptionMessage += ", Length of value = ";
-                sprintf(length, "%d", strlen(value));
-                exceptionMessage += length;
-                exceptionMessage += ".";
-                delete [] length;
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete minLength;
-        
-        MaxLength* maxLength = getMaxLength();
-        if (maxLength->isSet())
-        {
-            if (strlen(value) > (unsigned int) maxLength->getMaxLength())
-            {
-                AxisString exceptionMessage =
-                "Length of value to be serialized is longer than MaxLength specified for this type.  Maxlength = ";
-                AxisChar* length = new AxisChar[10];
-                sprintf(length, "%d", maxLength->getMaxLength());
-                exceptionMessage += length;
-                exceptionMessage += ", Length of value = ";
-                sprintf(length, "%d", strlen(value));
-                exceptionMessage += length;
-                exceptionMessage += ".";
-                delete [] length;
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete maxLength;
-
-        Length* length = getLength();
-        if (length->isSet())
-        {
-            if (strlen(value) != (unsigned int) length->getLength())
-            {
-                AxisString exceptionMessage =
-                "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
-                AxisChar* lengthAsString = new AxisChar[10];
-                sprintf(lengthAsString, "%d", length->getLength());
-                exceptionMessage += lengthAsString;
-                exceptionMessage += ", Length of value = ";
-                sprintf(lengthAsString, "%d", strlen(value));
-                exceptionMessage += lengthAsString;
-                exceptionMessage += ".";
-                delete [] lengthAsString;
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
+    MinLength* minLength= getMinLength();
+    if (minLength->isSet())
+        if (strlen(value) < (unsigned int) minLength->getMinLength())
+        {
+            exceptionMessage =
+            "Length of value to be serialized is shorter than MinLength specified for this type.  Minlength = ";
+            sprintf(lengthAsString, "%d", minLength->getMinLength());
+            exceptionMessage += lengthAsString;
+            exceptionMessage += ", Length of value = ";
+            sprintf(lengthAsString, "%d", strlen(value));
+            exceptionMessage += lengthAsString;
+            exceptionMessage += ".";
+            
+            delete minLength;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
-        delete length;
-             
-		AxisString valueAsString = value;
-		AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
-		
-        IAnySimpleType::serialize(serializedValue);
-
-		return m_Buf;
-    }
+    delete minLength;
+    
+    MaxLength* maxLength = getMaxLength();
+    if (maxLength->isSet())
+        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
+        {
+            exceptionMessage =
+            "Length of value to be serialized is longer than MaxLength specified for this type.  Maxlength = ";
+            sprintf(lengthAsString, "%d", maxLength->getMaxLength());
+            exceptionMessage += lengthAsString;
+            exceptionMessage += ", Length of value = ";
+            sprintf(lengthAsString, "%d", strlen(value));
+            exceptionMessage += lengthAsString;
+            exceptionMessage += ".";
+            
+            delete maxLength;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
+        }
+    delete maxLength;
+
+    Length* length = getLength();
+    if (length->isSet())
+        if (strlen(value) != (unsigned int) length->getLength())
+        {
+            exceptionMessage =
+            "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
+            sprintf(lengthAsString, "%d", length->getLength());
+            exceptionMessage += lengthAsString;
+            exceptionMessage += ", Length of value = ";
+            sprintf(lengthAsString, "%d", strlen(value));
+            exceptionMessage += lengthAsString;
+            exceptionMessage += ".";
+            
+            delete length;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
+        }
+    delete length;
+         
+	AxisString valueAsString = value;
+	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
 	
-    xsd__anyURI AnyURI::deserializeAnyURI(const AxisChar* valueAsChar) throw (AxisSoapException)
-    {
-        xsd__anyURI value = new char[strlen (valueAsChar) + 1];
-		strcpy (value, valueAsChar);
-		return value;
-    }
+    IAnySimpleType::serialize(serializedValue);
 
-    WhiteSpace* AnyURI::getWhiteSpace()
-    {
-        return new WhiteSpace(REPLACE);
-    }
-
-    MinLength* AnyURI::getMinLength()
-    {
-        return new MinLength();
-    }
-    
-    MaxLength* AnyURI::getMaxLength()
-    {
-        return new MaxLength();
-    }
+	return m_Buf;
+}
 
-    Length* AnyURI::getLength()
-    {
-        return new Length();
-    }
+xsd__anyURI AnyURI::deserializeAnyURI(const AxisChar* valueAsChar) throw (AxisSoapException)
+{
+    xsd__anyURI value = new char[strlen (valueAsChar) + 1];
+	strcpy (value, valueAsChar);
+	return value;
+}
+
+WhiteSpace* AnyURI::getWhiteSpace()
+{
+    return new WhiteSpace(REPLACE);
+}
+
+MinLength* AnyURI::getMinLength()
+{
+    return new MinLength();
+}
+
+MaxLength* AnyURI::getMaxLength()
+{
+    return new MaxLength();
+}
+
+Length* AnyURI::getLength()
+{
+    return new Length();
+}
 
 AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/soap/xsd/Base64Binary.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/Base64Binary.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Base64Binary.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Base64Binary.cpp Wed Nov 22 02:11:36 2006
@@ -17,156 +17,145 @@
 
 AXIS_CPP_NAMESPACE_START
 
-    Base64Binary::Base64Binary()
-    {
-    }
-    
-    Base64Binary::~Base64Binary()
-    {
-    }
-
-    Base64Binary::Base64Binary(const xsd__base64Binary* value)
-    {
-        if (value)
-        {
-            setNil(false);
-            serialize(value);
-        }
-    }
-
-    XSDTYPE Base64Binary::getType()
-    {
-        return XSD_BASE64BINARY;
-    }
-
-    xsd__base64Binary* Base64Binary::getBase64Binary()
-    {
-        if (isNil())
-        {
-            return NULL;
-        }
-        else
-        {
-            return deserializeBase64Binary(m_Buf);
-        }
-    }
-
-    void * Base64Binary::getValue()
-    {
-        return (void*) getBase64Binary();
-    }
+Base64Binary::Base64Binary()
+{
+}
+
+Base64Binary::~Base64Binary()
+{
+}
+
+Base64Binary::Base64Binary(const xsd__base64Binary* value)
+{
+    if (value)
+    {
+        setNil(false);
+        serialize(value);
+    }
+}
+
+XSDTYPE Base64Binary::getType()
+{
+    return XSD_BASE64BINARY;
+}
+
+xsd__base64Binary* Base64Binary::getBase64Binary()
+{
+    if (isNil())
+        return NULL;
+    else
+        return deserializeBase64Binary(m_Buf);
+}
+
+void * Base64Binary::getValue()
+{
+    return (void*) getBase64Binary();
+}
+
+AxisChar* Base64Binary::serialize(const xsd__base64Binary * value) throw (AxisSoapException)
+{
+    AxisString exceptionMessage;
+    char lengthAsString[100];
     
-    AxisChar* Base64Binary::serialize(const xsd__base64Binary * value) throw (AxisSoapException)
-    {
-        MinLength* minLength= getMinLength();
-        if (minLength->isSet())
-        {
-            if (value->getSize() < minLength->getMinLength())
-            {
-                AxisString exceptionMessage =
-                "Length of value to be serialized is shorter than MinLength specified for this type.  Minlength = ";
-                AxisChar* length = new AxisChar[10];
-                sprintf(length, "%d", minLength->getMinLength());
-                exceptionMessage += length;
-                exceptionMessage += ", Length of value = ";
-                sprintf(length, "%d", value->getSize());
-                exceptionMessage += length;
-                exceptionMessage += ".";
-                delete [] length;
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
+    MinLength* minLength= getMinLength();
+    if (minLength->isSet())
+        if (value->getSize() < minLength->getMinLength())
+        {
+            exceptionMessage =
+            "Length of value to be serialized is shorter than MinLength specified for this type.  Minlength = ";
+            sprintf(lengthAsString, "%d", minLength->getMinLength());
+            exceptionMessage += lengthAsString;
+            exceptionMessage += ", Length of value = ";
+            sprintf(lengthAsString, "%d", value->getSize());
+            exceptionMessage += lengthAsString;
+            exceptionMessage += ".";
             
+            delete minLength;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
-        delete minLength;
-        
-        MaxLength* maxLength = getMaxLength();
-        if (maxLength->isSet())
-        {
-            if (value->getSize() > maxLength->getMaxLength())
-            {
-                AxisString exceptionMessage =
-                "Length of value to be serialized is longer than MaxLength specified for this type.  Maxlength = ";
-                AxisChar* length = new AxisChar[10];
-                sprintf(length, "%d", maxLength->getMaxLength());
-                exceptionMessage += length;
-                exceptionMessage += ", Length of value = ";
-                sprintf(length, "%d", value->getSize());
-                exceptionMessage += length;
-                exceptionMessage += ".";
-                delete [] length;
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete maxLength;
-
-        Length* length= getLength();
-        if (length->isSet())
-        {
-            if (value->getSize() != length->getLength())
-            {
-                AxisString exceptionMessage =
-                "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
-                AxisChar* lengthAsString = new AxisChar[10];
-                sprintf(lengthAsString, "%d", length->getLength());
-                exceptionMessage += lengthAsString;
-                exceptionMessage += ", Length of value = ";
-                sprintf(lengthAsString, "%d", value->getSize());
-                exceptionMessage += lengthAsString;
-                exceptionMessage += ".";
-                delete [] lengthAsString;
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete length;
-     
-	    int len = apr_base64_encode_len (value->getSize());	    
-	    AxisChar* serializedValue = new AxisChar[len + 1];
-		int size = 0;
-		xsd__unsignedByte * pTemp = value->get(size);
-	    len = apr_base64_encode_binary (serializedValue, pTemp, size);
-	    serializedValue[len] = 0;
-	    	    
-        IAnySimpleType::serialize(serializedValue);
-        delete [] serializedValue;        
-		return m_Buf;
-    }
-	
-    xsd__base64Binary * Base64Binary::deserializeBase64Binary(const AxisChar* valueAsChar) throw (AxisSoapException)
-    {
-    	xsd__base64Binary * value = new xsd__base64Binary();
-	    xsd__int size = apr_base64_decode_len (valueAsChar);
-	    xsd__unsignedByte * pTemp = new xsd__unsignedByte[size + 1];
-	    size = apr_base64_decode_binary (pTemp, valueAsChar);
-	    pTemp[size] = 0; // Null terminate so it could be used as a string
-		value->set(pTemp, size);
-		delete [] pTemp;
-	    return value;
-    }
-
-    MinLength* Base64Binary::getMinLength()
-    {
-        return new MinLength();
-    }
+    delete minLength;
     
-    MaxLength* Base64Binary::getMaxLength()
-    {
-        return new MaxLength();
-    }
-
-    Length* Base64Binary::getLength()
-    {
-        return new Length();
-    }
-    
-    WhiteSpace* Base64Binary::getWhiteSpace()
-    {
-        return new WhiteSpace(COLLAPSE);
-    }
+    MaxLength* maxLength = getMaxLength();
+    if (maxLength->isSet())
+        if (value->getSize() > maxLength->getMaxLength())
+        {
+            exceptionMessage =
+            "Length of value to be serialized is longer than MaxLength specified for this type.  Maxlength = ";
+            sprintf(lengthAsString, "%d", maxLength->getMaxLength());
+            exceptionMessage += lengthAsString;
+            exceptionMessage += ", Length of value = ";
+            sprintf(lengthAsString, "%d", value->getSize());
+            exceptionMessage += lengthAsString;
+            exceptionMessage += ".";
+            
+            delete maxLength;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
+        }
+    delete maxLength;
+
+    Length* length= getLength();
+    if (length->isSet())
+        if (value->getSize() != length->getLength())
+        {
+            exceptionMessage =
+            "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
+            sprintf(lengthAsString, "%d", length->getLength());
+            exceptionMessage += lengthAsString;
+            exceptionMessage += ", Length of value = ";
+            sprintf(lengthAsString, "%d", value->getSize());
+            exceptionMessage += lengthAsString;
+            exceptionMessage += ".";
+
+            delete length;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
+        }
+    delete length;
+ 
+    int len = apr_base64_encode_len (value->getSize());	    
+    AxisChar* serializedValue = new AxisChar[len + 1];
+	int size = 0;
+	xsd__unsignedByte * pTemp = value->get(size);
+    len = apr_base64_encode_binary (serializedValue, pTemp, size);
+    serializedValue[len] = 0;
+    	    
+    IAnySimpleType::serialize(serializedValue);
+    delete [] serializedValue;        
+	return m_Buf;
+}
+
+xsd__base64Binary * Base64Binary::deserializeBase64Binary(const AxisChar* valueAsChar) throw (AxisSoapException)
+{
+	xsd__base64Binary * value = new xsd__base64Binary();
+    xsd__int size = apr_base64_decode_len (valueAsChar);
+    xsd__unsignedByte * pTemp = new xsd__unsignedByte[size + 1];
+    size = apr_base64_decode_binary (pTemp, valueAsChar);
+    pTemp[size] = 0; // Null terminate so it could be used as a string
+	value->set(pTemp, size);
+	delete [] pTemp;
+    return value;
+}
+
+MinLength* Base64Binary::getMinLength()
+{
+    return new MinLength();
+}
+
+MaxLength* Base64Binary::getMaxLength()
+{
+    return new MaxLength();
+}
+
+Length* Base64Binary::getLength()
+{
+    return new Length();
+}
+
+WhiteSpace* Base64Binary::getWhiteSpace()
+{
+    return new WhiteSpace(COLLAPSE);
+}
 
 AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/soap/xsd/Boolean.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/Boolean.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Boolean.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Boolean.cpp Wed Nov 22 02:11:36 2006
@@ -42,13 +42,9 @@
 xsd__boolean* Boolean::getBoolean()
 {
     if (isNil())
-    {
         return NULL;
-    }
     else
-    {
         return deserializeBoolean(m_Buf);
-    }
 }
 
 void * Boolean::getValue()
@@ -63,12 +59,11 @@
  */
 AxisChar* Boolean::serialize(const xsd__boolean * value) throw (AxisSoapException)
 {
-    AxisChar* serializedValue = new char[6];
+    AxisChar serializedValue[6];
 	AxisSprintf (serializedValue, 6, "%s",
             (*((int *) (value)) == false_) ? "false" : "true");
     
     IAnySimpleType::serialize(serializedValue);
-    delete [] serializedValue;        
     return m_Buf;
 }
 
@@ -82,13 +77,9 @@
     xsd__boolean * value = new xsd__boolean;
  
 	if ( 0 == strcmp (valueAsChar, "true") || 0 == strcmp (valueAsChar, "1"))
-	{
 		*value = true_;
-	}
 	else
-	{
 		*value =  false_;
-	}
     
     return value;
 }

Modified: webservices/axis/trunk/c/src/soap/xsd/Date.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/Date.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Date.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Date.cpp Wed Nov 22 02:11:36 2006
@@ -17,227 +17,221 @@
 
 AXIS_CPP_NAMESPACE_START
 
-    Date::Date()
+Date::Date()
+{
+}
+
+Date::Date(const xsd__date* value)
+{
+    if (value)
+    {
+        setNil(false);
+        serialize(value);
+    }
+}
+
+XSDTYPE Date::getType()
+{
+    return XSD_DATE;
+}
+
+xsd__date* Date::getDate()
+{
+    if (isNil())
+        return NULL;
+    else
+        return deserializeDate(m_Buf);
+}
+
+void * Date::getValue()
+{
+    return (void*) getDate();
+}
+
+AxisChar* Date::serialize(const xsd__date* value) throw (AxisSoapException)
+{        
+    MinInclusive* minInclusive = getMinInclusive();
+    if (minInclusive->isSet())
     {
-    }
-
-    Date::Date(const xsd__date* value)
-    {
-        if (value)
+        struct tm minInclusiveAsStructTM = minInclusive->getMinInclusiveAsStructTM();
+        if ( 0 > difftime(mktime(&minInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
         {
-            setNil(false);
-            serialize(value);
+            AxisString exceptionMessage =
+            "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
+            exceptionMessage += asctime(&minInclusiveAsStructTM);
+            exceptionMessage += ", Value = ";
+            exceptionMessage += asctime(value);
+            exceptionMessage += ".";
+            
+            delete minInclusive;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
     }
+    delete minInclusive;
 
-    XSDTYPE Date::getType()
+    MinExclusive* minExclusive = getMinExclusive();
+    if (minExclusive->isSet())
     {
-        return XSD_DATE;
-    }
-
-    xsd__date* Date::getDate()
-    {
-        if (isNil())
+        struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
+        if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
         {
-            return NULL;
-        }
-        else
-        {
-            return deserializeDate(m_Buf);
+            AxisString exceptionMessage =
+            "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
+            exceptionMessage += asctime(&minExclusiveAsStructTM);
+            exceptionMessage += ", Value = ";
+            exceptionMessage += asctime(value);
+            exceptionMessage += ".";
+            
+            delete minExclusive;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
     }
+    delete minExclusive;
 
-    void * Date::getValue()
+    MaxInclusive* maxInclusive = getMaxInclusive();
+    if (maxInclusive->isSet())
     {
-        return (void*) getDate();
-    }
-
-    AxisChar* Date::serialize(const xsd__date* value) throw (AxisSoapException)
-    {
-        MinInclusive* minInclusive = getMinInclusive();
-        if (minInclusive->isSet())
-        {
-            struct tm minInclusiveAsStructTM = minInclusive->getMinInclusiveAsStructTM();
-            if ( 0 > difftime(mktime(&minInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
-            {
-                AxisString exceptionMessage =
-                "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
-                exceptionMessage += asctime(&minInclusiveAsStructTM);
-                exceptionMessage += ", Value = ";
-                exceptionMessage += asctime(value);
-                exceptionMessage += ".";
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete minInclusive;
-
-        MinExclusive* minExclusive = getMinExclusive();
-        if (minExclusive->isSet())
-        {
-            struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
-            if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
-            {
-                AxisString exceptionMessage =
-                "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
-                exceptionMessage += asctime(&minExclusiveAsStructTM);
-                exceptionMessage += ", Value = ";
-                exceptionMessage += asctime(value);
-                exceptionMessage += ".";
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete minExclusive;
-
-        MaxInclusive* maxInclusive = getMaxInclusive();
-        if (maxInclusive->isSet())
-        {
-            struct tm maxInclusiveAsStructTM = maxInclusive->getMaxInclusiveAsStructTM();
-            if ( 0 < difftime(mktime(&maxInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
-            {
-                AxisString exceptionMessage =
-                "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
-                exceptionMessage += asctime(&maxInclusiveAsStructTM);
-                exceptionMessage += ", Value = ";
-                exceptionMessage += asctime(value);
-                exceptionMessage += ".";
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete maxInclusive;
-
-        MaxExclusive* maxExclusive = getMaxExclusive();
-        if (maxExclusive->isSet())
-        {
-            struct tm maxExclusiveAsStructTM = maxExclusive->getMaxExclusiveAsStructTM();
-            if ( 0 <= difftime(mktime(&maxExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
-            {
-                AxisString exceptionMessage =
-                "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
-                exceptionMessage += asctime(&maxExclusiveAsStructTM);
-                exceptionMessage += ", Value = ";
-                exceptionMessage += asctime(value);
-                exceptionMessage += ".";
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete maxExclusive;
-
-        AxisString serializedValue = "";
-        AxisChar* valueAsString = new AxisChar[80];
-        strftime (valueAsString, 80, "%Y-%m-%d", value);
-        serializedValue += valueAsString;
-        delete [] valueAsString;
-
-        // Calculate local timezone offset
-        time_t now = time(NULL);
-        struct tm *temp = gmtime(&now);
-        struct tm utcTime;
-        memcpy(&utcTime, temp, sizeof(struct tm));
-        temp = localtime(&now);
-        struct tm localTime;
-        memcpy(&localTime, temp, sizeof(struct tm));
-
-        long utcTimeInMinutes = (utcTime.tm_year * 60 * 24 * 365)
-            + (utcTime.tm_yday * 60 * 24)
-            + (utcTime.tm_hour * 60)
-            + utcTime.tm_min;
-
-        long localTimeInMinutes = (localTime.tm_year * 60 * 24 * 365)
-            + (localTime.tm_yday * 60 * 24)
-            + (localTime.tm_hour * 60)
-            + localTime.tm_min;
-
-        int timeOffsetInMinutes = localTimeInMinutes - utcTimeInMinutes;
-
-        if (timeOffsetInMinutes == 0)
+        struct tm maxInclusiveAsStructTM = maxInclusive->getMaxInclusiveAsStructTM();
+        if ( 0 < difftime(mktime(&maxInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
         {
-            serializedValue += "Z";
-        }
-        else
-        {
-            struct tm timeOffset;
-            timeOffset.tm_year = 0;
-            timeOffset.tm_yday = 0;
-            timeOffset.tm_sec = 0;
-            timeOffset.tm_min = timeOffsetInMinutes % 60;
-            timeOffsetInMinutes -= timeOffset.tm_min;
-            timeOffset.tm_hour = (timeOffsetInMinutes % (60 * 24)) / 60;
-            
-            if ( (timeOffset.tm_hour < 0) || (timeOffset.tm_min < 0) )
-            {
-                serializedValue += "-";
-                timeOffset.tm_hour *= -1;
-                timeOffset.tm_min *= -1;
-            }
-            else
-            {
-                serializedValue += "+";
-            }
+            AxisString exceptionMessage =
+            "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
+            exceptionMessage += asctime(&maxInclusiveAsStructTM);
+            exceptionMessage += ", Value = ";
+            exceptionMessage += asctime(value);
+            exceptionMessage += ".";
             
-            AxisChar * offSetString = new AxisChar[6];
-            sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
-            serializedValue += offSetString;
-            delete [] offSetString;
+            delete maxInclusive;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
-
-        
-        IAnySimpleType::serialize(serializedValue.c_str());
-		return m_Buf;
     }
-	
-    xsd__date* Date::deserializeDate(const AxisChar* valueAsChar) throw (AxisSoapException)
+    delete maxInclusive;
+
+    MaxExclusive* maxExclusive = getMaxExclusive();
+    if (maxExclusive->isSet())
     {
-    	struct tm value;
-	    struct tm *pTm;
-        AxisChar *cUtc;
-	    AxisChar *cTemp;
-	    AxisChar *cTemp2;
-
-        // Calculate local timezone offset
-        time_t now = time(NULL);
-        struct tm *temp = gmtime(&now);
-        struct tm utcTime;
-        memcpy(&utcTime, temp, sizeof(struct tm));
-        temp = localtime(&now);
-        struct tm localTime;
-        memcpy(&localTime, temp, sizeof(struct tm));
-
-        long utcTimeInSeconds = (utcTime.tm_year * 60 * 60 * 24 * 365)
-            + (utcTime.tm_yday * 60 * 60 * 24)
-            + (utcTime.tm_hour * 60 * 60)
-            + (utcTime.tm_min * 60);
-
-        long localTimeInSeconds = (localTime.tm_year * 60 * 60 * 24 * 365)
-            + (localTime.tm_yday * 60 * 60 * 24)
-            + (localTime.tm_hour * 60 * 60)
-            + (localTime.tm_min * 60);
-
-        time_t d = utcTimeInSeconds - localTimeInSeconds;
-
-        /* dismantle m_sValue to get tm value;
-         * XSD_DATETIME format is
-         * CCYY(-)MM(-)DDZ OR
-         * CCYY(-)MM(-)DD+/-<UTC TIME DIFFERENCE>
-         */
-        if (sscanf (valueAsChar, "%d-%d-%d", &value.tm_year, 
-            &value.tm_mon, &value.tm_mday) != 3)
+        struct tm maxExclusiveAsStructTM = maxExclusive->getMaxExclusiveAsStructTM();
+        if ( 0 <= difftime(mktime(&maxExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
         {
             AxisString exceptionMessage =
-            "Unable to decompose from string form of DateTime value.  Value =";
-            exceptionMessage += valueAsChar;
+            "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
+            exceptionMessage += asctime(&maxExclusiveAsStructTM);
+            exceptionMessage += ", Value = ";
+            exceptionMessage += asctime(value);
             exceptionMessage += ".";
             
+            delete maxExclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
+    }
+    delete maxExclusive;
+
+    AxisString serializedValue = "";
+    AxisChar valueAsString[80];
+    strftime (valueAsString, 80, "%Y-%m-%d", value);
+    serializedValue += valueAsString;
+
+    // Calculate local timezone offset
+    time_t now = time(NULL);
+    struct tm *temp = gmtime(&now);
+    struct tm utcTime;
+    memcpy(&utcTime, temp, sizeof(struct tm));
+    temp = localtime(&now);
+    struct tm localTime;
+    memcpy(&localTime, temp, sizeof(struct tm));
+
+    long utcTimeInMinutes = (utcTime.tm_year * 60 * 24 * 365)
+        + (utcTime.tm_yday * 60 * 24)
+        + (utcTime.tm_hour * 60)
+        + utcTime.tm_min;
+
+    long localTimeInMinutes = (localTime.tm_year * 60 * 24 * 365)
+        + (localTime.tm_yday * 60 * 24)
+        + (localTime.tm_hour * 60)
+        + localTime.tm_min;
+
+    int timeOffsetInMinutes = localTimeInMinutes - utcTimeInMinutes;
+
+    if (timeOffsetInMinutes == 0)
+        serializedValue += "Z";
+    else
+    {
+        struct tm timeOffset;
+        timeOffset.tm_year = 0;
+        timeOffset.tm_yday = 0;
+        timeOffset.tm_sec = 0;
+        timeOffset.tm_min = timeOffsetInMinutes % 60;
+        timeOffsetInMinutes -= timeOffset.tm_min;
+        timeOffset.tm_hour = (timeOffsetInMinutes % (60 * 24)) / 60;
+        
+        if ( (timeOffset.tm_hour < 0) || (timeOffset.tm_min < 0) )
+        {
+            serializedValue += "-";
+            timeOffset.tm_hour *= -1;
+            timeOffset.tm_min *= -1;
+        }
+        else
+            serializedValue += "+";
+        
+        AxisChar offSetString[6];
+        sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
+        serializedValue += offSetString;
+    }
+
+    
+    IAnySimpleType::serialize(serializedValue.c_str());
+	return m_Buf;
+}
+
+xsd__date* Date::deserializeDate(const AxisChar* valueAsChar) throw (AxisSoapException)
+{
+	struct tm value;
+    struct tm *pTm;
+    AxisChar *cUtc;
+    AxisChar *cTemp;
+    AxisChar *cTemp2;
+
+    // Calculate local timezone offset
+    time_t now = time(NULL);
+    struct tm *temp = gmtime(&now);
+    struct tm utcTime;
+    memcpy(&utcTime, temp, sizeof(struct tm));
+    temp = localtime(&now);
+    struct tm localTime;
+    memcpy(&localTime, temp, sizeof(struct tm));
+
+    long utcTimeInSeconds = (utcTime.tm_year * 60 * 60 * 24 * 365)
+        + (utcTime.tm_yday * 60 * 60 * 24)
+        + (utcTime.tm_hour * 60 * 60)
+        + (utcTime.tm_min * 60);
+
+    long localTimeInSeconds = (localTime.tm_year * 60 * 60 * 24 * 365)
+        + (localTime.tm_yday * 60 * 60 * 24)
+        + (localTime.tm_hour * 60 * 60)
+        + (localTime.tm_min * 60);
+
+    time_t d = utcTimeInSeconds - localTimeInSeconds;
+
+    /* dismantle m_sValue to get tm value;
+     * XSD_DATETIME format is
+     * CCYY(-)MM(-)DDZ OR
+     * CCYY(-)MM(-)DD+/-<UTC TIME DIFFERENCE>
+     */
+    if (sscanf (valueAsChar, "%d-%d-%d", &value.tm_year, 
+        &value.tm_mon, &value.tm_mday) != 3)
+    {
+        AxisString exceptionMessage =
+        "Unable to decompose from string form of DateTime value.  Value =";
+        exceptionMessage += valueAsChar;
+        exceptionMessage += ".";
+            
+        throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
+     }
 
         value.tm_year -= 1900;
         value.tm_mon--;
@@ -251,105 +245,101 @@
 #endif
         cTemp2 = const_cast<char*>(strpbrk (valueAsChar, ":"));
 
-        /* if the timezone is represented adding 'Z' at the end */
-        if ((cTemp = const_cast<char*>(strpbrk (valueAsChar, "Z"))) != NULL)
+    /* if the timezone is represented adding 'Z' at the end */
+    if ((cTemp = const_cast<char*>(strpbrk (valueAsChar, "Z"))) != NULL)
+    {
+        time_t timeInSecs = mktime (&value);
+        if (timeInSecs == -1)
         {
-            time_t timeInSecs = mktime (&value);
-            if (timeInSecs == -1)
-            {
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            pTm = localtime (&timeInSecs);
-            memcpy (&value, pTm, sizeof (tm));
-            time_t t = mktime (&value);
-            if (t == -1)
-            {
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            t = labs (t - d);
-            pTm = localtime (&t);
-        }
-        else if (cTemp2 != NULL)
-        {
-            cUtc = const_cast<char*>(strrchr (valueAsChar, '+'));
-            if (cUtc == NULL)
-            {
-                cUtc = const_cast<char*>(strrchr (valueAsChar, '-'));
-            }
-            time_t timeInSecs = mktime (&value);
-            if (timeInSecs == -1)
-            {
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            
-            int hours = 0;
-            int mins = 0;   
-            if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
-            {
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            
-            int secs = hours * 60 * 60 + mins * 60;
-            if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
-            {
-                timeInSecs -= secs;
-            }
-            else
-            {
-                timeInSecs += secs;
-            }
-            
-            pTm = localtime (&timeInSecs);
-            memcpy (&value, pTm, sizeof (tm));
-            time_t t = mktime (&value);
-            if (t == -1)
-            {
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            t = labs (t - d);
-            pTm = localtime (&t);
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
         }
-        /*if the zone is not represented in the date */
-        else
+        pTm = localtime (&timeInSecs);
+        memcpy (&value, pTm, sizeof (tm));
+        time_t t = mktime (&value);
+        if (t == -1)
         {
-            /*else it is assumed that the sent time is localtime */
-            time_t timeInSecs = mktime (&value);
-            if (timeInSecs == -1)
-            {
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            pTm = localtime (&timeInSecs);
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
         }
-        
-
-        xsd__date * returnValue = new xsd__date;
-        memcpy (returnValue, pTm, sizeof (tm));
-        return returnValue;
-	}
-
-    MinInclusive* Date::getMinInclusive()
-    {
-        return new MinInclusive();
+        t = labs (t - d);
+        pTm = localtime (&t);
     }
-
-    MinExclusive* Date::getMinExclusive()
+    else if (cTemp2 != NULL)
     {
-        return new MinExclusive();
-    }
-
-    MaxInclusive* Date::getMaxInclusive()
-    {
-        return new MaxInclusive();
-    }
-
-    MaxExclusive* Date::getMaxExclusive()
-    {
-        return new MaxExclusive();
-    }
-
-    WhiteSpace* Date::getWhiteSpace()
-    {
-        return new WhiteSpace(COLLAPSE);
-    }
+        cUtc = const_cast<char*>(strrchr (valueAsChar, '+'));
+        if (cUtc == NULL)
+        {
+            cUtc = const_cast<char*>(strrchr (valueAsChar, '-'));
+        }
+        time_t timeInSecs = mktime (&value);
+        if (timeInSecs == -1)
+        {
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
+        
+        int hours = 0;
+        int mins = 0;   
+        if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
+        {
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
+        
+        int secs = hours * 60 * 60 + mins * 60;
+        if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
+            timeInSecs -= secs;
+        else
+            timeInSecs += secs;
+        
+        pTm = localtime (&timeInSecs);
+        memcpy (&value, pTm, sizeof (tm));
+        time_t t = mktime (&value);
+        if (t == -1)
+        {
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
+        t = labs (t - d);
+        pTm = localtime (&t);
+    }
+    /*if the zone is not represented in the date */
+    else
+    {
+        /*else it is assumed that the sent time is localtime */
+        time_t timeInSecs = mktime (&value);
+        if (timeInSecs == -1)
+        {
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
+        pTm = localtime (&timeInSecs);
+    }
+    
+
+    xsd__date * returnValue = new xsd__date;
+    memcpy (returnValue, pTm, sizeof (tm));
+    return returnValue;
+}
+
+MinInclusive* Date::getMinInclusive()
+{
+    return new MinInclusive();
+}
+
+MinExclusive* Date::getMinExclusive()
+{
+    return new MinExclusive();
+}
+
+MaxInclusive* Date::getMaxInclusive()
+{
+    return new MaxInclusive();
+}
+
+MaxExclusive* Date::getMaxExclusive()
+{
+    return new MaxExclusive();
+}
+
+WhiteSpace* Date::getWhiteSpace()
+{
+    return new WhiteSpace(COLLAPSE);
+}
 	
 AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/soap/xsd/DateTime.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/DateTime.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/DateTime.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/DateTime.cpp Wed Nov 22 02:11:36 2006
@@ -17,235 +17,229 @@
 
 AXIS_CPP_NAMESPACE_START
 
-    DateTime::DateTime()
-    {
-    }
-
-    DateTime::~DateTime()
+DateTime::DateTime()
+{
+}
+
+DateTime::~DateTime()
+{
+}
+
+DateTime::DateTime(const xsd__dateTime* value)
+{
+    if (value)
+    {
+        setNil(false);
+        serialize(value);
+    }
+}
+
+XSDTYPE DateTime::getType()
+{
+    return XSD_DATETIME;
+}
+
+xsd__dateTime* DateTime::getDateTime()
+{
+    if (isNil())
+        return NULL;
+    else
+        return deserializeDateTime(m_Buf);
+}
+
+void * DateTime::getValue()
+{
+    return (void*) getDateTime();
+}
+
+AxisChar* DateTime::serialize(const xsd__dateTime* value) throw (AxisSoapException)
+{
+    MinInclusive* minInclusive = getMinInclusive();
+    if (minInclusive->isSet())
     {
+        struct tm minInclusiveAsStructTM = minInclusive->getMinInclusiveAsStructTM();
+        if ( 0 > difftime(mktime(&minInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
+        {
+            AxisString exceptionMessage =
+            "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
+            exceptionMessage += asctime(&minInclusiveAsStructTM);
+            exceptionMessage += ", Value = ";
+            exceptionMessage += asctime(value);
+            exceptionMessage += ".";
+            
+            delete minInclusive;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
+        }
     }
+    delete minInclusive;
 
-    DateTime::DateTime(const xsd__dateTime* value)
+    MinExclusive* minExclusive = getMinExclusive();
+    if (minExclusive->isSet())
     {
-        if (value)
+        struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
+        if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
         {
-            setNil(false);
-            serialize(value);
+            AxisString exceptionMessage =
+            "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
+            exceptionMessage += asctime(&minExclusiveAsStructTM);
+            exceptionMessage += ", Value = ";
+            exceptionMessage += asctime(value);
+            exceptionMessage += ".";
+            
+            delete minExclusive;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
     }
-    
-    XSDTYPE DateTime::getType()
-    {
-        return XSD_DATETIME;
-    }
+    delete minExclusive;
 
-    xsd__dateTime* DateTime::getDateTime()
+    MaxInclusive* maxInclusive = getMaxInclusive();
+    if (maxInclusive->isSet())
     {
-        if (isNil())
-        {
-            return NULL;
-        }
-        else
+        struct tm maxInclusiveAsStructTM = maxInclusive->getMaxInclusiveAsStructTM();
+        if ( 0 < difftime(mktime(&maxInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
         {
-            return deserializeDateTime(m_Buf);
+            AxisString exceptionMessage =
+            "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
+            exceptionMessage += asctime(&maxInclusiveAsStructTM);
+            exceptionMessage += ", Value = ";
+            exceptionMessage += asctime(value);
+            exceptionMessage += ".";
+            
+            delete maxInclusive;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
     }
+    delete maxInclusive;
 
-    void * DateTime::getValue()
+    MaxExclusive* maxExclusive = getMaxExclusive();
+    if (maxExclusive->isSet())
     {
-        return (void*) getDateTime();
-    }
-    
-    AxisChar* DateTime::serialize(const xsd__dateTime* value) throw (AxisSoapException)
-    {
-        MinInclusive* minInclusive = getMinInclusive();
-        if (minInclusive->isSet())
+        struct tm maxExclusiveAsStructTM = maxExclusive->getMaxExclusiveAsStructTM();
+        if ( 0 <= difftime(mktime(&maxExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
         {
-            struct tm minInclusiveAsStructTM = minInclusive->getMinInclusiveAsStructTM();
-            if ( 0 > difftime(mktime(&minInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
-            {
-                AxisString exceptionMessage =
-                "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
-                exceptionMessage += asctime(&minInclusiveAsStructTM);
-                exceptionMessage += ", Value = ";
-                exceptionMessage += asctime(value);
-                exceptionMessage += ".";
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete minInclusive;
-
-        MinExclusive* minExclusive = getMinExclusive();
-        if (minExclusive->isSet())
-        {
-            struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
-            if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
-            {
-                AxisString exceptionMessage =
-                "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
-                exceptionMessage += asctime(&minExclusiveAsStructTM);
-                exceptionMessage += ", Value = ";
-                exceptionMessage += asctime(value);
-                exceptionMessage += ".";
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete minExclusive;
-
-        MaxInclusive* maxInclusive = getMaxInclusive();
-        if (maxInclusive->isSet())
-        {
-            struct tm maxInclusiveAsStructTM = maxInclusive->getMaxInclusiveAsStructTM();
-            if ( 0 < difftime(mktime(&maxInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
-            {
-                AxisString exceptionMessage =
-                "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
-                exceptionMessage += asctime(&maxInclusiveAsStructTM);
-                exceptionMessage += ", Value = ";
-                exceptionMessage += asctime(value);
-                exceptionMessage += ".";
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete maxInclusive;
-
-        MaxExclusive* maxExclusive = getMaxExclusive();
-        if (maxExclusive->isSet())
-        {
-            struct tm maxExclusiveAsStructTM = maxExclusive->getMaxExclusiveAsStructTM();
-            if ( 0 <= difftime(mktime(&maxExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
-            {
-                AxisString exceptionMessage =
-                "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
-                exceptionMessage += asctime(&maxExclusiveAsStructTM);
-                exceptionMessage += ", Value = ";
-                exceptionMessage += asctime(value);
-                exceptionMessage += ".";
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
+            AxisString exceptionMessage =
+            "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
+            exceptionMessage += asctime(&maxExclusiveAsStructTM);
+            exceptionMessage += ", Value = ";
+            exceptionMessage += asctime(value);
+            exceptionMessage += ".";
+            
+            delete maxExclusive;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
-        delete maxExclusive;
+    }
+    delete maxExclusive;
+    
+    AxisString serializedValue = "";
+	AxisChar valueAsString[80];
+	strftime (valueAsString, 80, "%Y-%m-%dT%H:%M:%S", value);
+    serializedValue += valueAsString;
+
+    // Calculate local timezone offset
+    time_t now = time(NULL);
+    struct tm *temp = gmtime(&now);
+    struct tm utcTime;
+    memcpy(&utcTime, temp, sizeof(struct tm));
+    temp = localtime(&now);
+    struct tm localTime;
+    memcpy(&localTime, temp, sizeof(struct tm));
+
+    long utcTimeInMinutes = (utcTime.tm_year * 60 * 24 * 365)
+        + (utcTime.tm_yday * 60 * 24)
+        + (utcTime.tm_hour * 60)
+        + utcTime.tm_min;
+
+    long localTimeInMinutes = (localTime.tm_year * 60 * 24 * 365)
+        + (localTime.tm_yday * 60 * 24)
+        + (localTime.tm_hour * 60)
+        + localTime.tm_min;
+
+    int timeOffsetInMinutes = (int) (localTimeInMinutes - utcTimeInMinutes);
+
+    if (timeOffsetInMinutes == 0)
+        serializedValue += "Z";
+    else
+    {
+        struct tm timeOffset;
+        timeOffset.tm_year = 0;
+        timeOffset.tm_yday = 0;
+        timeOffset.tm_sec = 0;
+        timeOffset.tm_min = timeOffsetInMinutes % 60;
+        timeOffsetInMinutes -= timeOffset.tm_min;
+        timeOffset.tm_hour = (timeOffsetInMinutes % (60 * 24)) / 60;
         
-        AxisString serializedValue = "";
-    	AxisChar* valueAsString = new AxisChar[80];
-    	strftime (valueAsString, 80, "%Y-%m-%dT%H:%M:%S", value);
-        serializedValue += valueAsString;
-        delete [] valueAsString;
-
-        // Calculate local timezone offset
-        time_t now = time(NULL);
-        struct tm *temp = gmtime(&now);
-        struct tm utcTime;
-        memcpy(&utcTime, temp, sizeof(struct tm));
-        temp = localtime(&now);
-        struct tm localTime;
-        memcpy(&localTime, temp, sizeof(struct tm));
-
-        long utcTimeInMinutes = (utcTime.tm_year * 60 * 24 * 365)
-            + (utcTime.tm_yday * 60 * 24)
-            + (utcTime.tm_hour * 60)
-            + utcTime.tm_min;
-
-        long localTimeInMinutes = (localTime.tm_year * 60 * 24 * 365)
-            + (localTime.tm_yday * 60 * 24)
-            + (localTime.tm_hour * 60)
-            + localTime.tm_min;
-
-        int timeOffsetInMinutes = (int) (localTimeInMinutes - utcTimeInMinutes);
-
-        if (timeOffsetInMinutes == 0)
+        if ( (timeOffset.tm_hour < 0) || (timeOffset.tm_min < 0) )
         {
-            serializedValue += "Z";
+            serializedValue += "-";
+            timeOffset.tm_hour *= -1;
+            timeOffset.tm_min *= -1;
         }
         else
-        {
-            struct tm timeOffset;
-            timeOffset.tm_year = 0;
-            timeOffset.tm_yday = 0;
-            timeOffset.tm_sec = 0;
-            timeOffset.tm_min = timeOffsetInMinutes % 60;
-            timeOffsetInMinutes -= timeOffset.tm_min;
-            timeOffset.tm_hour = (timeOffsetInMinutes % (60 * 24)) / 60;
-            
-            if ( (timeOffset.tm_hour < 0) || (timeOffset.tm_min < 0) )
-            {
-                serializedValue += "-";
-                timeOffset.tm_hour *= -1;
-                timeOffset.tm_min *= -1;
-            }
-            else
-            {
-                serializedValue += "+";
-            }
-            
-            AxisChar * offSetString = new AxisChar[6];
-            sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
-            serializedValue += offSetString;
-            delete [] offSetString;
-        }
-
+            serializedValue += "+";
         
-        IAnySimpleType::serialize(serializedValue.c_str());
-		return m_Buf;
+        AxisChar offSetString[6];
+        sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
+        serializedValue += offSetString;
     }
-	
-    xsd__dateTime* DateTime::deserializeDateTime(const AxisChar* valueAsChar) throw (AxisSoapException)
-    {
-    	struct tm value;
-    	struct tm* pTm;
-	    AxisChar *cUtc;
-	    AxisChar *cTemp;
-	    AxisChar *cTemp2;
-	    AxisChar *cTemp3;
-
-        // Calculate local timezone offset
-        time_t now = time(NULL);
-        struct tm *temp = gmtime(&now);
-        struct tm utcTime;
-        memcpy(&utcTime, temp, sizeof(struct tm));
-        temp = localtime(&now);
-        struct tm localTime;
-        memcpy(&localTime, temp, sizeof(struct tm));
-
-        long utcTimeInSeconds = (utcTime.tm_year * 60 * 60 * 24 * 365)
-            + (utcTime.tm_yday * 60 * 60 * 24)
-            + (utcTime.tm_hour * 60 * 60)
-            + (utcTime.tm_min * 60);
-
-        long localTimeInSeconds = (localTime.tm_year * 60 * 60 * 24 * 365)
-            + (localTime.tm_yday * 60 * 60 * 24)
-            + (localTime.tm_hour * 60 * 60)
-            + (localTime.tm_min * 60);
-
-        time_t d = utcTimeInSeconds - localTimeInSeconds;
-
-
-	
-        /* dismantle valueAsChar to get tm value;
-         * XSD_DATETIME format is
-         * CCYY(-)MM(-)DDThh:mm:ss.ss...Z OR
-         * CCYY(-)MM(-)DDThh:mm:ss.ss...+/-<UTC TIME DIFFERENCE>
-         */
-        if (sscanf (valueAsChar, "%d-%d-%dT%d:%d:%d", &value.tm_year,
-            &value.tm_mon, &value.tm_mday, &value.tm_hour, &value.tm_min, 
-			&value.tm_sec) != 6)
-		{
-            AxisString exceptionMessage =
-            "Unable to decompose from string form of DateTime value.  Value =";
-            exceptionMessage += valueAsChar;
-            exceptionMessage += ".";
+
+    
+    IAnySimpleType::serialize(serializedValue.c_str());
+	return m_Buf;
+}
+
+xsd__dateTime* DateTime::deserializeDateTime(const AxisChar* valueAsChar) throw (AxisSoapException)
+{
+	struct tm value;
+	struct tm* pTm;
+    AxisChar *cUtc;
+    AxisChar *cTemp;
+    AxisChar *cTemp2;
+    AxisChar *cTemp3;
+
+    // Calculate local timezone offset
+    time_t now = time(NULL);
+    struct tm *temp = gmtime(&now);
+    struct tm utcTime;
+    memcpy(&utcTime, temp, sizeof(struct tm));
+    temp = localtime(&now);
+    struct tm localTime;
+    memcpy(&localTime, temp, sizeof(struct tm));
+
+    long utcTimeInSeconds = (utcTime.tm_year * 60 * 60 * 24 * 365)
+        + (utcTime.tm_yday * 60 * 60 * 24)
+        + (utcTime.tm_hour * 60 * 60)
+        + (utcTime.tm_min * 60);
+
+    long localTimeInSeconds = (localTime.tm_year * 60 * 60 * 24 * 365)
+        + (localTime.tm_yday * 60 * 60 * 24)
+        + (localTime.tm_hour * 60 * 60)
+        + (localTime.tm_min * 60);
+
+    time_t d = utcTimeInSeconds - localTimeInSeconds;
+
+
+
+    /* dismantle valueAsChar to get tm value;
+     * XSD_DATETIME format is
+     * CCYY(-)MM(-)DDThh:mm:ss.ss...Z OR
+     * CCYY(-)MM(-)DDThh:mm:ss.ss...+/-<UTC TIME DIFFERENCE>
+     */
+    if (sscanf (valueAsChar, "%d-%d-%dT%d:%d:%d", &value.tm_year,
+        &value.tm_mon, &value.tm_mday, &value.tm_hour, &value.tm_min, 
+		&value.tm_sec) != 6)
+	{
+        AxisString exceptionMessage =
+        "Unable to decompose from string form of DateTime value.  Value =";
+        exceptionMessage += valueAsChar;
+        exceptionMessage += ".";
             
-            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+        throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
+     }
 
         value.tm_year -= 1900;
         value.tm_mon--;
@@ -255,115 +249,109 @@
         value.tm_gmtoff = -1;
 #endif
         cTemp2 = const_cast<char*>(strpbrk (valueAsChar, "T"));
-        cTemp3 = strrchr (cTemp2, ':');
-        cTemp3[0] = '\0';
-        unsigned long len = strlen (cTemp2);
-        cTemp3[0] = ':';
-
-        /*if the timezone is represented adding 'Z' at the end */
-        if ((cTemp = const_cast<char*>(strpbrk (valueAsChar, "Z"))) != NULL)
-        {
-            time_t tempmktime = mktime (&value); // convert tm object to seconds
-            if (tempmktime == -1)
-            {
-            	throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            pTm = localtime (&tempmktime); // construct tm object from seconds
-            memcpy (&value, pTm, sizeof (tm));
-            time_t t = mktime (&value);
-            if (t == -1)
-            {
-              throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-
-            t = labs (t - d);
-            pTm = localtime (&t);
-        }
-        /*if the timezone is represented using +/-hh:mm format */
-        else if (len > (sizeof (char) * 6))
-        {
-            cUtc = strpbrk (cTemp2, "+");
-            if (cUtc == NULL)
-            {
-                cUtc = strpbrk (cTemp2, "-");
-            }
-            
-            time_t timeInSecs = mktime (&value);
-            if (timeInSecs == -1)
-            {
-            	throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            
-            int hours = 0;
-            int minutes = 0;
-
-            if (sscanf (cUtc + 1, "%d:%d", &hours, &minutes) != 2)
-            {
-            	throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-
-            int secs = hours * 60 * 60 + minutes * 60;
-            if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
-            {
-                timeInSecs -= secs;
-            }
-            else
-            {
-                timeInSecs += secs;
-            }
-
-            pTm = localtime (&timeInSecs);
-            memcpy (&value, pTm, sizeof (tm));
-            time_t t = mktime (&value);
-            if (t == -1)
-            {
-            	throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
+    cTemp3 = strrchr (cTemp2, ':');
+    cTemp3[0] = '\0';
+    unsigned long len = strlen (cTemp2);
+    cTemp3[0] = ':';
 
-            t = labs (t - d);
-            pTm = localtime (&t);
+    /*if the timezone is represented adding 'Z' at the end */
+    if ((cTemp = const_cast<char*>(strpbrk (valueAsChar, "Z"))) != NULL)
+    {
+        time_t tempmktime = mktime (&value); // convert tm object to seconds
+        if (tempmktime == -1)
+        {
+        	throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
         }
-        /*if the zone is not represented in the date */
-        else
+        pTm = localtime (&tempmktime); // construct tm object from seconds
+        memcpy (&value, pTm, sizeof (tm));
+        time_t t = mktime (&value);
+        if (t == -1)
         {
-            /*else it is assumed that the sent time is localtime */
-            time_t timeInSecs = mktime (&value);
-            if (timeInSecs == -1)
-            {
-		    	throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            pTm = localtime (&timeInSecs);
+          throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
         }
+
+        t = labs (t - d);
+        pTm = localtime (&t);
+    }
+    /*if the timezone is represented using +/-hh:mm format */
+    else if (len > (sizeof (char) * 6))
+    {
+        cUtc = strpbrk (cTemp2, "+");
+        if (cUtc == NULL)
+            cUtc = strpbrk (cTemp2, "-");
         
-        xsd__dateTime * returnValue = new xsd__dateTime;
-        memcpy (returnValue, pTm, sizeof (tm));
+        time_t timeInSecs = mktime (&value);
+        if (timeInSecs == -1)
+        {
+        	throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
         
-        return returnValue;
-    }
+        int hours = 0;
+        int minutes = 0;
 
-    MinInclusive* DateTime::getMinInclusive()
-    {
-        return new MinInclusive();
-    }
+        if (sscanf (cUtc + 1, "%d:%d", &hours, &minutes) != 2)
+        {
+        	throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
 
-    MinExclusive* DateTime::getMinExclusive()
-    {
-        return new MinExclusive();
-    }
+        int secs = hours * 60 * 60 + minutes * 60;
+        if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
+            timeInSecs -= secs;
+        else
+            timeInSecs += secs;
 
-    MaxInclusive* DateTime::getMaxInclusive()
-    {
-        return new MaxInclusive();
-    }
+        pTm = localtime (&timeInSecs);
+        memcpy (&value, pTm, sizeof (tm));
+        time_t t = mktime (&value);
+        if (t == -1)
+        {
+        	throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
 
-    MaxExclusive* DateTime::getMaxExclusive()
-    {
-        return new MaxExclusive();
+        t = labs (t - d);
+        pTm = localtime (&t);
     }
-
-    WhiteSpace* DateTime::getWhiteSpace()
+    /*if the zone is not represented in the date */
+    else
     {
-        return new WhiteSpace(COLLAPSE);
+        /*else it is assumed that the sent time is localtime */
+        time_t timeInSecs = mktime (&value);
+        if (timeInSecs == -1)
+        {
+	    	throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
+        pTm = localtime (&timeInSecs);
     }
+    
+    xsd__dateTime * returnValue = new xsd__dateTime;
+    memcpy (returnValue, pTm, sizeof (tm));
+    
+    return returnValue;
+}
+
+MinInclusive* DateTime::getMinInclusive()
+{
+    return new MinInclusive();
+}
+
+MinExclusive* DateTime::getMinExclusive()
+{
+    return new MinExclusive();
+}
+
+MaxInclusive* DateTime::getMaxInclusive()
+{
+    return new MaxInclusive();
+}
+
+MaxExclusive* DateTime::getMaxExclusive()
+{
+    return new MaxExclusive();
+}
+
+WhiteSpace* DateTime::getWhiteSpace()
+{
+    return new WhiteSpace(COLLAPSE);
+}
 
 AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/soap/xsd/Decimal.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/Decimal.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Decimal.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Decimal.cpp Wed Nov 22 02:11:36 2006
@@ -42,13 +42,9 @@
 xsd__decimal* Decimal::getDecimal()
 {
     if (isNil())
-    {
         return NULL;
-    }
     else
-    {
         return deserializeDecimal(m_Buf);
-    }
 }
 
 void * Decimal::getValue()
@@ -60,91 +56,83 @@
 {
     MinInclusive* minInclusive = getMinInclusive();
     if (minInclusive->isSet())
-    {
         if ( *value < minInclusive->getMinInclusiveAsDouble() )
         {
             AxisString exceptionMessage =
             "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
-            AxisChar* length = new AxisChar[25];
+            AxisChar length[100];
             sprintf(length, "%f", minInclusive->getMinInclusiveAsDouble());
             exceptionMessage += length;
             exceptionMessage += ", Value = ";
             sprintf(length, "%f", *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete minInclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
-    }
     delete minInclusive;
 
     MinExclusive* minExclusive = getMinExclusive();
     if (minExclusive->isSet())
-    {
         if ( *value <= minExclusive->getMinExclusiveAsDouble() )
         {
             AxisString exceptionMessage =
             "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
-            AxisChar* length = new AxisChar[25];
+            AxisChar length[100];
             sprintf(length, "%f", minExclusive->getMinExclusiveAsDouble());
             exceptionMessage += length;
             exceptionMessage += ", Value = ";
             sprintf(length, "%f", *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete minExclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
-    }
     delete minExclusive;
 
 
     MaxInclusive* maxInclusive = getMaxInclusive();
     if (maxInclusive->isSet())
-    {
         if ( *value > maxInclusive->getMaxInclusiveAsDouble() )
         {
             AxisString exceptionMessage =
             "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
-            AxisChar* length = new AxisChar[25];
+            AxisChar length[100];
             sprintf(length, "%f", maxInclusive->getMaxInclusiveAsDouble());
             exceptionMessage += length;
             exceptionMessage += ", Value = ";
             sprintf(length, "%f", *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete maxInclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
-    }
     delete maxInclusive;
 
     MaxExclusive* maxExclusive = getMaxExclusive();
     if (maxExclusive->isSet())
-    {
         if ( *value >= maxExclusive->getMaxExclusiveAsDouble() )
         {
             AxisString exceptionMessage =
             "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
-            AxisChar* length = new AxisChar[25];
+            AxisChar length[100];
             sprintf(length, "%f", maxExclusive->getMaxExclusiveAsDouble());
             exceptionMessage += length;
             exceptionMessage += ", Value = ";
             sprintf(length, "%f", *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete maxExclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
-    }
     delete maxExclusive;
 
 
@@ -155,10 +143,9 @@
     if (totalDigits->isSet())
     {
         valueSize = totalDigits->getTotalDigits() + 1;
-        AxisChar* digits = new char[10];
+        AxisChar digits[100];
         AxisSprintf (digits, 10, "%i", totalDigits->getTotalDigits());
         formatSpecifier += digits;
-        delete [] digits;
     }
     delete totalDigits;
     
@@ -166,10 +153,9 @@
     if (fractionDigits->isSet())
     {
         formatSpecifier += ".";
-        AxisChar* digits = new char[10];
+        AxisChar digits[100];
         AxisSprintf (digits, 10, "%i", fractionDigits->getFractionDigits());
         formatSpecifier += digits;
-        delete [] digits;
     }
     delete fractionDigits;
     

Modified: webservices/axis/trunk/c/src/soap/xsd/Double.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/Double.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Double.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Double.cpp Wed Nov 22 02:11:36 2006
@@ -56,7 +56,6 @@
 {
     MinInclusive* minInclusive = getMinInclusive();
     if (minInclusive->isSet())
-    {
         if ( *value < minInclusive->getMinInclusiveAsDouble() )
         {
             AxisString exceptionMessage =
@@ -69,18 +68,14 @@
             exceptionMessage += length;
             exceptionMessage += ".";
             
-            if (minInclusive)
-                delete minInclusive;
-            
+            delete minInclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
-    }
     delete minInclusive;
 
     MinExclusive* minExclusive = getMinExclusive();
     if (minExclusive->isSet())
-    {
         if ( *value <= minExclusive->getMinExclusiveAsDouble() )
         {
             AxisString exceptionMessage =
@@ -93,19 +88,15 @@
             exceptionMessage += length;
             exceptionMessage += ".";
             
-            if (minExclusive)
-                delete minExclusive;
-            
+            delete minExclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
-    }
     delete minExclusive;
  
 
     MaxInclusive* maxInclusive = getMaxInclusive();
     if (maxInclusive->isSet())
-    {
         if ( *value > maxInclusive->getMaxInclusiveAsDouble() )
         {
             AxisString exceptionMessage =
@@ -117,19 +108,15 @@
             sprintf(length, "%f", *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            
-            if (maxInclusive)
-                delete maxInclusive;
-            
+           
+            delete maxInclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
-    }
     delete maxInclusive;
 
     MaxExclusive* maxExclusive = getMaxExclusive();
     if (maxExclusive->isSet())
-    {
         if ( *value >= maxExclusive->getMaxExclusiveAsDouble() )
         {
             AxisString exceptionMessage =
@@ -142,13 +129,11 @@
             exceptionMessage += length;
             exceptionMessage += ".";
             
-            if (maxExclusive)
-                delete maxExclusive;
+            delete maxExclusive;
             
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
-    }
     delete maxExclusive;
 
  



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message