You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by db...@apache.org on 2006/01/31 00:13:30 UTC

svn commit: r373627 - in /xerces/c/branches/xerces-2.7/src/xercesc/validators/schema: GeneralAttributeCheck.cpp SchemaValidator.cpp TraverseSchema.cpp TraverseSchema.hpp XSDErrorReporter.cpp XSDErrorReporter.hpp

Author: dbertoni
Date: Mon Jan 30 15:13:24 2006
New Revision: 373627

URL: http://svn.apache.org/viewcvs?rev=373627&view=rev
Log:
Fixed problems with report exception-based errors.

Modified:
    xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/GeneralAttributeCheck.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaValidator.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/TraverseSchema.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/TraverseSchema.hpp
    xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/XSDErrorReporter.cpp
    xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/XSDErrorReporter.hpp

Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/GeneralAttributeCheck.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/GeneralAttributeCheck.cpp?rev=373627&r1=373626&r2=373627&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/GeneralAttributeCheck.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/GeneralAttributeCheck.cpp Mon Jan 30 15:13:24 2006
@@ -14,10 +14,6 @@
  * limitations under the License.
  */
 
-/*
- * $Id$
- */
-
 // ---------------------------------------------------------------------------
 //  Includes
 // ---------------------------------------------------------------------------
@@ -431,7 +427,7 @@
             dv->validate(attValue, fValidationContext, fMemoryManager);
         }
         catch(const XMLException& excep) {
-            schema->reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DisplayErrorMessage, excep.getMessage());
+            schema->reportSchemaError(elem, excep);
         }
         catch(const OutOfMemoryException&)
         {

Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaValidator.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaValidator.cpp?rev=373627&r1=373626&r2=373627&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaValidator.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaValidator.cpp Mon Jan 30 15:13:24 2006
@@ -14,10 +14,6 @@
  * limitations under the License.
  */
 
-/*
- * $Id$
- */
-
 // ---------------------------------------------------------------------------
 //  Includes
 // ---------------------------------------------------------------------------
@@ -908,7 +904,7 @@
                                                   baseGroup->getContentSpec(), baseGroup->getScope());
                     }
                     catch (const XMLException& excep) {
-                        fSchemaErrorReporter.emitError(XMLErrs::DisplayErrorMessage, XMLUni::fgXMLErrDomain, curGroup.getLocator(), excep.getMessage(), 0, 0, 0, fMemoryManager);
+                        fSchemaErrorReporter.emitError(excep, curGroup.getLocator());
 					}
                 }
 
@@ -1092,7 +1088,7 @@
                                       baseTypeInfo->getScopeDefined(), baseTypeInfo);
         }
         catch (const XMLException& excep) {
-            fSchemaErrorReporter.emitError(XMLErrs::DisplayErrorMessage, XMLUni::fgXMLErrDomain, curTypeInfo->getLocator(), excep.getMessage(), 0, 0, 0, fMemoryManager);
+            fSchemaErrorReporter.emitError(excep, curTypeInfo->getLocator());
         }
     }
 }

Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/TraverseSchema.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/TraverseSchema.cpp?rev=373627&r1=373626&r2=373627&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/TraverseSchema.cpp Mon Jan 30 15:13:24 2006
@@ -14,10 +14,6 @@
  * limitations under the License.
  */
 
-/*
- * $Id$
- */
-
 // ---------------------------------------------------------------------------
 //  Includes
 // ---------------------------------------------------------------------------
@@ -1986,7 +1982,7 @@
                                          , fMemoryManager);
                     }
                     catch(const XMLException& excep) {
-                        reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DisplayErrorMessage, excep.getMessage());
+                        reportSchemaError(elem, excep);
                     }
                     uriIndex = fURIStringPool->addOrFind(tokenElem);
                 }
