You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2006/11/22 08:05:15 UTC

svn commit: r478055 - in /webservices/axis/trunk/c: include/axis/ src/common/ src/engine/ src/soap/ src/transport/axis3/ src/wsdd/ src/xml/

Author: nadiramra
Date: Tue Nov 21 23:05:13 2006
New Revision: 478055

URL: http://svn.apache.org/viewvc?view=rev&rev=478055
Log:
AXISCPP-943 stage 1. Exception messages for exception codes
are all in AxisException.hpp. Simplifies things and removes 
the .cpp files for the exceptions that inherit from AxisException. 
Also makes sense since the exception codes are defined in 
AxisException.

Removed:
    webservices/axis/trunk/c/src/common/AxisConfigException.cpp
    webservices/axis/trunk/c/src/common/AxisGenException.cpp
    webservices/axis/trunk/c/src/common/AxisMessage.cpp
    webservices/axis/trunk/c/src/common/AxisMessage.h
    webservices/axis/trunk/c/src/engine/AxisEngineException.cpp
    webservices/axis/trunk/c/src/soap/AxisSoapException.cpp
    webservices/axis/trunk/c/src/transport/axis3/HTTPTransportException.cpp
    webservices/axis/trunk/c/src/wsdd/AxisWsddException.cpp
    webservices/axis/trunk/c/src/xml/AxisParseException.cpp
Modified:
    webservices/axis/trunk/c/include/axis/AxisException.hpp
    webservices/axis/trunk/c/src/common/AxisConfigException.h
    webservices/axis/trunk/c/src/common/AxisGenException.h
    webservices/axis/trunk/c/src/engine/AxisEngineException.h
    webservices/axis/trunk/c/src/soap/AxisSoapException.h
    webservices/axis/trunk/c/src/soap/OtherFaultException.cpp
    webservices/axis/trunk/c/src/soap/SoapFaultException.cpp
    webservices/axis/trunk/c/src/transport/axis3/HTTPTransportException.hpp
    webservices/axis/trunk/c/src/wsdd/AxisWsddException.h
    webservices/axis/trunk/c/src/xml/AxisParseException.h

Modified: webservices/axis/trunk/c/include/axis/AxisException.hpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/include/axis/AxisException.hpp?view=diff&rev=478055&r1=478054&r2=478055
==============================================================================
--- webservices/axis/trunk/c/include/axis/AxisException.hpp (original)
+++ webservices/axis/trunk/c/include/axis/AxisException.hpp Tue Nov 21 23:05:13 2006
@@ -413,11 +413,11 @@
  *
  *   @author Damitha Kumarage (damitha@opensource.lk, damitha@jkcsworld.com)
  */
-class STORAGE_CLASS_INFO AxisException :public exception
+class STORAGE_CLASS_INFO AxisException : public exception
 {
 public:
     /** No parameter constructor*/
-    AxisException():m_iExceptionCode(0), m_sMessage(NULL){};
+    AxisException():m_iExceptionCode(0), m_sMessage("") { }
 
     /** This can be used to throw an exception with exception code which is
       * is defined in the AxisException.h file, under AXISC_EXCEPTIONS type.
@@ -433,7 +433,7 @@
       *                     "Some additional exception info");
         </pre>
       */
-    AxisException(const int iExceptionCode, const char* pcMessage = NULL):m_iExceptionCode(iExceptionCode), m_sMessage(NULL)
+    AxisException(int iExceptionCode, const char* pcMessage = NULL):m_iExceptionCode(iExceptionCode)
     {
         setMessage(pcMessage);    
     }
@@ -449,16 +449,13 @@
       * throw AxisException(std::bad_alloc);
       * </pre>
       */
-    AxisException(const AxisException& e):m_iExceptionCode(e.m_iExceptionCode), m_sMessage(NULL)
+    AxisException(const AxisException& e):m_iExceptionCode(e.m_iExceptionCode)
     {
-        setMessage(e.m_sMessage);
-    };
+        setMessage(e.m_sMessage.c_str());
+    }
     
     /** Destructor */
-    virtual ~AxisException() throw()
-    {
-        delete [] m_sMessage;
-    };
+    virtual ~AxisException() throw() { }
 
     /**
      *  This method is defined in std::exception. AxisException and derived
@@ -466,7 +463,7 @@
      * 
      * @return Exception message
      */
-    virtual const char* what() const throw() { return m_sMessage; };
+    virtual const char* what() const throw() { return m_sMessage.c_str(); }
 
     /**
      * This can be called to get the exception code.
@@ -497,16 +494,22 @@
       * 
       * @param psMessage The exception message to be set.
       */
