Project

Profile

Help

Bug #6346

closed

NPE with replace() on SaxonJS2.6 when exported under 4.0-support conditions

Added by John Lumley 9 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Category:
Documentation
Sprint/Milestone:
-
Start date:
2024-02-14
Due date:
% Done:

0%

Estimated time:
Applies to JS Branch:
Trunk
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

When exporting a stylesheet (either 3.0 or 4.0) for SaxonJS 2.6, using SaxonEE 12.4 running under --allowSyntaxExtensions:on, a three-argument call on replace() (that is with the fourth $flags argument to default to the empty string), at runtime a null pointer expection is thrown when attempting to retrieve the flags:

const flags = args[3] ? args[3].next().toString() : "";

The next() returns a null.

Without allowSyntaxExtensions or with the fourth argument supplied, the function behaves as expected.

Sample stylesheet, compiled SEF and web page attached


Files

replaceBug.sef.json (1.62 KB) replaceBug.sef.json John Lumley, 2024-02-14 15:03
replaceBug.xhtml (414 Bytes) replaceBug.xhtml John Lumley, 2024-02-14 15:03
replaceBug.xsl (561 Bytes) replaceBug.xsl John Lumley, 2024-02-14 15:03
Actions #1

Updated by Debbie Lockett 9 months ago

Basically, SaxonJS 2 does not support 4.0 syntax, so exporting for -target:JS from 12.4 with --allowSyntaxExtensions:on is not supported.

As you have found, although the stylesheet may compile, it will not necessarily run. I think this is a Saxon 12 bug, rather than a SaxonJS bug. We should add something in the documentation to clarify this (i.e. you can't use 4.0 syntax and --allowSyntaxExtensions:on when exporting for SaxonJS 2). Also it would be better if this was clearer at compile time - i.e. the compile should fail, or at least produce a warning.

Actions #2

Updated by Debbie Lockett 6 months ago

  • Category set to Documentation
  • Status changed from New to Closed
  • Assignee set to Debbie Lockett

The problem was belatedly raised as Saxon Bug #6433: Forbid enabling 4.0 and specifying an SEF target of JS2/3, which has been resolved on the saxon12 branch and will be fixed in the next maintenance release 12.5.

I've added a note in the SaxonJS documentation to state that 4.0 language extensions are not supported in SaxonJS (at https://www.saxonica.com/saxon-js/documentation2/index.html#!ixsl-extension/saxon-extensions).

Please register to edit this issue

Also available in: Atom PDF Tracking page