@@ -2429,7 +2425,7 @@
                       , fMemoryManager);
         }
         catch (const XMLException& excep) {
-            reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::DisplayErrorMessage, excep.getMessage());
+            reportSchemaError(elem, excep);
         }
         catch(const OutOfMemoryException&)
         {
@@ -3007,7 +3003,7 @@
                     qualifiedName, baseValidator, 0, 0, true, finalSet, true, fGrammarPoolMemoryManager);
             }
             catch (const XMLException& excep) {
-                reportSchemaError(contentElem, XMLUni::fgValidityDomain, XMLValid::DisplayErrorMessage, excep.getMessage());
+                reportSchemaError(contentElem, excep);
             }
             catch(const OutOfMemoryException&)
             {
@@ -3277,7 +3273,7 @@
             newDV = fDatatypeRegistry->createDatatypeValidator(qualifiedName, baseValidator, janFacets.release(), enums.release(), false, finalSet, true, fGrammarPoolMemoryManager);            
         }
         catch (const XMLException& excep) {
-            reportSchemaError(contentElem, XMLUni::fgValidityDomain, XMLValid::DisplayErrorMessage, excep.getMessage());
+            reportSchemaError(contentElem, excep);
         }
         catch(const OutOfMemoryException&)
         {
@@ -3411,7 +3407,7 @@
         newDV = fDatatypeRegistry->createDatatypeValidator(qualifiedName, validators, finalSet, true, fGrammarPoolMemoryManager);
     }
     catch (const XMLException& excep) {
-        reportSchemaError(contentElem, XMLUni::fgValidityDomain, XMLValid::DisplayErrorMessage, excep.getMessage());
+        reportSchemaError(contentElem, excep);
     }
     catch(const OutOfMemoryException&)
     {
@@ -3783,7 +3779,7 @@
                     typeInfo->setDatatypeValidator(simpleDV);
                 }
                 catch (const XMLException& excep) {
-                    reportSchemaError(simpleContent, XMLUni::fgValidityDomain, XMLValid::DisplayErrorMessage, excep.getMessage());
+                    reportSchemaError(simpleContent, excep);
                 }
                 catch(const OutOfMemoryException&)
                 {
@@ -4092,7 +4088,7 @@
                                      , fMemoryManager);
                 }
                 catch(const XMLException& excep) {
-                    reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DisplayErrorMessage, excep.getMessage());
+                    reportSchemaError(elem, excep);
                 }
                 uriIndex = fURIStringPool->addOrFind(token);
             }
@@ -4426,7 +4422,7 @@
     }
     catch (const XPathException& e) {
 
-        reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DisplayErrorMessage, e.getMessage());
+        reportSchemaError(elem, e);
         return false;
     }
 
@@ -4499,7 +4495,7 @@
             }
             catch (const XPathException& e) {
 
-                reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::DisplayErrorMessage, e.getMessage());
+                reportSchemaError(elem, e);
                 return false;
             }
 		}
@@ -5401,7 +5397,7 @@
                 // fBuffer is reused by traverseComplexTypeDecl, so we have to store its current value
                 XMLBuffer buffCopy(fBuffer.getLen()+1, fMemoryManager);
                 buffCopy.set(fBuffer.getRawBuffer());
-                int typeIndex = traverseComplexTypeDecl(typeNode);
+                traverseComplexTypeDecl(typeNode);
                 typeInfo =  fComplexTypeRegistry->get(buffCopy.getRawBuffer());
             }
         }
@@ -5855,7 +5851,7 @@
                                           , fMemoryManager);
                         }
                         catch(const XMLException& excep) {
-                            reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::DisplayErrorMessage, excep.getMessage());
+                            reportSchemaError(elem, excep);
                         }
                         catch(const OutOfMemoryException&)
                         {
@@ -8468,6 +8464,16 @@
     fXSDErrorReporter.emitError(errorCode, msgDomain, fLocator, text1, text2, text3, text4, fMemoryManager);
 }
 
