Project

Profile

Help

Bug #5809

closed

NPE on failure to load user-supplied collation class

Added by Radu Coravu almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2023-01-13
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, 12, trunk
Fix Committed on Branch:
11, 12, trunk
Fixed in Maintenance Release:
Platforms:
Java

Description

Cannot attach the samples as they were provided by an end user. As a general description, the XSLT stylesheet refers to a collation:

<xsl:sort select="tst:getDictionaryForm(.)" collation="http://saxon.sf.net/collation?class=abc.MyCollation" />

and Saxon cannot find the collation:

java.lang.ClassNotFoundException: abc.MyCollation
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at net.sf.saxon.trans.DynamicLoader.getClass(DynamicLoader.java:113)
	at net.sf.saxon.trans.DynamicLoader.getInstance(DynamicLoader.java:181)
	at net.sf.saxon.Configuration.getInstance(Configuration.java:782)
	at net.sf.saxon.java.JavaCollationFactory.makeCollation(JavaCollationFactory.java:61)
	at net.sf.saxon.java.JavaPlatform.makeCollation(JavaPlatform.java:404)
	at net.sf.saxon.lib.StandardCollationURIResolver.resolve(StandardCollationURIResolver.java:83)
	at net.sf.saxon.Configuration.getCollation(Configuration.java:1662)
	at net.sf.saxon.Configuration.getCollation(Configuration.java:1687)
	at net.sf.saxon.style.StyleElement.findCollation(StyleElement.java:1257)
	at net.sf.saxon.style.XSLSortOrMergeKey.validate(XSLSortOrMergeKey.java:88)
	at net.sf.saxon.style.XSLSort.validate(XSLSort.java:23)
	at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1823)
	at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1856)
	at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1827)
	at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1856)
	at net.sf.saxon.style.LiteralResultElement.validateChildren(LiteralResultElement.java:293)
	at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1827)
	at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1856)
	at net.sf.saxon.style.LiteralResultElement.validateChildren(LiteralResultElement.java:293)
	at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1827)
	at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1856)
	at net.sf.saxon.style.LiteralResultElement.validateChildren(LiteralResultElement.java:293)
	at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1827)
	at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1856)

so it attempts to create an XML processing incident without error code, which fails with a null assertion:

java.lang.NullPointerException: null
	at java.util.Objects.requireNonNull(Objects.java:203)
	at net.sf.saxon.trans.XmlProcessingIncident.<init>(XmlProcessingIncident.java:54)
	at net.sf.saxon.style.StyleElement.compileError(StyleElement.java:2475)
	at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1825)
	at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1856)
Actions #1

Updated by Radu Coravu almost 2 years ago

The issue can be reproduced with both Saxon 11.2 and 10.8.

Actions #2

Updated by Michael Kay almost 2 years ago

  • Applies to branch 11, 12, trunk added
  • Fix Committed on Branch 11, 12, trunk added
  • Platforms Java added

Added xslt3extra test case collation-009.

Diagnostics fixed on 11.x and 12.x branches.

Made similar changes for xsl:key and xsl:for-each-group, added test cases collation-010 and collation-011.

Actions #3

Updated by Michael Kay almost 2 years ago

  • Status changed from New to Resolved
Actions #4

Updated by Michael Kay almost 2 years ago

  • Subject changed from NPE when creating XmlProcessingIncident to NPE on failure to load user-supplied collation class
  • Category set to Diagnostics
  • Assignee set to Michael Kay
  • Priority changed from Low to Normal
Actions #5

Updated by Radu Coravu almost 2 years ago

Thanks Michael.

Actions #6

Updated by O'Neil Delpratt almost 2 years ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 11.5 added

Bug fix applied in the Saxon 11.5 maintenance release.

Actions #7

Updated by O'Neil Delpratt almost 2 years ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 12.1 added

Bug fix applied in the Saxon 12.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF