Actions
Bug #6378
closedNPE while transforming with a TraceListener
Start date:
2024-03-26
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
While debugging with Oxygen the xml file: 47465.xml with the stylesheet: bho-to-clml.xml and using as configuration file for SaxonEE the "saxon.xml" file, we got the following exception:
ERROR [ TransformationEngine ] ro.sync.xml.transformer.TransformerCreator - Got a NPE trying to validate a stylesheet!! java.lang.NullPointerException
java.lang.NullPointerException: null
at net.sf.saxon.expr.parser.ExpressionTool.injectCode(ExpressionTool.java:175)
at net.sf.saxon.trace.TraceCodeInjector.process(TraceCodeInjector.java:46)
at net.sf.saxon.style.XSLGlobalVariable.compileDeclaration(XSLGlobalVariable.java:299)
at net.sf.saxon.style.PrincipalStylesheetModule.compile(PrincipalStylesheetModule.java:1291)
at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:324)
at net.sf.saxon.trans.packages.PackageLibrary.obtainLoadedPackage(PackageLibrary.java:309)
at net.sf.saxon.style.Compilation.satisfyPackageDependencies(Compilation.java:205)
at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:283)
at net.sf.saxon.style.StylesheetModule.loadStylesheet(StylesheetModule.java:254)
at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:113)
at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:971)
at net.sf.saxon.jaxp.SaxonTransformerFactory.newTemplates(SaxonTransformerFactory.java:174)
at net.sf.saxon.jaxp.SaxonTransformerFactory.newTransformer(SaxonTransformerFactory.java:131)
at ro.sync.xml.transformer.TransformerCreator.createInternalXSLTTransformer(TransformerCreator.java:2556)
at ro.sync.xml.transformer.TransformerCreator.createXSLOrJSONTransformer(TransformerCreator.java:1641)
at ro.sync.xml.transformer.TransformerCreator.createTransformer(TransformerCreator.java:811)
at ro.sync.xml.transformer.TransformerCreator.createTransformer(TransformerCreator.java:708)
at ro.sync.xml.transformer.TransformerCreator.createTransformer(TransformerCreator.java:684)
at ro.sync.dxsl.debugger.saxon8.SaxonXSLTDebugger.createTransformer(SaxonXSLTDebugger.java:235)
at ro.sync.dxsl.debugger.AbstractXSLTDebugger.initEngine(AbstractXSLTDebugger.java:429)
at ro.sync.dxsl.debugger.AbstractXSLTDebugger.run(AbstractXSLTDebugger.java:561)
at java.base/java.lang.Thread.run(Thread.java:1595)
Please note that we use in Oxygen Saxon 12.3.
We reproduce the problem also from the command line, using the Saxon-EE 12.4:
java -jar saxon-ee-12.4.jar -s:47465.xml -xsl:bho-to-clml.xsl -config:saxon.xml -T
java.lang.NullPointerException: Cannot invoke "net.sf.saxon.expr.Expression.operands()" because "exp" is null
at net.sf.saxon.expr.parser.ExpressionTool.injectCode(ExpressionTool.java:175)
at net.sf.saxon.trace.TraceCodeInjector.process(TraceCodeInjector.java:46)
at net.sf.saxon.style.XSLGlobalVariable.compileDeclaration(XSLGlobalVariable.java:299)
at net.sf.saxon.style.PrincipalStylesheetModule.compile(PrincipalStylesheetModule.java:1290)
at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:338)
at net.sf.saxon.trans.packages.PackageLibrary.obtainLoadedPackage(PackageLibrary.java:309)
at net.sf.saxon.style.Compilation.satisfyPackageDependencies(Compilation.java:207)
at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:297)
at net.sf.saxon.style.StylesheetModule.loadStylesheet(StylesheetModule.java:254)
at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:115)
at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:971)
at net.sf.saxon.Transform.doTransform(Transform.java:777)
at net.sf.saxon.Transform.main(Transform.java:83)
Fatal error during transformation: java.lang.NullPointerException: Cannot invoke "net.sf.saxon.expr.Expression.operands()" because "exp" is null
Regards, Mircea.
Files
Updated by Michael Kay 8 months ago
So far I haven't been able to reproduce this. I shall keep trying.
Updated by Michael Kay 8 months ago
Now reproduced. For some reason I dropped the -T option.
Updated by Michael Kay 8 months ago
- Category set to XSLT 3.0 packages
- Assignee set to Michael Kay
OK, got it: it's trying to inject trace code into the body of the variable
<xsl:variable name="common:reportId" visibility="abstract"/>
which doesn't have a body because it is abstract.
Updated by Michael Kay 8 months ago
- Status changed from New to Resolved
- Priority changed from High to Normal
- Applies to branch 11, 12, trunk added
- Fix Committed on Branch 11, 12, trunk added
- Platforms Java added
Updated by O'Neil Delpratt 5 months ago
- % Done changed from 0 to 100
- Fixed in Maintenance Release 12.5 added
Bug fix applied in the Saxon 12.5 Maintenance release. Not marking this closed until patched in older releases (i.e 11.x).
Please register to edit this issue
Actions