-    void setMessage(const char* psMessage)
+    void setMessage(const char* psMessage) { m_sMessage = psMessage ? psMessage : "";  }
+     
+    /**
+      * The method setMessage(std::string psMessage) uses to set the code and message.
+      * This method will retrieve the corresponding message for the exceptionCode and then append 
+      * the detailMessage if set.
+      * 
+      * @param exceptionCode The exception code for which message is to be retrieved.
+      * @param defaultMsg    If exception code cannot be mapped to message, this will be used.
+      * @param detailMessage Additional message information that will be appended to the exception message.
+      */
+    void setMessage(int exceptionCode, const char *defaultMsg, const char* detailMessage=NULL)
     {
-        delete [] m_sMessage;
-        m_sMessage = NULL;
-
-        if (psMessage)
-        {
-            m_sMessage = new char[strlen(psMessage) + 1];
-            strcpy(m_sMessage,psMessage);
-        }        
+        m_iExceptionCode = exceptionCode;
+        std::string sMessage = detailMessage ? detailMessage : "";
+        m_sMessage = getMessageForExceptionCode(exceptionCode, defaultMsg) + " " + sMessage;
     }
     
     /** 
@@ -517,7 +520,7 @@
     void setExceptionFromException(const AxisException& e)
     {
         m_iExceptionCode = e.m_iExceptionCode;
-        setMessage(e.m_sMessage);
+        m_sMessage       = e.m_sMessage;
     }
 
     /**
@@ -527,8 +530,238 @@
     void resetException()
     {
         m_iExceptionCode = 0;
-        setMessage((const char *)NULL);
+        m_sMessage       = "";
     }
+    
+    /**
+     * This method is used to map AXIS exception code to a text message. Primarily used
+     * by classes that inherit from AxisException. 
+     * 
+     * @param exceptionCode The exception code for which message is to be retrieved.
+     * @param defaultMsg    If exception code cannot be mapped to message, this will be returned.
+     */
+     static std::string getMessageForExceptionCode(int exceptionCode, const char *defaultMsg=NULL)
+     {
+        std::string sMsg;
+        
+        switch (exceptionCode)
+        {
+            case SOAP_VERSION_MISMATCH:
+                sMsg = "AxisSoapException: Soap VersionMismatch fault occurred.";
+                break;
+            case SOAP_MUST_UNDERSTAND:    
+                sMsg = "AxisSoapException: Soap MustUnderstand fault occurred.";
+                break;
+            case CLIENT_SOAP_MESSAGE_INCOMPLETE:
+                sMsg = "AxisSoapException: Received message is incomplete.";
+                break;
+            case CLIENT_SOAP_SOAP_ACTION_EMTPY:
+                sMsg = "AxisSoapException: SOAPAction HTTP header is empty.";
+                break;
+            case CLIENT_SOAP_SOAP_CONTENT_ERROR:
+                sMsg = "AxisSoapException: Received content is faulty.";
+                break;
+            case CLIENT_SOAP_NO_SOAP_METHOD:
+                sMsg = "AxisSoapException: Request method is not a soap method.";
+                break;
+            case CLIENT_SOAP_CONTENT_NOT_SOAP:
+                sMsg = "AxisSoapException: Content is not a valid soap message.";
+                break;
+            case CLIENT_WSDD_SERVICE_NOT_FOUND:
+                sMsg = "AxisWsddException: Requested service not found.";
+                break;
+            case CLIENT_WSDD_METHOD_NOT_ALLOWED:
+                sMsg = "AxisWsddException: Requested method is not allowed.";
+                break;
+            case CLIENT_WSDD_PARA_TYPE_MISMATCH:
+                sMsg = "AxisWsddException: Parameter type mismatch.";
+                break;
+            case CLIENT_ENGINE_CLIENT_HANDLER_FAILED:
+                sMsg = "AxisEngineException: Client handler failed.";
+                break;
+            case CLIENT_TRANSPORT_EXCEPTION:
+                sMsg = "HTTPTransportException: Client transport exception.";
+                break;
+            case CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED:
+                sMsg = "HTTPTransportException: Client failed to open.";
+                break;
+            case CLIENT_TRANSPORT_TYPE_MISMATCH:
+                sMsg = "HTTPTransportException: Client attempted to use SSL functions without the proper prerequisites.";
+                break;
+            case CLIENT_TRANSPORT_HAS_NO_UNSECURE_TRANSPORT_LAYER:
+                sMsg = "HTTPTransportException: Client attempted to use non-existant unsecure transport (http).";
+                break;
+            case CLIENT_TRANSPORT_HAS_NO_SECURE_TRANSPORT_LAYER:
+                sMsg = "HTTPTransportException: Client attempted to use non-existant secure transport (https).";
+                break;
+            case CLIENT_MIME_CONTENT_ID_NOT_UNIQUE:
+                sMsg = "AxisSoapException: Content is not unique within the MIME message.";
+                break;
+            case SERVER_ENGINE_EXCEPTION:
+                sMsg = "AxisEngineException: Exception occurred.";
+                break;
+            case SERVER_ENGINE_COULD_NOT_LOAD_SRV:
+                sMsg = "AxisEngineException: Could not load service.";
+                break;
+            case SERVER_ENGINE_COULD_NOT_LOAD_HDL:
+                sMsg = "AxisEngineException: Could not load handler.";
+                break;
+            case SERVER_ENGINE_LOADING_TRANSPORT_FAILED:
+                sMsg = "AxisEngineException: Failed to load transport library.";
+                break;
+            case SERVER_ENGINE_LOADING_PARSER_FAILED:
+                sMsg = "AxisEngineException: Failed to load parser library.";
+                break;
+            case SERVER_ENGINE_HANDLER_FAILED:
+                sMsg = "AxisEngineException: Handler failed.";
+                break;
+            case SERVER_ENGINE_WEBSERVICE_FAILED:
+                sMsg = "AxisEngineException: Web service failed.";
+                break;
+            case SERVER_ENGINE_HANDLER_INIT_FAILED:
+                sMsg = "AxisEngineException: Handler initialization failed.";
+                break;
+            case SERVER_ENGINE_HANDLER_CREATION_FAILED:
+                sMsg = "AxisEngineException: Handler creation failed.";
+                break;
+            case SERVER_ENGINE_LIBRARY_LOADING_FAILED:
+                sMsg = "AxisEngineException: Library loading failed.";
+                break;
+            case SERVER_ENGINE_HANDLER_NOT_LOADED:
+                sMsg = "AxisEngineException: Handler is not loaded.";
+                break;
+            case SERVER_ENGINE_HANDLER_BEING_USED:
+                sMsg = "AxisEngineException: Handler is being used.";
+                break;
+            case SERVER_ENGINE_GET_HANDLER_FAILED:
+                sMsg = "AxisEngineException: Failed to get handler.";
+                break;
+            case SERVER_ENGINE_WRONG_HANDLER_TYPE:
+                sMsg = "AxisEngineException: Wrong handler type.";
+                break;
+            case SERVER_CONFIG_EXCEPTION:
+                sMsg = "AxisConfigException: Exception occurred.";
+                break;
+            case SERVER_CONFIG_TRANSPORT_CONF_FAILED:
+                sMsg = "AxisConfigException: Transport layer is not configured properly.";
+                break;
+            case SERVER_CONFIG_LIBRARY_PATH_EMPTY:
+                sMsg = "AxisConfigException: Library path is empty (not in server.wsdd file).";
+                break;
+            case SERVER_WSDD_FILE_NOT_FOUND:
+                sMsg = "AxisWsddException: Unable to load file.";
+                break;
+            case SERVER_WSDD_EXCEPTION:
+                sMsg = "AxisWsddException: Exception occurred.";
+                break;
+            case SERVER_WSDD_NO_HANDLERS_CONFIGURED:
+                sMsg = "AxisWsddException: No handlers configured in server.wsdd file.";
+                break;
+            case SERVER_SOAP_EXCEPTION:
+                sMsg = "AxisSoapException: Exception occurred.";
+                break;
+            case SERVER_TRANSPORT_EXCEPTION:
+                sMsg = "HTTPTransportException: Exception occurred.";
+                break;
+            case CLIENT_SSLCHANNEL_RECEPTION_EXCEPTION:
+            case SERVER_TRANSPORT_RECEPTION_EXCEPTION:
+                sMsg = "HTTPTransportException: Problem occurred when receiving the stream.";
+                break;
+            case CLIENT_SSLCHANNEL_SENDING_EXCEPTION:
+            case SERVER_TRANSPORT_SENDING_EXCEPTION:
+                sMsg = "HTTPTransportException: Problem occurred when sending the stream.";
+                break;
+            case SERVER_TRANSPORT_PROCESS_EXCEPTION:
+                sMsg = "HTTPTransportException: Cannot process response message.";
+                break;
+            case SERVER_TRANSPORT_UNKNOWN_HTTP_RESPONSE:
+                sMsg = "HTTPTransportException: Unknown HTTP response, cannot process response message.";
+                break;
+            case CLIENT_SSLCHANNEL_CONTEXT_CREATE_ERROR:
+                sMsg = "HTTPTransportException: Context creation error.";
+                break;
+            case CLIENT_SSLCHANNEL_ERROR:
+                sMsg = "HTTPTransportException: HTTPS transport error.";
+                break;
+            case SERVER_TRANSPORT_HTTP_EXCEPTION:
+                sMsg = "HTTPTransportException: HTTP transport error.";
+                break;
+            case SERVER_TRANSPORT_UNEXPECTED_STRING:
+                sMsg = "HTTPTransportException: Unexpected string received.";
+                break;
+            case CLIENT_SSLCHANNEL_CHANNEL_INIT_ERROR:    
+            case SERVER_TRANSPORT_CHANNEL_INIT_ERROR:
+                sMsg = "HTTPTransportException: Cannot initialize a channel to the remote end.";
+                break;
+            case CLIENT_SSLCHANNEL_SOCKET_CREATE_ERROR:                
+            case SERVER_TRANSPORT_SOCKET_CREATE_ERROR:
+                sMsg = "AxisTransportException: Unable to create a socket.";
+                break;
+            case CLIENT_SSLCHANNEL_SOCKET_CONNECT_ERROR:                
+            case SERVER_TRANSPORT_SOCKET_CONNECT_ERROR:
+                sMsg = "AxisTransportException: Cannot open a channel to the remote end.";
+                break;
+            case CLIENT_SSLCHANNEL_INVALID_SOCKET_ERROR:                
+            case SERVER_TRANSPORT_INVALID_SOCKET:
+                sMsg = "AxisTransportException: Socket not valid.";
+                break;
+            case SERVER_TRANSPORT_OUTPUT_STREAMING_ERROR:
+                sMsg = "HTTPTransportException: Output streaming error while writing to channel.";
+                break;
+            case SERVER_TRANSPORT_INPUT_STREAMING_ERROR:
+                sMsg = "HTTPTransportException: Input streaming error while reading from channel.";
+                break;
+            case SERVER_TRANSPORT_TIMEOUT_EXCEPTION:
+                sMsg = "HTTPTransportException: Channel error while doing a timed wait.";
+                break;
+            case SERVER_TRANSPORT_TIMEOUT_EXPIRED:
+                sMsg = "HTTPTransportException: Channel I/O operation timed out.";
+                break;
+            case SERVER_TRANSPORT_LOADING_SSLCHANNEL_FAILED:
+            case SERVER_TRANSPORT_LOADING_CHANNEL_FAILED:
+                sMsg = "HTTPTransportException: Unable to load channel library.";
+                break;
+            case SERVER_TRANSPORT_BUFFER_EMPTY:
+                sMsg = "HTTPTransportException: Transport buffer is empty.";
+                break;
+            case SERVER_PARSE_BUFFER_EMPTY:
+                sMsg = "AxisParseException: Buffer received from the parser is empty.";
+                break;
+            case SERVER_PARSE_PARSER_FAILED: 
+                sMsg = "AxisParseException: XML_STATUS_ERROR thrown from parser.";
+                break;
+            case SERVER_PARSE_TRANSPORT_FAILED:
+                sMsg = "AxisParseException: Error when getting the byte stream from the transport.";
+                break;
+            case SERVER_TEST_EXCEPTION:
+                sMsg = "This is a testing error.";
+                break;
+            case SERVER_CLIENT_ENGINE_MISMATCH:
+                sMsg = "AxisEngineException: Engine cannot be initialized as both client and server.";
+                break;
+            case AXISC_SERVICE_THROWN_EXCEPTION:
+                sMsg = "A service has thrown an exception.";
+                break;
+            case AXISC_UNKNOWN_ELEMENT_EXCEPTION:
+                sMsg = "AxisParseException: Unknown element encountered.";
+                break;
+            case AXISC_NODE_VALUE_MISMATCH_EXCEPTION:
+                sMsg = "Cannot deserialize the requested element.";
+                break;
+            case AXISC_READ_CONF_EXCEPTION:
+                sMsg = "AxisConfigException: Unable to read configuration file.";
+                break;
+            case CONFIG_DEFAULTS_ALREADY_SET:  
+                sMsg = "AxisConfigException: Configuration defaults have already been set.";
+                break;
+            case SERVER_UNKNOWN_ERROR:
+            default:    
+                sMsg= defaultMsg ? defaultMsg : "AxisException:";      
+                break;
+        }
+        
+        return sMsg;
+     }
 
 protected:
     /**
@@ -539,10 +772,9 @@
 
     /**
       * This data member is common to all the inherited classes of this base class.
-      * The char* variable m_sMessage is used to store the Exception message
-      * Whenever you want to set this variable use method setMessage(std::string psMessage)
+      * The variable m_sMessage is used to store the Exception message
       */
