public List<XdmNode> errors() { // Errors accumulate on the nearest p:try/p:group ancestor int pos = stack.size() - 1; while (pos >= 0 && !tryGroup(stack.get(pos).step)) { pos = pos - 1; } if (pos >= 0) { return stack.get(pos).errors; } else { return new Stack<XdmNode> (); } }
public List<XdmNode> errors() { // Errors accumulate on the nearest p:try/p:group ancestor int pos = stack.size() - 1; while (pos >= 0 && !tryGroup(stack.get(pos).step)) { pos = pos - 1; } if (pos >= 0) { return stack.get(pos).errors; } else { return new Stack<XdmNode> (); } }
public boolean catchError(XdmNode error) { // Errors accumulate on the nearest p:try/p:group ancestor because that's where we // can read them. Note, however, that errors raised in a p:catch are NOT // part of the parent p:try but rather the grandparent. int pos = stack.size() - 1; if (stack.size() > 0 && XProcConstants.p_catch.equals(stack.peek().step.getType())) { pos = pos - 2; } while (pos >= 0 && !tryGroup(stack.get(pos).step)) { pos = pos - 1; } if (pos >= 0) { stack.get(pos).errors.add(error); return true; } else { return false; } }
public boolean catchError(XdmNode error) { // Errors accumulate on the nearest p:try/p:group ancestor because that's where we // can read them. Note, however, that errors raised in a p:catch are NOT // part of the parent p:try but rather the grandparent. int pos = stack.size() - 1; if (stack.size() > 0 && XProcConstants.p_catch.equals(stack.peek().step.getType())) { pos = pos - 2; } while (pos >= 0 && !tryGroup(stack.get(pos).step)) { pos = pos - 1; } if (pos >= 0) { stack.get(pos).errors.add(error); return true; } else { return false; } }