SaxonApiException::getSystemId() throws NullPointerException

Added by Paul Greve about 1 year ago

Using SaxonC 12.2 to validate a source document against a schema. If an exception is caught and getSystemId() is called on the exception, I get the following error and my process dies:

java.lang.NullPointerException: null at net.sf.saxon.option.cpp.SaxonCAPI.stringToNative2( at net.sf.saxon.option.cpp.SaxonCException.getSystemId(

ex. catch(SaxonApiException& e) { const char*systemId = (e.getSystemId() == nullptr) ? "" : e.getSystemId(); printf("SystemId: ", systemId); }

The exception can be due to anything. ex. parse or validation errors in the source doc or a missing license file.

Is this expected behavior?

Replies (2)

RE: SaxonApiException::getSystemId() throws NullPointerException - Added by O'Neil Delpratt about 1 year ago

This is a bug. If the URI of the module associated with the exception is unknown then we should return NULL.

Created the bug issue #6098 to track progress.

I have applied the fix for this in the underlying java class that handles exceptions. This will be available in the next maintenance release.


    Please register to reply