-    char* m_sMessage;
+    std::string m_sMessage;
 };
 
 AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/common/AxisConfigException.h
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/common/AxisConfigException.h?view=diff&rev=478055&r1=478054&r2=478055
==============================================================================
--- webservices/axis/trunk/c/src/common/AxisConfigException.h (original)
+++ webservices/axis/trunk/c/src/common/AxisConfigException.h Tue Nov 21 23:05:13 2006
@@ -21,24 +21,26 @@
 #ifndef __AXISCONFIGEXCEPTION_H_OF_AXIS_INCLUDED_
 #define __AXISCONFIGEXCEPTION_H_OF_AXIS_INCLUDED_
 
-#include <string>
 #include <axis/AxisException.hpp>
 
 AXIS_CPP_NAMESPACE_START
 
 using namespace std;
 
-class STORAGE_CLASS_INFO AxisConfigException :public AxisException
+class STORAGE_CLASS_INFO AxisConfigException : public AxisException
 {
-
 public:
-    AxisConfigException(const int iExceptionCode, const char* pcMessage = NULL);
-    AxisConfigException(const AxisConfigException& e);
-    virtual ~AxisConfigException() throw();
-        
-private:
-    string getMessageForExceptionCode(const int iExceptionCode);
-	std::string m_sMessageForExceptionCode;
+    // constructor
+    AxisConfigException(int iExceptionCode, const char* pcMessage = NULL): AxisException()
+    {
+        setMessage(iExceptionCode, "AxisConfigException:", pcMessage);
+    }
+    
+    // constructor
+    AxisConfigException(const AxisConfigException& e): AxisException(e) { }
+    
+    // destructor
+    virtual ~AxisConfigException() throw() { }
 };
 
 AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/common/AxisGenException.h
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/common/AxisGenException.h?view=diff&rev=478055&r1=478054&r2=478055
==============================================================================
--- webservices/axis/trunk/c/src/common/AxisGenException.h (original)
+++ webservices/axis/trunk/c/src/common/AxisGenException.h Tue Nov 21 23:05:13 2006
@@ -22,8 +22,6 @@
 #ifndef __AXISGENEXCEPTION_H_OF_AXIS_INCLUDED_
 #define __AXISGENEXCEPTION_H_OF_AXIS_INCLUDED_
 
