Project

Profile

Help

Revision aa2ef805

Added by Michael Kay over 1 year ago

Fix bug #4535

View differences:

latest9.9/hej/net/sf/saxon/ma/arrays/ImmutableArrayItem.java
41 41
     */
42 42
    @Override
43 43
    public GroundedValue<?> get(int index) throws XPathException {
44
        try {
45
            return vector.get(index);
46
        } catch (IndexOutOfBoundsException e) {
47
            throw new XPathException(e.getMessage(), "FOAY0001");
44
        if (index < 0 || index >= vector.size()) {
45
            throw new XPathException("Array index (" + (index + 1) + ") out of range (1 to " + vector.size() + ")", "FOAY0001");
48 46
        }
47
        return vector.get(index);
49 48
    }
50 49

  
51 50
    /**
......
58 57
     */
59 58
    @Override
60 59
    public ArrayItem put(int index, GroundedValue newValue) throws XPathException {
61
        try {
62
            ImmList<GroundedValue<?>> v2 = vector.replace(index, newValue);
63
            return v2 == vector ? this : new ImmutableArrayItem(v2);
64
        } catch (IndexOutOfBoundsException e) {
65
            throw new XPathException(e.getMessage(), "FOAY0001");
60
        if (index < 0 || index >= vector.size()) {
61
            throw new XPathException("Array index (" + (index + 1) + ") out of range (1 to " + vector.size() + ")", "FOAY0001");
66 62
        }
63
        ImmList<GroundedValue<?>> v2 = vector.replace(index, newValue);
64
        return v2 == vector ? this : new ImmutableArrayItem(v2);
67 65
    }
68 66

  
69 67
    /**

Also available in: Unified diff