Project

Profile

Help

Bug #2536

closed

Failure to check that node returned by extension function has wrong NamePool

Added by Michael Kay almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Saxon extensions
Sprint/Milestone:
Start date:
2015-12-10
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.5, 9.6, 9.7
Fix Committed on Branch:
9.6, 9.7
Fixed in Maintenance Release:
Platforms:

Description

Saxon is intended to check that when a node is returned by a Java reflexive extension function, the node uses the same NamePool as was used to compile the calling query or stylesheet. If it uses a different namepool, the mapping of integer codes to QNames will be different so names may not match when they should, or vice versa.

This check is not always happening. Saxon decides to perform the check if the static result type permits nodes to be returned. In the case in question, the declared return type of the Java method is "Object"; from this Saxon determines a static type for the function call of JavaExternalObjectType, and this is considered to exclude nodes.

In fact, it is the type inference that is wrong. The declared type of the Java method is Object, but the actual return value is a SequenceIterator. Saxon assumes that when the declared result type is Object, the converted result will be a wrapped External Object, but this is not the case if the actual value is a SequenceIterator. (Surprisingly, it seems that if the dynamic result is something like NodeInfo, then it will still be wrapped as an external object: but I haven't tested that.)

The problem was reported against 9.5 but is still present in 9.7 (though I expect the detailed code paths may have changed).

Please register to edit this issue

Also available in: Atom PDF