ArrayIndexOutOfBounds exception processing XDM Arrays in XSLT
Failure reported by Ruud Grossmann on saxon-help mailing list. Reproduced as XSLT3 test case arrays-304.
java.lang.IndexOutOfBoundsException: Requested 2, actual size 1 at net.sf.saxon.ma.parray.ImmList.outOfBounds(ImmList.java:194) at net.sf.saxon.ma.parray.ImmList1.subList(ImmList1.java:95) at net.sf.saxon.ma.parray.ImmList2.subList(ImmList2.java:114) at net.sf.saxon.ma.parray.ImmList2.subList(ImmList2.java:112) at net.sf.saxon.ma.parray.ImmList2.subList(ImmList2.java:114)
#1 Updated by Michael Kay over 1 year ago
- Status changed from New to Resolved
- Fix Committed on Branch 10, 9.9 added
There's an error in the logic for
array:subarray(). Probably not worth going into the detail. Arrays are implemented using an immutable binary tree structure, and the implementation for
subarray() make recursive calls to extract and concatenate parts of the subtrees, as can be seen on the stack trace.
Patch applies to
#2 Updated by Michael Kay over 1 year ago
Looking at the QT3 tests for array:subarray, they have the problem that none of the arrays used as arguments to
array:subarray() have been through any kind of incremental modification process. This means that the internal structure is likely to be very "clean". Some implementations might even use a completely different data structure for an array that is incrementally modified and an array that is static and unchanging after initialisation. The same criticism can also be applied to other array tests in QT3.
Added an XSLT3 test arrays-305 to exercise the code a bit more heavily.
Please register to edit this issue