Duplicate source error message in exception (Saxon 11)
In the method net.sf.saxon.resource.ActiveSAXSource.deliver(Receiver, ParseOptions) there is this throw:
throw new XPathException("I/O error reported by XML parser processing " + getSystemId() + ": " + err.getMessage(), err);
which adds the source message to the initial message. But the method "net.sf.saxon.trans.XPathException.getMessage()" again uses the exception source message. So you end up with a reported error message which contains the same message twice like:
I/O error reported by XML parser processing : file not found: file not found
Updated by Michael Kay 2 months ago
- Category set to Diagnostics
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Applies to branch 11, trunk added
- Fix Committed on Branch 11, trunk added
Fixed as suggested. Tested as follows: ran from the command line, with a source document whose DOCTYPE points to a non-existent DTD file.
On SaxonJ the message is now:
I/O error reported by XML parser processing file:/Users/xxxx...../samples/data/books.xml: /Users/xxxx...../samples/data/bookszz.dtd (No such file or directory)
On SaxonCS the message is:
Error reported by XML parser processing file:///Users/xxxx...../samples/data/books.xml: Cannot resolve external DTD subset - public ID = '', system ID = 'bookszz.dtd'.
Updated by Radu Coravu about 2 months ago
I think my judgement about this was wrong, the method "XPathException.getMessage()" actually seems to be filtered out by your custom compilation process when the Java JAR library is created, the method is there only for the CSharp distribution.
So the code which added the error message to the initial exception error message in ActiveSAXSource.deliver was probably correct as it was, at least for the Java Saxon Library.
Please register to edit this issue