Donate Share

Saxon XSLT and XQuery Processor

Tracker: Bugs

5 FunctionProxy fails on List returns - ID: 659064
Last Update: Settings changed ( mhkay )

FunctionProxy assumes all return values that are
instanceof java.util.List are in fact List<Item> and
converts them to SequenceExtent. This may cause
ClassCastException when the element type is not an
Item. Suggest to change:

In FunctionProxy where it says:

} else if (result instanceof List) {
return new SequenceExtent((List)result);
}

at a minimum change this to

} else if (result instanceof List) {
List rlist = (List)result;
if(rlist.isEmpty() || rlist.get(0).instanceof Item)
try {
return new SequenceExtent((List)result);
} catch(ClassCastException ex) { }
/*FALLTHROUGH*/
return new ObjectValue(result);
}

this is safe and avoids using the relatively expensive
exception only for the weird (and probably extremely
rare) cases of heterogenous lists where the first element
is an Item and yet no-Items are contained as well.

Michael, hope you don't mind me submitting this as a
bug, because this part of our earlier conversation is
indeed a bug. I have removed any of my whishlist
extensions (the SequenceIntent(iterator) stuff) as that is
more safely don explicitly rather than by magic.


Gunther Schadow ( gschadow ) - 2002-12-27 17:06

5

Closed

None

Michael Kay

Saxon extensions

v7.3.1

Public


Comment ( 1 )

Date: 2003-02-14 13:54
Sender: mhkayProject Admin

Logged In: YES
user_id=251681

In 7.4 I have changed the handling of extension functions
that return a List. The List is now interpreted as an XPath
sequence. Each of the items is converted individually from a
Java object to an XPath item. If the members of the list are
unknown types, you end up with each item being wrapped as an
XPath external object, rather than with the List as a whole
being treated as an external object,


Attached File

No Files Currently Attached

Changes ( 2 )

Field Old Value Date By
status_id Open 2003-02-17 12:18 mhkay
close_date - 2003-02-17 12:18 mhkay