Project

Profile

Help

Bug #6401

closed

Exception running transform: NullPointer exception found: net.sf.saxon.s9api.SaxonApiException

Added by O'Neil Delpratt 7 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
Saxon-C Internals
Start date:
2024-04-24
Due date:
% Done:

100%

Estimated time:
Applies to branch:
Fix Committed on Branch:
12
Fixed in Maintenance Release:
Found in version:
12.4.2
Fixed in version:
12.5
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

Description

Reported by user in the forum post: https://saxonica.plan.io/boards/4/topics/9646?r=9650#message-9650

I'm getting an NPE when I try setting a filename on the executable:

Python code:

        message_path: str = output_dir.joinpath('xslt-messages.xml').as_posix()
        executable.set_save_xsl_message(True, message_path);
        executable.transform_to_file(xdm_node=document)

Which results in this exception:

[ERROR] Exception running transform: NullPointer exception found: net.sf.saxon.s9api.SaxonApiException
        at net.sf.saxon.option.cpp.Xslt30Processor.transformToFile(Xslt30Processor.java:1585)
Caused by: java.lang.NullPointerException
        at net.sf.saxon.option.cpp.SaxonCMessageListener.<init>(SaxonCMessageListener.java:46)
        at net.sf.saxon.option.cpp.Xslt30Processor.applyXsltTransformerProperties(Xslt30Processor.java:1716)
        at net.sf.saxon.option.cpp.Xslt30Processor.transformToFile(Xslt30Processor.java:1561)
Actions #1

Updated by O'Neil Delpratt 6 months ago

  • Status changed from New to In Progress
Actions #2

Updated by O'Neil Delpratt 6 months ago

The java method createSaxonCMessageListener in the SaxonCMessageListener class has the wrong exceptionHandler. It should be using SaxonCExceptionLongHandler.class instead of SaxonCExceptionCLongPointerHandler.class. This causes us to miss the exception that is thrown.

Actions #3

Updated by O'Neil Delpratt 6 months ago

With that fixed I think the unerlying problem is URI resolving issue:

Traceback (most recent call last):
  File "/Users/ond1/work/development/git/saxon-dev/saxondev/../misc/example3.py", line 15, in <module>
    executable.set_save_xsl_message(True, message_path)
  File "python_saxon/saxonc.pyx", line 2133, in saxoncee.PyXsltExecutable.set_save_xsl_message
saxoncee.PySaxonApiError: Unable to resolve <xsl_messages/xslt-messages.xml> into a Source. Line number: -1
Actions #4

Updated by O'Neil Delpratt 6 months ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Bug fixed so that we now have xsl:messages saved to file. Added test to the pytests

Actions #5

Updated by O'Neil Delpratt 5 months ago

  • Status changed from Resolved to Closed
  • Fixed in version set to 12.5

Bug fix applied in the Saxon 12.5 Maintenance release.

Actions #6

Updated by Community Admin 5 months ago

  • Fix Committed on Branch 12 added

Please register to edit this issue

Also available in: Atom PDF