Bug #3176
closedNullPointerException when parsing invalid regex
0%
Description
When compiling the attached stylesheet (npe.xsl), an internal NullPointerException is thrown:
java.lang.NullPointerException: NullPointerException processing net.sf.saxon.expr.ErrorExpression
at net.sf.saxon.expr.Expression.getConfiguration(Expression.java:829)
at net.sf.saxon.expr.Atomizer.getItemType(Atomizer.java:349)
at net.sf.saxon.expr.parser.TypeChecker.staticTypeCheck(TypeChecker.java:193)
at net.sf.saxon.expr.instruct.Choose.staticTypeCheck(Choose.java:350)
at net.sf.saxon.expr.parser.TypeChecker.staticTypeCheck(TypeChecker.java:85)
at net.sf.saxon.style.SourceBinding.checkAgainstRequiredType(SourceBinding.java:322)
at net.sf.saxon.style.SourceBinding.postValidate(SourceBinding.java:246)
at net.sf.saxon.style.XSLGlobalVariable.postValidate(XSLGlobalVariable.java:84)
at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1563)
at net.sf.saxon.style.StylesheetPackage.preprocess(StylesheetPackage.java:444)
at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:180)
at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:94)
at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:543)
at net.sf.saxon.Transform.doTransform(Transform.java:601)
at net.sf.saxon.Transform.main(Transform.java:80)
Fatal error during transformation: java.lang.NullPointerException: NullPointerException processing net.sf.saxon.expr.ErrorExpression
This bug does not exist in Version 9.7.0.15 but in 9.6.0.10
Version 9.7.0.15 generates the correct warning:
Warning at char 61 in xsl:variable/@select on line 10 column 44 of npe.xsl:
SXWN9000: Evaluation will always throw a dynamic error: The regular expression must not be
one that matches a zero-length string
Files
Updated by Michael Kay over 7 years ago
- Category set to Diagnostics
- Assignee set to Michael Kay
- Applies to branch 9.6 added
Thanks for letting us know. The 9.6 branch is now in a state where we will still consider producing bug fixes, but only if the bug is causing serious inconvenience. A failure that only occurs on an error path doesn't fall into that category, so this is likely to be a "won't fix".
Updated by Michael Kay over 7 years ago
- Status changed from New to Resolved
- Fix Committed on Branch 9.6 added
I've patched this on the 9.6 branch, just in case we ever produce another maintenance release. More importantly, I've checked that the underlying problem seems to be solved in 9.7 and 9.8. (It remains a fragile area, ensuring that the expression tree is always consistent and complete after a local rewrite, but there are more checks now in place.)
Please register to edit this issue