mike-mcgann commented on code in PR #985:
URL: https://github.com/apache/daffodil/pull/985#discussion_r1131638458
##########
daffodil-core/src/main/scala/org/apache/daffodil/core/dsom/DFDLSchemaFile.scala:
##########
@@ -92,12 +92,12 @@ class DFDLSchemaFileLoadErrorHandler(schemaFileLocation:
SchemaFileLocation)
}
/**
- * Called on a fatal exception. The parser/validator throws the exception
after
- * this call returns.
+ * Called on a fatal exception and throws the exception
*/
- def fatalError(exception: SAXParseException) = error(
- exception,
- ) // same as non-fatal exception.
+ def fatalError(exception: SAXParseException) = {
+ loaderErrors_ :+= exception
+ throw exception
Review Comment:
I was reading the SE8 documentation for ErrorHandler and it has this
paragraph:
>For XML processing errors, a SAX driver must use this interface in
preference to throwing an exception: it is up to the application to decide
whether to throw an exception for different types of errors and warnings. Note,
however, that there is no requirement that the parser continue to report
additional errors after a call to
[fatalError](https://docs.oracle.com/javase/8/docs/api/org/xml/sax/ErrorHandler.html#fatalError-org.xml.sax.SAXParseException-).
In other words, a SAX driver class may throw an exception after reporting any
fatalError. Also parsers may throw appropriate exceptions for non-XML errors.
For example,
[XMLReader.parse()](https://docs.oracle.com/javase/8/docs/api/org/xml/sax/XMLReader.html#parse-org.xml.sax.InputSource-)
would throw an IOException for errors accessing entities or the document.
From that I concluded that if you want to stop execution on a fatal error,
an exception should be thrown in `fatalError` since it said the driver *may*
throw an exception. I don't think the driver is required to throw an exception
in this case and there is flexibility for it to throw one or not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]