-#include <string>
-#include <exception>
 #include <axis/AxisException.hpp>
 
 AXIS_CPP_NAMESPACE_START
@@ -34,13 +32,12 @@
 {
 
 public:
-    AxisGenException(const int iExceptionCode, const char* pcMessage = NULL);
-	AxisGenException(const AxisGenException& e);
-    virtual ~AxisGenException() throw();
-    
-private:
-    string getMessageForExceptionCode(const int iExceptionCode);
-	std::string m_sMessageForExceptionCode;
+    AxisGenException(int iExceptionCode, const char* pcMessage = NULL): AxisException()
+    {
+        setMessage(iExceptionCode, "AxisGenException:", pcMessage);
+    }
+	AxisGenException(const AxisGenException& e): AxisException (e) { }
+    virtual ~AxisGenException() throw() { }
 };
 
 AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/engine/AxisEngineException.h
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/engine/AxisEngineException.h?view=diff&rev=478055&r1=478054&r2=478055
==============================================================================
--- webservices/axis/trunk/c/src/engine/AxisEngineException.h (original)
+++ webservices/axis/trunk/c/src/engine/AxisEngineException.h Tue Nov 21 23:05:13 2006
@@ -21,7 +21,6 @@
 #ifndef __AXISENGINEEXCEPTION_H_OF_AXIS_INCLUDED_
 #define __AXISENGINEEXCEPTION_H_OF_AXIS_INCLUDED_
 
