Author: cargilld
Date: Sun Feb  5 18:22:47 2006
New Revision: 375159

URL: http://svn.apache.org/viewcvs?rev=375159&view=rev
Log:
Display actual errorCode when reporting an error.

Modified:
    xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp
    xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
    xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
    xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp
    xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp

Modified: xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp?rev=375159&r1=375158&r2=375159&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp Sun Feb  5 18:22:47 
2006
@@ -223,6 +223,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Warning
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -230,6 +231,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Fatal
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -237,6 +239,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Error
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -400,6 +403,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Warning
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -407,6 +411,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Fatal
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -414,6 +419,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Error
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -1677,12 +1683,14 @@
                 emitError
                 (
                     XMLErrs::DisplayErrorMessage
+                    , excToCatch.getCode()
                     , excToCatch.getMessage()
                 );
             else if (excToCatch.getErrorType() >= 
XMLErrorReporter::ErrType_Fatal)
                 emitError
                 (
                     XMLErrs::XMLException_Fatal
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -1690,6 +1698,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Error
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );

Modified: xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp?rev=375159&r1=375158&r2=375159&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp Sun Feb  5 18:22:47 
2006
@@ -260,6 +260,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Warning
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -267,6 +268,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Fatal
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -274,6 +276,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Error
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -443,6 +446,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Warning
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -450,6 +454,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Fatal
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -457,6 +462,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Error
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -2999,12 +3005,14 @@
                 emitError
                 (
                     XMLErrs::DisplayErrorMessage
+                    , excToCatch.getCode()
                     , excToCatch.getMessage()
                 );
             else if (excToCatch.getErrorType() >= 
XMLErrorReporter::ErrType_Fatal)
                 emitError
                 (
                     XMLErrs::XMLException_Fatal
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -3012,6 +3020,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Error
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );

Modified: xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp?rev=375159&r1=375158&r2=375159&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp Sun Feb  5 18:22:47 
2006
@@ -253,6 +253,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Warning
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -260,6 +261,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Fatal
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -267,6 +269,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Error
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -433,6 +436,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Warning
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -440,6 +444,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Fatal
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -447,6 +452,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Error
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -1927,12 +1933,14 @@
                 emitError
                 (
                     XMLErrs::DisplayErrorMessage
+                    , excToCatch.getCode()
                     , excToCatch.getMessage()
                 );
             else if (excToCatch.getErrorType() >= 
XMLErrorReporter::ErrType_Fatal)
                 emitError
                 (
                     XMLErrs::XMLException_Fatal
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );
@@ -1940,6 +1948,7 @@
                 emitError
                 (
                     XMLErrs::XMLException_Error
+                    , excToCatch.getCode()
                     , excToCatch.getType()
                     , excToCatch.getMessage()
                 );

Modified: xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp?rev=375159&r1=375158&r2=375159&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp Sun Feb  5 18:22:47 2006
@@ -944,6 +944,53 @@
         throw toEmit;
 }
 
+void XMLScanner::emitError( const   XMLErrs::Codes      toEmit
+                            , const XMLExcepts::Codes   originalExceptCode
+                            , const XMLCh* const        text1
+                            , const XMLCh* const        text2
+                            , const XMLCh* const        text3
+                            , const XMLCh* const        text4)
+{
+    // Bump the error count if it is not a warning
+    if (XMLErrs::errorType(toEmit) != XMLErrorReporter::ErrType_Warning)
+        incrementErrorCount();
+
+    if (fErrorReporter)
+    {
+        //  Load the message into alocal and replace any tokens found in
+        //  the text.
+        const unsigned int maxChars = 2047;
+        XMLCh errText[maxChars + 1];
+
+        if (!gScannerMsgLoader().loadMsg(toEmit, errText, maxChars, text1, 
text2, text3, text4, fMemoryManager))
+        {
+                // <TBD> Should probably load a default message here
+        }
+
+        //  Create a LastExtEntityInfo structure and get the reader manager
+        //  to fill it in for us. This will give us the information about
+        //  the last reader on the stack that was an external entity of some
+        //  sort (i.e. it will ignore internal entities.
+        ReaderMgr::LastExtEntityInfo lastInfo;
+        fReaderMgr.getLastExtEntityInfo(lastInfo);
+
+        fErrorReporter->error
+        (
+            originalExceptCode
+            , XMLUni::fgExceptDomain    //fgXMLErrDomain
+            , XMLErrs::errorType(toEmit)
+            , errText
+            , lastInfo.systemId
+            , lastInfo.publicId
+            , lastInfo.lineNumber
+            , lastInfo.colNumber
+        );
+    }
+
+    // Bail out if its fatal an we are to give up on the first fatal error
+    if (emitErrorWillThrowException(toEmit))
+        throw toEmit;
+}
 
 // ---------------------------------------------------------------------------
 //  XMLScanner: Getter methods

Modified: xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp?rev=375159&r1=375158&r2=375159&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp Sun Feb  5 18:22:47 2006
@@ -168,6 +168,15 @@
         , const char* const         text3 = 0
         , const char* const         text4 = 0
     );
+    void emitError
+    (
+        const   XMLErrs::Codes    toEmit
+        , const XMLExcepts::Codes   originalErrorCode
+        , const XMLCh* const        text1 = 0
+        , const XMLCh* const        text2 = 0
+        , const XMLCh* const        text3 = 0
+        , const XMLCh* const        text4 = 0
+    );
 
     // -----------------------------------------------------------------------
     //  Implementation of XMLBufferFullHandler interface



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to