You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2002/11/13 15:34:59 UTC
DO NOT REPLY [Bug 14505] New: -
Allow accessor to throw exceptions
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14505>.
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>