-#include <string>
 #include <axis/AxisException.hpp>
 
 AXIS_CPP_NAMESPACE_START
@@ -32,13 +31,12 @@
 {
 
 public:
-    AxisEngineException(const int iExceptionCode, const char* pcMessage = NULL);
-    AxisEngineException(const AxisEngineException& e);
-    virtual ~AxisEngineException() throw();
-
-private:
-    string getMessageForExceptionCode(const int iExceptionCode);
-	string m_sMessageForExceptionCode;
+    AxisEngineException(int iExceptionCode, const char* pcMessage = NULL): AxisException()
+    {
+        setMessage(iExceptionCode, "AxisEngineException:", pcMessage);
+    }
+    AxisEngineException(const AxisEngineException& e): AxisException (e) { }
+    virtual ~AxisEngineException() throw() { }
 };
 
 AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/soap/AxisSoapException.h
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/AxisSoapException.h?view=diff&rev=478055&r1=478054&r2=478055
==============================================================================
--- webservices/axis/trunk/c/src/soap/AxisSoapException.h (original)
+++ webservices/axis/trunk/c/src/soap/AxisSoapException.h Tue Nov 21 23:05:13 2006
@@ -21,25 +21,26 @@
 #ifndef __AXISSOAPEXCEPTION_H_OF_AXIS_INCLUDED_
 #define __AXISSOAPEXCEPTION_H_OF_AXIS_INCLUDED_
 
