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:39:49 UTC

svn commit: r478062 - in /webservices/axis/trunk/c: include/axis/AxisException.hpp src/xml/xerces/XMLParserXerces.cpp

Author: nadiramra
Date: Tue Nov 21 23:39:48 2006
New Revision: 478062

URL: http://svn.apache.org/viewvc?view=rev&rev=478062
Log:
AXISCPP-943 - ensure messages are not duplicate and are correct.

Modified:
    webservices/axis/trunk/c/include/axis/AxisException.hpp
    webservices/axis/trunk/c/src/xml/xerces/XMLParserXerces.cpp

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=478062&r1=478061&r2=478062
==============================================================================
--- webservices/axis/trunk/c/include/axis/AxisException.hpp (original)
+++ webservices/axis/trunk/c/include/axis/AxisException.hpp Tue Nov 21 23:39:48 2006
@@ -553,7 +553,7 @@
                 sMsg = "AxisSoapException: Soap MustUnderstand fault occurred.";
                 break;
             case CLIENT_SOAP_MESSAGE_INCOMPLETE:
-                sMsg = "AxisSoapException: Received message is incomplete.";
+                sMsg = "AxisSoapException: Soap message is incomplete.";
                 break;
             case CLIENT_SOAP_SOAP_ACTION_EMTPY:
                 sMsg = "AxisSoapException: SOAPAction HTTP header is empty.";

Modified: webservices/axis/trunk/c/src/xml/xerces/XMLParserXerces.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/xml/xerces/XMLParserXerces.cpp?view=diff&rev=478062&r1=478061&r2=478062
==============================================================================
--- webservices/axis/trunk/c/src/xml/xerces/XMLParserXerces.cpp (original)
+++ webservices/axis/trunk/c/src/xml/xerces/XMLParserXerces.cpp Tue Nov 21 23:39:48 2006
@@ -24,14 +24,18 @@
 #pragma warning (disable : 4101)
 #endif
 
+// !!! Must be first thing in file !!!
 #include "../../platforms/PlatformAutoSense.hpp"
 
+#include <string>
 #include "XMLParserXerces.h"
 #include <xercesc/sax2/XMLReaderFactory.hpp>
 
 XERCES_CPP_NAMESPACE_USE
+using namespace std;
 
-XMLParserXerces::XMLParserXerces()
+XMLParserXerces::
+XMLParserXerces()
 {
     m_bFirstParsed = false;
     m_bPeeked = false;
@@ -40,25 +44,23 @@
     m_bCanParseMore = false;
 }
 
-XMLParserXerces::~XMLParserXerces()
+XMLParserXerces::
+~XMLParserXerces()
 {
     // Parser has memory allocated with the last AnyElement parsed; clean that
     m_Xhandler.freeElement();
 
-    if(m_pInputSource)
-        delete m_pInputSource;
+    delete m_pInputSource;
     delete m_pParser;
     
 }
 
-int XMLParserXerces::setInputStream(AxisIOStream* pInputStream)
+int XMLParserXerces::
+setInputStream(AxisIOStream* pInputStream)
 {
     m_pInputStream = pInputStream;
     
-    // check if memory is already allocated for is
-    if(m_pInputSource)
-        delete m_pInputSource;
-    
+    delete m_pInputSource;
     m_pInputSource = new SoapInputSource(pInputStream);
     m_Xhandler.reset();
     m_pParser->setContentHandler(&m_Xhandler);
@@ -72,17 +74,20 @@
     return AXIS_SUCCESS;
 }
 
-const XML_Ch* XMLParserXerces::getNS4Prefix(const XML_Ch* prefix)
+const XML_Ch* XMLParserXerces::
+getNS4Prefix(const XML_Ch* prefix)
 {
     return m_Xhandler.ns4Prefix(prefix);
 }
 
-int XMLParserXerces::getStatus()
+int XMLParserXerces::
+getStatus()
 {
     return m_Xhandler.getStatus();
 }
 
-const AnyElement* XMLParserXerces::next(bool isCharData)
+const AnyElement* XMLParserXerces::
+next(bool isCharData)
 {
     if( !m_bFirstParsed)
     {
@@ -100,22 +105,20 @@
             char *    message = XMLString::transcode( toCatch.getMessage());
 
             // Clone the error message before deleting it.
-            char *    pErrorMsg = new char[strlen( message ) + 1];
-            strcpy( pErrorMsg, message);
+            std::string sErrorMsg = message;
             XMLString::release( &message);
 
-            throw AxisParseException( CLIENT_SOAP_CONTENT_NOT_SOAP, pErrorMsg);
+            throw AxisParseException( CLIENT_SOAP_CONTENT_NOT_SOAP, sErrorMsg.c_str());
         }
         catch( const SAXParseException& toCatch)
         {
             char *    message = XMLString::transcode( toCatch.getMessage());
 
             // Clone the error message before deleting it.
-            char *    pErrorMsg = new char[strlen( message ) + 1];
-            strcpy( pErrorMsg, message);
+            std::string sErrorMsg = message;
             XMLString::release( &message);
 
-            throw AxisParseException( CLIENT_SOAP_CONTENT_NOT_SOAP, pErrorMsg);
+            throw AxisParseException( CLIENT_SOAP_CONTENT_NOT_SOAP, sErrorMsg.c_str());
         }
         catch( HTTPTransportException & e)
         {
@@ -123,7 +126,7 @@
         }
         catch( ...)
         {
-            char *pErrorMsg = "Unexpected Exception in SAX parser.  Probably no message or the message is not recognised as XML.";
+            char *pErrorMsg = "Unexpected exception in SAX parser.";
             
             throw AxisParseException( CLIENT_SOAP_CONTENT_NOT_SOAP, pErrorMsg);
         }
@@ -157,7 +160,8 @@
 }
 // New method which peek a head next element 
 // Here always Peek() will call after the first pase done
-const char* XMLParserXerces::peek()
+const char* XMLParserXerces::
+peek()
 {
     if (!m_bPeeked)
     {
@@ -196,7 +200,8 @@
         return "";
 }
 
-const AnyElement* XMLParserXerces::anyNext()
+const AnyElement* XMLParserXerces::
+anyNext()
 {
     // Say the SAX event handler to record prefix mappings too 
     // By default the event handler do not record them.
@@ -233,7 +238,8 @@
     return NULL;
 }
 
-const XML_Ch* XMLParserXerces::getPrefix4NS(const XML_Ch* pcNS)
+const XML_Ch* XMLParserXerces::
+getPrefix4NS(const XML_Ch* pcNS)
 {
     return m_Xhandler.prefix4NS(pcNS);
 }



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