You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by wh...@apache.org on 2005/03/09 17:23:02 UTC

cvs commit: ws-axis/c/src/engine/client ClientAxisEngine.cpp

whitlock    2005/03/09 08:23:02

  Modified:    c/src/common AxisGenException.cpp AxisGenException.h
               c/src/engine/client ClientAxisEngine.cpp
  Log:
  AXISCPP-524 Make AxisGenException not delete[] the exception message passed to it when ClientAxisEngine::process converts a HTTPTransportException to a AxisGenException because the HTTPTransportException will delete the message itself.
  
  Revision  Changes    Path
  1.11      +4 -4      ws-axis/c/src/common/AxisGenException.cpp
  
  Index: AxisGenException.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/common/AxisGenException.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AxisGenException.cpp	4 Mar 2005 15:27:41 -0000	1.10
  +++ AxisGenException.cpp	9 Mar 2005 16:23:01 -0000	1.11
  @@ -32,10 +32,10 @@
       processException (iExceptionCode);
   }
   
  -AxisGenException::AxisGenException(const int iExceptionCode, char* pcMessage)
  +AxisGenException::AxisGenException(const int iExceptionCode, char* pcMessage, bool deleteInputMsg)
   {
       m_iExceptionCode = iExceptionCode;
  -    processException(iExceptionCode, pcMessage);
  +    processException(iExceptionCode, pcMessage, deleteInputMsg);
   }
   
   AxisGenException::AxisGenException (const exception* e)
  @@ -76,11 +76,11 @@
       m_sMessage = getMessage (iExceptionCode);
   }
   
  -void AxisGenException::processException(const int iExceptionCode, char* pcMessage)
  +void AxisGenException::processException(const int iExceptionCode, char* pcMessage, bool deleteInputMsg)
   {
       AxisString sMessage = pcMessage;
       m_sMessage = getMessage(iExceptionCode) + sMessage;
  -    if(pcMessage)
  +    if(deleteInputMsg && pcMessage)
           delete [] pcMessage;
   }
   
  
  
  
  1.2       +3 -2      ws-axis/c/src/common/AxisGenException.h
  
  Index: AxisGenException.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/common/AxisGenException.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AxisGenException.h	29 Nov 2004 12:39:30 -0000	1.1
  +++ AxisGenException.h	9 Mar 2005 16:23:01 -0000	1.2
  @@ -52,12 +52,13 @@
         * @param Exception code which is defined in the AxisException.h file,
         *  under AXISC_EXCEPTIONS type.
         * @param A char pointer that will point to an exception message.
  +	  * @param Whether to delete[] the pcMessage that is passed in, once it is copied
         *
         * @example throw AxisGenException(AXISC_NODE_VALUE_MISMATCH_EXCEPTION,
               "Some additional exception info");
         */
   
  -    AxisGenException(const int iExceptionCode, char* pcMessage);
  +    AxisGenException(const int iExceptionCode, char* pcMessage, bool deleteInputMsg=true);
   
       /** This can be used to throw an exception with another exception as a
         * parameter. One situation in which this can be used is when we catch
  @@ -93,7 +94,7 @@
       void processException(const exception* e, const int iExceptionCode);
       void processException (const exception* e, char* pcMessage);
       void processException(const int iExceptionCode);
  -    void processException(const int iExceptionCode, char* pcMessage); 
  +    void processException(const int iExceptionCode, char* pcMessage, bool deleteInputMsg); 
       string m_sMessage;
       int m_iExceptionCode;
   };
  
  
  
  1.28      +7 -1      ws-axis/c/src/engine/client/ClientAxisEngine.cpp
  
  Index: ClientAxisEngine.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/engine/client/ClientAxisEngine.cpp,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ClientAxisEngine.cpp	22 Feb 2005 16:51:41 -0000	1.27
  +++ ClientAxisEngine.cpp	9 Mar 2005 16:23:02 -0000	1.28
  @@ -140,7 +140,13 @@
       }
       catch(AxisException& e)
       {
  -		throw AxisGenException(e.getExceptionCode(), const_cast<char*>(e.what()));
  +		/* Throw a AxisGenException here instead of rethrowing the original exception because
  +		 * the original exception may be an transport exception which will go out of scope when
  +		 * the transport library is unloaded. The original exception will delete its own message
  +		 * storage, so the false as the last parameter tells AxisGenException not to try to 
  +		 * delete it.
  +		 */
  +		throw AxisGenException(e.getExceptionCode(), const_cast<char*>(e.what()), false);
       }
       return Status;
   }