-#include <string>
 #include <axis/AxisException.hpp>
 
 AXIS_CPP_NAMESPACE_START
 
 using namespace std;
 
-class STORAGE_CLASS_INFO AxisSoapException :public AxisException
+class STORAGE_CLASS_INFO AxisSoapException : public AxisException
 {
-
 public:
-    AxisSoapException(const int iExceptionCode,const char* pcMessage = NULL);
-    AxisSoapException(const AxisSoapException& e);
-    virtual ~AxisSoapException() throw();
+    // constructor   
+    AxisSoapException(int iExceptionCode,const char* pcMessage = NULL): AxisException()
+    {
+        setMessage(iExceptionCode, "AxisSoapException:", pcMessage);
+    }
     
-
-private:
-    string getMessageForExceptionCode(const int iExceptionCode);
-	std::string m_sMessageForExceptionCode;
+    // constructor
+    AxisSoapException(const AxisSoapException& e): AxisException (e) { }
+    
+    // destructor
+    virtual ~AxisSoapException() throw() { }
 };
 
 AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/soap/OtherFaultException.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/OtherFaultException.cpp?view=diff&rev=478055&r1=478054&r2=478055
==============================================================================
--- webservices/axis/trunk/c/src/soap/OtherFaultException.cpp (original)
+++ webservices/axis/trunk/c/src/soap/OtherFaultException.cpp Tue Nov 21 23:05:13 2006
@@ -24,65 +24,68 @@
  * processed whatever state the engine is in. Doing a deep copy means this class owns
  * the storage and can delete it in its destructor making client programming simpler.
  */
-#define STRINGCOPY(tgt,src)					\
-{											\
-	if (NULL != src && 0 != strlen(src))	\
-	{										\
-		tgt = new AxisChar[strlen(src)+1];	\
-		strcpy(tgt, src);					\
-	} else tgt = NULL;						\
+#define STRINGCOPY(tgt,src)                  \
+{                                            \
+    delete [] tgt;                           \
+    tgt = NULL;                              \
+    if (NULL != src && 0 != strlen(src))     \
+    {                                        \
+        tgt = new AxisChar[strlen(src)+1];   \
+        strcpy(tgt, src);                    \
+    }                                        \
 }
 
-#define STRINGREPLACE(tgt,src)				\
-{											\
-	if (NULL != tgt)						\
-		delete [] tgt;						\
-	STRINGCOPY(tgt,src);					\
-}
-
-OtherFaultException::OtherFaultException() 
+OtherFaultException::
+OtherFaultException() : SoapFaultException()
 {
-	m_detail = NULL;
+    m_detail = NULL;
 }
 
-OtherFaultException::OtherFaultException(
-	const AxisChar *code, const AxisChar *string, const AxisChar *actor, const AxisChar *detail, int exceptionCode) :
-	SoapFaultException(code,string,actor,exceptionCode)
+OtherFaultException::
+OtherFaultException(const AxisChar *code, const AxisChar *string, const AxisChar *actor, 
+                    const AxisChar *detail, int exceptionCode) :
+    SoapFaultException(code,string,actor,exceptionCode)
 {
-	STRINGCOPY(m_detail,detail);
+    m_detail = NULL;
+    STRINGCOPY(m_detail,detail);
 }
 
-OtherFaultException::OtherFaultException(AxisException& ae) : SoapFaultException(ae)
+OtherFaultException::
+OtherFaultException(AxisException& ae) : SoapFaultException(ae)
 {
-	m_detail = NULL;
+    m_detail = NULL;
 }
 
-OtherFaultException::OtherFaultException(const OtherFaultException& copy) : SoapFaultException(copy)
+OtherFaultException::
+OtherFaultException(const OtherFaultException& copy) : SoapFaultException(copy)
 {
-	STRINGCOPY(m_detail, copy.m_detail);
+    STRINGCOPY(m_detail, copy.m_detail);
 }
 
-OtherFaultException& OtherFaultException::operator=(const OtherFaultException& copy)
+OtherFaultException& OtherFaultException::
+operator=(const OtherFaultException& copy)
 {
-	SoapFaultException::operator=(copy);
-	STRINGREPLACE(m_detail, copy.m_detail);
-	return *this;
+    SoapFaultException::operator=(copy);
+    STRINGCOPY(m_detail, copy.m_detail);
+    return *this;
 }
 
-OtherFaultException::~OtherFaultException() throw()
+OtherFaultException::
+~OtherFaultException() throw()
 {
-	if (NULL != m_detail) delete [] m_detail;
-	m_detail = NULL;
+    delete [] m_detail;
 }
 
-const AxisChar *OtherFaultException::getFaultDetail() const
+const AxisChar *OtherFaultException::
+getFaultDetail() const
 {
-	return m_detail;
+    return m_detail;
 }
 
-void OtherFaultException::setFaultDetail(const AxisChar *detail)
+void OtherFaultException::
+setFaultDetail(const AxisChar *detail)
 {
-	STRINGCOPY(m_detail,detail);
+    STRINGCOPY(m_detail,detail);
 }
 
 AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/soap/SoapFaultException.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/SoapFaultException.cpp?view=diff&rev=478055&r1=478054&r2=478055
==============================================================================
--- webservices/axis/trunk/c/src/soap/SoapFaultException.cpp (original)
+++ webservices/axis/trunk/c/src/soap/SoapFaultException.cpp Tue Nov 21 23:05:13 2006
@@ -26,62 +26,53 @@
  */
 #define STRINGCOPY(tgt,src)                  \
 {                                            \
+    delete [] tgt;                           \
+    tgt = NULL;                              \
     if (NULL != src && 0 != strlen(src))     \
     {                                        \
         tgt = new AxisChar[strlen(src)+1];   \
         strcpy(tgt, src);                    \
-    } else tgt = NULL;                       \
-}
-
-#define STRINGREPLACE(tgt,src)               \
-{                                            \
-    delete [] tgt;                           \
-    STRINGCOPY(tgt,src);                     \
+    }                                        \
 }
 
 SoapFaultException::