+void TraverseSchema::reportSchemaError(const DOMElement* const elem,
+                                       const XMLException&     except)
+{
+    fLocator->setValues(fSchemaInfo->getCurrentSchemaURL(), 0,
+                        ((XSDElementNSImpl*) elem)->getLineNo(),
+                        ((XSDElementNSImpl*) elem)->getColumnNo());
+
+    fXSDErrorReporter.emitError(except, fLocator);
+}
+
 // ---------------------------------------------------------------------------
 //  TraverseSchema: Init/CleanUp methods
 // ---------------------------------------------------------------------------
@@ -8663,7 +8669,7 @@
         }
         catch(const XMLException& excep)
         {
-            reportSchemaError(elem, XMLUni::fgValidityDomain, XMLValid::DisplayErrorMessage, excep.getMessage());
+            reportSchemaError(elem, excep);
         }
         catch(const OutOfMemoryException&)
         {

Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/TraverseSchema.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/TraverseSchema.hpp?rev=373627&r1=373626&r2=373627&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/TraverseSchema.hpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/TraverseSchema.hpp Mon Jan 30 15:13:24 2006
@@ -14,10 +14,6 @@
  * limitations under the License.
  */
 
-/*
- * $Id$
- */
-
 #if !defined(TRAVERSESCHEMA_HPP)
 #define TRAVERSESCHEMA_HPP
 
@@ -227,6 +223,8 @@
                            const XMLCh* const text2 = 0,
                            const XMLCh* const text3 = 0,
                            const XMLCh* const text4 = 0);
+    void reportSchemaError(const DOMElement* const elem,
+                           const XMLException&     except);
 
     // -----------------------------------------------------------------------
     //  Private Helper methods

Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/XSDErrorReporter.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/XSDErrorReporter.cpp?rev=373627&r1=373626&r2=373627&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/XSDErrorReporter.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/XSDErrorReporter.cpp Mon Jan 30 15:13:24 2006
@@ -14,11 +14,6 @@
  * limitations under the License.
  */
 
-/*
- * $Id$
- */
-
-
 // ---------------------------------------------------------------------------
 //  Includes
 // ---------------------------------------------------------------------------
@@ -222,6 +217,23 @@
 
     if (fErrorReporter)
         fErrorReporter->error(toEmit, msgDomain, errType, errText, aLocator->getSystemId(),
+                              aLocator->getPublicId(), aLocator->getLineNumber(),
+                              aLocator->getColumnNumber());
+
+    // Bail out if its fatal an we are to give up on the first fatal error
+    if (errType == XMLErrorReporter::ErrType_Fatal && fExitOnFirstFatal)
+        throw (XMLErrs::Codes) toEmit;
+}
+
+void XSDErrorReporter::emitError(const XMLException&  except,
+                                 const Locator* const aLocator)
+{
+    const XMLCh* const  errText = except.getMessage();
+    const unsigned int  toEmit = except.getCode();
+    XMLErrorReporter::ErrTypes errType = XMLErrs::errorType((XMLErrs::Codes) toEmit);
+
+    if (fErrorReporter)
+        fErrorReporter->error(toEmit, XMLUni::fgExceptDomain, errType, errText, aLocator->getSystemId(),
                               aLocator->getPublicId(), aLocator->getLineNumber(),
                               aLocator->getColumnNumber());
 

Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/XSDErrorReporter.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/XSDErrorReporter.hpp?rev=373627&r1=373626&r2=373627&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/XSDErrorReporter.hpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/XSDErrorReporter.hpp Mon Jan 30 15:13:24 2006
@@ -14,11 +14,6 @@
  * limitations under the License.
  */
 
- /*
-  * $Id$
-  */
-
-
 #if !defined(XSDERRORREPORTER_HPP)
 #define XSDERRORREPORTER_HPP
 
@@ -71,6 +66,8 @@
                    const XMLCh* const text4 = 0,
                    MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
                    );
+    void emitError(const XMLException&  except,
+                   const Locator* const aLocator);
 
 private:
     // -----------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org