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.
Michael Kay
Saxon extensions
v7.3.1
Public
|
Date: 2003-02-14 13:54 Logged In: YES |
| Field | Old Value | Date | By |
|---|---|---|---|
| status_id | Open | 2003-02-17 12:18 | mhkay |
| close_date | - | 2003-02-17 12:18 | mhkay |