-SoapFaultException()
+SoapFaultException() : AxisException()
 {
     m_code = NULL;
-    m_sMessage = NULL;
     m_actor = NULL;
-    m_iExceptionCode = 0;
 }
 
 SoapFaultException::
-SoapFaultException(const AxisChar *code, const AxisChar *string, const AxisChar *actor, int exceptionCode) 
+SoapFaultException(const AxisChar *code, const AxisChar *string, 
+                   const AxisChar *actor, int exceptionCode) : AxisException(exceptionCode, string)
 {
+    m_code  = NULL;
+    m_actor = NULL;    
     STRINGCOPY(m_code,code);
-    STRINGCOPY(m_sMessage,string);
     STRINGCOPY(m_actor,actor);
-    m_iExceptionCode = exceptionCode;
 }
 
 SoapFaultException::
-SoapFaultException(AxisException& ae)
+SoapFaultException(AxisException& ae): AxisException(ae)
 {
-    STRINGCOPY(m_sMessage,ae.what());
-    m_iExceptionCode = ae.getExceptionCode();
     m_code = NULL;
     m_actor = NULL;
 }
 
 SoapFaultException::
-SoapFaultException(const SoapFaultException& copy)
+SoapFaultException(const SoapFaultException& copy): AxisException(copy)
 {
-    STRINGCOPY(m_code    ,copy.m_code);
-    STRINGCOPY(m_sMessage    ,copy.m_sMessage);
-    STRINGCOPY(m_actor    ,copy.m_actor);
-    m_iExceptionCode = copy.m_iExceptionCode;
+    STRINGCOPY(m_code, copy.m_code);
+    STRINGCOPY(m_actor, copy.m_actor);
 }
 
 SoapFaultException& SoapFaultException::
 operator=(const SoapFaultException& copy)
 {
     exception::operator=(copy);
-    STRINGREPLACE(m_code    ,copy.m_code);
-    STRINGREPLACE(m_sMessage    ,copy.m_sMessage);
-    STRINGREPLACE(m_actor    ,copy.m_actor);
+    STRINGCOPY(m_code, copy.m_code);
+    STRINGCOPY(m_actor, copy.m_actor);
+    m_sMessage       = copy.m_sMessage;
     m_iExceptionCode = copy.m_iExceptionCode;
     return *this;
 }
@@ -90,7 +81,6 @@
 ~SoapFaultException() throw()
 {
     delete [] m_code;
-    delete [] m_sMessage;
     delete [] m_actor;
 }
 
@@ -104,7 +94,7 @@
 const AxisChar *SoapFaultException::
 getFaultString() const
 {
-    return m_sMessage;
+    return m_sMessage.c_str();
 }
 
 const AxisChar *SoapFaultException::
@@ -122,7 +112,7 @@
 void SoapFaultException::
 setFaultString(const AxisChar *string)
 {
-    STRINGCOPY(m_sMessage,string);
+    setMessage(string);
 }
 
 void SoapFaultException::

