Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 14382 invoked from network); 13 Oct 2002 02:26:57 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 13 Oct 2002 02:26:57 -0000 Received: (qmail 20288 invoked by uid 97); 13 Oct 2002 02:27:50 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 20272 invoked by uid 97); 13 Oct 2002 02:27:50 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 20261 invoked by uid 97); 13 Oct 2002 02:27:49 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: 13 Oct 2002 02:26:50 -0000 Message-ID: <20021013022650.2420.qmail@icarus.apache.org> From: dmitri@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri JXPathContextReferenceImpl.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N dmitri 2002/10/12 19:26:50 Modified: jxpath/src/java/org/apache/commons/jxpath/ri JXPathContextReferenceImpl.java Log: Fixed this bug: setLenient(true) did not have the advertised effect in some cases Revision Changes Path 1.22 +19 -8 jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/JXPathContextReferenceImpl.java Index: JXPathContextReferenceImpl.java =================================================================== RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/JXPathContextReferenceImpl.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- JXPathContextReferenceImpl.java 26 Aug 2002 22:29:49 -0000 1.21 +++ JXPathContextReferenceImpl.java 13 Oct 2002 02:26:50 -0000 1.22 @@ -211,15 +211,26 @@ public Object getValue(String xpath, Expression expr){ Object result = expr.computeValue(getRootContext()); - if (result == null && !lenient){ - throw new JXPathException("No value for xpath: " + xpath); - } - 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){ + if (!lenient && !((NodePointer)result).isActual()){ + // We need to differentiate between pointers representing + // a non-existing property and one 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.isNode() || !parent.isActual()){ + throw new JXPathException("No value for xpath: " + xpath); + } + } result = ((NodePointer)result).getValue(); } return result; -- To unsubscribe, e-mail: For additional commands, e-mail: