You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2002/07/05 20:42:45 UTC
cvs commit: xml-xerces/c/src/xercesc/internal XMLScanner.cpp
tng 2002/07/05 11:42:44
Modified: c/src/xercesc/internal XMLScanner.cpp
Log:
[Bug 10105] Exception in parse() despite setErrorHandler().
Revision Changes Path
1.13 +71 -4 xml-xerces/c/src/xercesc/internal/XMLScanner.cpp
Index: XMLScanner.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLScanner.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XMLScanner.cpp 17 Jun 2002 18:40:39 -0000 1.12
+++ XMLScanner.cpp 5 Jul 2002 18:42:44 -0000 1.13
@@ -365,6 +365,37 @@
srcToUse = new LocalFileInputSource(systemId);
}
+ catch(const XMLException& excToCatch)
+ {
+ //
+ // For any other XMLException,
+ // emit the error and catch any user exception thrown from here.
+ //
+ fInException = true;
+ if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning)
+ emitError
+ (
+ XMLErrs::XMLException_Warning
+ , excToCatch.getType()
+ , excToCatch.getMessage()
+ );
+ else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal)
+ emitError
+ (
+ XMLErrs::XMLException_Fatal
+ , excToCatch.getType()
+ , excToCatch.getMessage()
+ );
+ else
+ emitError
+ (
+ XMLErrs::XMLException_Error
+ , excToCatch.getType()
+ , excToCatch.getMessage()
+ );
+ return;
+ }
+
catch(...)
{
// Just rethrow this, since its not our problem
@@ -554,15 +585,51 @@
// it has to be fully qualified. If not, then assume we are just
// mistaking a file for a URL.
//
+
XMLURL tmpURL(systemId);
- if (tmpURL.isRelative())
- ThrowXML(MalformedURLException, XMLExcepts::URL_NoProtocolPresent);
- srcToUse = new URLInputSource(tmpURL);
+ if (tmpURL.isRelative()) {
+ srcToUse = new LocalFileInputSource(systemId);
+ }
+ else
+ {
+ srcToUse = new URLInputSource(tmpURL);
+ }
}
catch(const MalformedURLException&)
{
srcToUse = new LocalFileInputSource(systemId);
+ }
+
+ catch(const XMLException& excToCatch)
+ {
+ //
+ // For any other XMLException,
+ // emit the error and catch any user exception thrown from here.
+ //
+ fInException = true;
+ if (excToCatch.getErrorType() == XMLErrorReporter::ErrType_Warning)
+ emitError
+ (
+ XMLErrs::XMLException_Warning
+ , excToCatch.getType()
+ , excToCatch.getMessage()
+ );
+ else if (excToCatch.getErrorType() >= XMLErrorReporter::ErrType_Fatal)
+ emitError
+ (
+ XMLErrs::XMLException_Fatal
+ , excToCatch.getType()
+ , excToCatch.getMessage()
+ );
+ else
+ emitError
+ (
+ XMLErrs::XMLException_Error
+ , excToCatch.getType()
+ , excToCatch.getMessage()
+ );
+ return false;
}
catch(...)
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org