File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/org/exist/xquery/functions/array Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -68,13 +68,15 @@ public Sequence get(int n) {
68
68
}
69
69
70
70
@ Override
71
- public Sequence get (AtomicValue key ) throws XPathException {
71
+ public Sequence get (final AtomicValue key ) throws XPathException {
72
72
if (!Type .subTypeOf (key .getType (), Type .INTEGER )) {
73
- throw new XPathException (ErrorCodes .XPTY0004 , "position argument for array lookup must be a positive integer" );
73
+ throw new XPathException (ErrorCodes .XPTY0004 , "Position argument for array lookup must be a positive integer" );
74
74
}
75
75
final int pos = ((IntegerValue )key ).getInt ();
76
76
if (pos <= 0 || pos > getSize ()) {
77
- throw new XPathException (ErrorCodes .XPTY0004 , "position argument for array lookup must be > 0 and < array:size" );
77
+ final String startIdx = vector .length () == 0 ? "0" : "1" ;
78
+ final String endIdx = String .valueOf (vector .length ());
79
+ throw new XPathException (ErrorCodes .FOAY0001 , "Array index " + pos + " out of bounds (" + startIdx + ".." + endIdx + ")" );
78
80
}
79
81
return get (pos - 1 );
80
82
}
You can’t perform that action at this time.
0 commit comments