Modified: webservices/axis/trunk/c/src/transport/axis3/HTTPTransportException.hpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/transport/axis3/HTTPTransportException.hpp?view=diff&rev=478055&r1=478054&r2=478055
==============================================================================
--- webservices/axis/trunk/c/src/transport/axis3/HTTPTransportException.hpp (original)
+++ webservices/axis/trunk/c/src/transport/axis3/HTTPTransportException.hpp Tue Nov 21 23:05:13 2006
@@ -22,24 +22,26 @@
 #ifndef __HTTPTransportEXCEPTION_H_OF_AXIS_INCLUDED_
 #define __HTTPTransportEXCEPTION_H_OF_AXIS_INCLUDED_
 
-#include <string>
 #include <axis/AxisException.hpp>
 
 using namespace std;
 
 AXIS_CPP_NAMESPACE_USE
 
-class STORAGE_CLASS_INFO HTTPTransportException :public AxisException
+class STORAGE_CLASS_INFO HTTPTransportException : public AxisException
 {
-
 public:
-    HTTPTransportException(const int iExceptionCode, char* pcMessage = NULL);
-    HTTPTransportException(const HTTPTransportException& e);
-    virtual ~HTTPTransportException() throw();
-                                                                                                                             
-private:
-    string getMessageForExceptionCode(const int iExceptionCode);
-    std::string m_sMessageForExceptionCode;
+    // constructor
+    HTTPTransportException(int iExceptionCode, const char* pcMessage = NULL): AxisException()
+    {
+        setMessage(iExceptionCode, "HTTPTransportException:", pcMessage);
+    }
+    
+    // constructor
+    HTTPTransportException(const HTTPTransportException& e): AxisException (e) { }
+    
+    // destructor
+    virtual ~HTTPTransportException() throw() { }
 };
 
 #endif

Modified: webservices/axis/trunk/c/src/wsdd/AxisWsddException.h
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdd/AxisWsddException.h?view=diff&rev=478055&r1=478054&r2=478055
==============================================================================
--- webservices/axis/trunk/c/src/wsdd/AxisWsddException.h (original)
+++ webservices/axis/trunk/c/src/wsdd/AxisWsddException.h Tue Nov 21 23:05:13 2006
@@ -21,7 +21,6 @@
 #ifndef __AXISWSDDEXCEPTION_H_OF_AXIS_INCLUDED_
 #define __AXISWSDDEXCEPTION_H_OF_AXIS_INCLUDED_
 
-#include <string>
 #include <axis/AxisException.hpp>
 
 AXIS_CPP_NAMESPACE_START
@@ -32,14 +31,17 @@
 {
 
 public:
-    AxisWsddException(const int iExceptionCode,const char* pcMessage = NULL);
-    AxisWsddException(const AxisWsddException& e);
-    virtual ~AxisWsddException() throw();
+    // constructor
+    AxisWsddException(int iExceptionCode,const char* pcMessage = NULL): AxisException()
+    {
+        setMessage(iExceptionCode, "AxisWsddException:", pcMessage);
+    }
     
-private:
-    string getMessageForExceptionCode(const int iExceptionCode);
-    const char* what() const throw(){ return m_sMessage; };
-    string m_sMessageForExceptionCode;
+    // constructor
+    AxisWsddException(const AxisWsddException& e): AxisException (e) { }
+    
+    // destructor
+    virtual ~AxisWsddException() throw() { }
 };
 
 AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/xml/AxisParseException.h
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/xml/AxisParseException.h?view=diff&rev=478055&r1=478054&r2=478055
==============================================================================
--- webservices/axis/trunk/c/src/xml/AxisParseException.h (original)
+++ webservices/axis/trunk/c/src/xml/AxisParseException.h Tue Nov 21 23:05:13 2006
@@ -21,23 +21,22 @@
 #ifndef __AXISPARSEEXCEPTION_H_OF_AXIS_INCLUDED_
 #define __AXISPARSEEXCEPTION_H_OF_AXIS_INCLUDED_
 
-#include <string>
 #include <axis/AxisException.hpp>
+
 using namespace std;
 
 AXIS_CPP_NAMESPACE_USE
 
 class STORAGE_CLASS_INFO AxisParseException :public AxisException
 {
-
 public:
-    AxisParseException(const int iExceptionCode,const char* pcMessage = NULL);
-    AxisParseException(const AxisParseException& e);
-    virtual ~AxisParseException() throw();
-                                                                                                                             
-private:
-    string getMessageForExceptionCode (const int iExceptionCode);
-    string m_sMessageForExceptionCode;
+    AxisParseException(int iExceptionCode,const char* pcMessage = NULL): AxisException()
+    {
+        setMessage(iExceptionCode, "AxisParseException:", pcMessage);
+    }
+    
+    AxisParseException(const AxisParseException& e): AxisException(e) { }
+    virtual ~AxisParseException() throw() { }
 };
 
 #endif



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