Object result = expr.computeValue(getEvalContext());
if (result instanceof EvalContext) {
EvalContext ctx = (EvalContext) result;
result = ctx.getSingleNodePointer();
if (!lenient && result == null) {
throw new JXPathException("No value for xpath: " + xpath);
}
}
if (result instanceof NodePointer) {
result = ((NodePointer) result).getValuePointer();
if (!lenient && !((NodePointer) result).isActual()) {
// We need to differentiate between pointers representing
// a non-existing property and ones representing a property
// whose value is null. In the latter case, the pointer
// is going to have isActual == false, but its parent,
// which is a non-node pointer identifying the bean property,
// will return isActual() == true.
NodePointer parent = ((NodePointer) result).getParent();
if (parent == null
|| !parent.isContainer()
|| !parent.isActual()) {
throw new JXPathException("No value for xpath: " + xpath);
}
}
result = ((NodePointer) result).getValue();
}
return result;