Bug #2736
closedNullPointerException in Saxon 9.7 evaluating an expression which involves an anonymous type
100%
Description
We have an XPath expression containing an attribute predicate of the form:
[@foo = 3].
The 'foo' attribute in question has a named union type which is the union of xs:integer and an anonymous restriction of xs:string to a single enumerated value.
When the value of the attribute is the allowed string value we expect a type error from evaluation of the predicate but generating the error is giving an NPE from the type's toString in Saxon 9.7 (it was successful in Saxon 9.6).
The stack trace is:
java.lang.NullPointerException
at com.saxonica.ee.schema.UserAtomicType.toString(UserAtomicType.java:490)
at net.sf.saxon.type.Type.displayTypeName(Type.java:256)
at net.sf.saxon.expr.ValueComparison.compare(ValueComparison.java:720)
at net.sf.saxon.expr.GeneralComparison.compare(GeneralComparison.java:820)
at net.sf.saxon.expr.GeneralComparison.evaluateManyToOne(GeneralComparison.java:676)
at net.sf.saxon.expr.GeneralComparison.effectiveBooleanValue(GeneralComparison.java:625)
at net.sf.saxon.expr.FilterIterator$NonNumeric.matches(FilterIterator.java:198)
at net.sf.saxon.expr.FilterIterator.getNextMatchingItem(FilterIterator.java:81)
at net.sf.saxon.expr.FilterIterator.next(FilterIterator.java:64)
at net.sf.saxon.tree.iter.AtomizingIterator.next(AtomizingIterator.java:54)
at net.sf.saxon.tree.iter.AtomizingIterator.next(AtomizingIterator.java:27)
at com.saxonica.ee.optim.GeneralComparisonEE.effectiveBooleanValue(GeneralComparisonEE.java:113)
at net.sf.saxon.sxpath.XPathExpression.effectiveBooleanValue(XPathExpression.java:229)
at net.sf.saxon.s9api.XPathSelector.effectiveBooleanValue(XPathSelector.java:232)
... (non-Saxon code)
Updated by Michael Kay over 8 years ago
- Category set to Schema-Aware processing
- Assignee set to Michael Kay
- Priority changed from High to Normal
Thanks for reporting it. It looks as if the NPE occurs while we are formatting the error message to report the type error.
Updated by Michael Kay over 8 years ago
- Status changed from New to Resolved
- Applies to branch 9.8 added
- Fix Committed on Branch 9.7, 9.8 added
Reproduced the failure with new QT3 test value-comparison-14. Patch committed on the 9.7 and 9.8 branches.
Updated by O'Neil Delpratt over 8 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.7.0.5 added
Bug fix applied in the Saxon 9.7.0.5 maintenance release.
Updated by O'Neil Delpratt over 7 years ago
- Applies to branch trunk added
- Applies to branch deleted (
9.8)
Updated by O'Neil Delpratt over 7 years ago
- Fix Committed on Branch trunk added
- Fix Committed on Branch deleted (
9.8)
Please register to edit this issue