commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dmi...@apache.org>
Subject Re: [jxpath] org.apache.commons.jxpath.JXPathException: no read method
Date Fri, 04 Mar 2005 15:51:22 GMT
Vasiliy,
 
Very good point.  I will commit a fix to getAccessibleMethodFromInterfaceNest tonight.
 
Thank you very much for pointing this out.
 
- Dmitri
 


Vasiliy Stashuk <vasiliy_stashuk@priocom.com> wrote:
Making B public will help. But what if I'm using anonymous class instead 
of B, like this:

JXPathContext ctx = JXPathContext.newContext(new A() {
public String getName() {
return "theName";
}
});

?

Thanks for the help.

On Fri, 04 Mar 2005 16:40:55 +0200, Dmitri Plotnikov 
wrote:

> Vasiliy,
> You need to change the visibility of class B from default to public. 
> JXPath only supports access to public classes.
> Let me know if this helps.
> - Dmitri
>
>
> Vasiliy Stashuk wrote:
> Hi!
>
> I have problem while accessing java bean properties via JXPath. Consider
> following
> example.
>
> puvlic class BlaBla {
> public static interface Provider {
> public String getName();
> }
>
> public static abstract class A implements Provider {
> }
>
> static class B extends A {
> public String getName() {
> return "theName";
> }
> }
>
> public static void main(String[] args) throws Exception {
> B b = new B();
>
> JXPathContext ctx = JXPathContext.newContext(b);
>
> System.out.println(ctx.getValue("name"));
> }
> }
>
> JXPath fails with:
> "org.apache.commons.jxpath.JXPathException: Cannot access property:
> BlaBla$B.name; No read method"
>
> This is may be a bug in the
> ValueUtils.getAccessibleMethodFromInterfaceNest method.
> It doesn't get down thru class hierarchy when looking for public accessor
> method.
>



-- 
All the best,
Vasyl Stashuk

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message