Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 12289 invoked from network); 13 Nov 2002 14:34:06 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 13 Nov 2002 14:34:06 -0000 Received: (qmail 187 invoked by uid 97); 13 Nov 2002 14:35:01 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 168 invoked by uid 97); 13 Nov 2002 14:35:00 -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 151 invoked by uid 50); 13 Nov 2002 14:34:59 -0000 Date: 13 Nov 2002 14:34:59 -0000 Message-ID: <20021113143459.150.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: commons-dev@jakarta.apache.org Cc: Subject: DO NOT REPLY [Bug 14505] New: - Allow accessor to throw exceptions X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14505 Allow accessor to throw exceptions Summary: Allow accessor to throw exceptions Product: Commons Version: 1.0 Final Platform: PC OS/Version: Windows NT/2K Status: UNCONFIRMED Severity: Enhancement Priority: Other Component: JXPath AssignedTo: commons-dev@jakarta.apache.org ReportedBy: kpetersen@travis.com Overview Description: I am trying to use JXPath for accessing properties objects of different types. Among the instances that I need to access, are objects of implementations that contains methods responding to invokations by throwing an Exception. This will cause the JXPath implementation to fail when processing XPath expressions like "//property". I have attached an example. Would it be possible to alter the JXPath implementation to ignore methods that respond to invokations by throwing an Exception? Steps to Reproduce: Execute the following test class ----------------- import org.apache.commons.jxpath.JXPathContext; public class JXPathTestObject { public String getException(){ throw new NullPointerException(""); } public void setException(String value){} public String getValue(){ return "value"; } public void setValue(String value){} public static void main(String[] args){ JXPathTestObject object = new JXPathTestObject(); String value = (String)JXPathContext.newContext(object).getValue ("//test"); System.out.println(value); System.out.println("READY."); } } ----------------- Actual Results: org.apache.commons.jxpath.JXPathException: Cannot access property: exception; java.lang.reflect.InvocationTargetException at org.apache.commons.jxpath.util.ValueUtils.getValue (ValueUtils.java:290) at org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getBaseValue (BeanPropertyPointer.java:161) at org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getLength (BeanPropertyPointer.java:149) at org.apache.commons.jxpath.ri.model.beans.PropertyIterator.setPositionAllProperti es(PropertyIterator.java:207) at org.apache.commons.jxpath.ri.model.beans.PropertyIterator.setPosition (PropertyIterator.java:149) at org.apache.commons.jxpath.ri.axes.DescendantContext.nextNode (DescendantContext.java:139) at org.apache.commons.jxpath.ri.EvalContext.nextSet (EvalContext.java:344) at org.apache.commons.jxpath.ri.axes.ChildContext.getSingleNodePointer (ChildContext.java:113) at org.apache.commons.jxpath.ri.compiler.Path.getSingleNodePointerForSteps (Path.java:175) at org.apache.commons.jxpath.ri.compiler.LocationPath.computeValue (LocationPath.java:137) at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue (JXPathContextReferenceImpl.java:204) at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue (JXPathContextReferenceImpl.java:200) at JXPathTestObject.main(JXPathTestObject.java:17) Exception in thread "main" Expected Results: The following written in the console --------- value READY. --------- -- To unsubscribe, e-mail: For additional commands, e-mail: