Project

Profile

Help

Bug #5803

closed

XPathExampleSA schema-aware sample application is failing

Added by Michael Kay about 1 year ago. Updated about 1 year ago.

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

100%

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

Description

This sample application is failing on the 12.x branch, but the erroneous code is also present in 11.x and earlier releases.

The sample uses the JAXP XPath API, but with schema-aware processing.

The extension function ToCentimetres is expecting the first argument to be supplied as a list of BigDecimal values - presumably based on the validated type of the DIMENSIONS element. It is actually being supplied as a single BigDecimal value.

Actions #1

Updated by Michael Kay about 1 year ago

During type-checking, Atomizer.computeSingleValued() has wrongly concluded that the result of data(DIMENSIONS) will be a singleton, and is therefore passing a single number to the XPath JAXP extension function, which crashes because it expects a list.

Saxon 11 is making the same incorrect inference (the code is unchanged), but isn't making use of the information at run-time. The new expression elaboration code does make use of the information. Specifically, in 11.x, Atomizer.oneToOne is computed as false, but Atomizer.getAtomizingIterator() ignores this and processes the value as a sequence regardless. In 12.x, AtomizerElaborator.lazily() constructs return new LearningEvaluator(expr, new MemoClosureEvaluator(expr, elaborateForPull()));, and the MemoClosureEvaluator calls Cardinality.allowsMany() on the Atomizer, which thinks it will return a singleton.

Actions #2

Updated by Michael Kay about 1 year ago

The incorrect logic is in Atomizer.computeSingleValued() where it does:

if ( .... || st.isComplexType() && st != AnyType.getInstance())) {
   singleValued = true;
}

In this case st is a complex type with simple content, and the simple content type is a list type, so the atomised result is sequence-valued.

Actions #3

Updated by Michael Kay about 1 year ago

  • Project changed from 20 to Saxon
  • Description updated (diff)
  • Category set to Internals
  • Status changed from New to In Progress
  • Priority changed from Low to Normal
  • Applies to branch 10, 11, trunk added
  • Fix Committed on Branch trunk added
Actions #4

Updated by Michael Kay about 1 year ago

  • Status changed from In Progress to Resolved
  • Fix Committed on Branch 10, 11 added
  • Platforms .NET, Java added
Actions #5

Updated by Community Admin about 1 year ago

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

Bug issue fix applied in the Saxon 12.0 Major Release. Leaving this bug marked as Resolved until fix applied

Actions #6

Updated by O'Neil Delpratt about 1 year ago

  • Fixed in Maintenance Release 11.5 added

Bug fix applied in the Saxon 11.5 maintenance release.

Actions #7

Updated by O'Neil Delpratt about 1 year ago

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

Bug fix applied in the Saxon 10.9 maintenance release.

Please register to edit this issue

Also available in: Atom PDF