commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <si...@ecnetwork.co.nz>
Subject RE: Jakarta Commons:Digester - Getting IllegalAccessException
Date Tue, 01 Jul 2003 22:38:31 GMT
Just to clarify:

Digester isn't "privileged code" of any sort. Therefore it can only call
*public* methods on *public* classes, just like any other code would. 

The issue Dmitry refers to could make the difference between Digester
reporting "target method not found" vs "IllegalAccessException", but
expecting Digester to call a method on a non-public class will never
work.

Regards,

Simon

On Wed, 2003-07-02 at 01:48, Dmitry Sklyut wrote:
> This is a known limitation.
> 
> From the digester java doc:
> 
> Known Limitations
> Accessing Public Methods In A Default Access Superclass
> 
> There is an issue when invoking public methods contained in a default
> access superclass. Reflection locates these methods fine and correctly
> assigns them as public. However, an IllegalAccessException is thrown
> if the method is invoked.
> 
> MethodUtils contains a workaround for this situation. It will attempt
> to call setAccessible on this method. If this call succeeds, then the
> method can be invoked as normal. This call will only succeed when the
> application has sufficient security privilages. If this call fails
> then a warning will be logged and the method may fail.
> 
> Digester uses MethodUtils and so there may be an issue accessing
> methods of this kind from a high security environment. If you think
> that you might be experiencing this problem, please ask on the mailing
> list.
> 
> -----Original Message-----
> From: Radhika Menon [mailto:radsforyou@lycos.com]
> Sent: Tuesday, July 01, 2003 9:31 AM
> To: radsforyou@lycos.com; Simon Kitching
> Cc: commons-user@jakarta.apache.org
> Subject: Re: Jakarta Commons:Digester - Getting IllegalAccessException
> 
> 
> Hi ,
> I have a bean called RulesConfig which has getters/setters for
> properties "appName" and "precedenceClass".This class has "default"
> access.
> 
> Before parsing,I create an object of this bean and push it onto the
> digester's stack.Then I call the rule
> digester.setProperties matching a pattern, which has to call the
> setters of appName and precedenceClass.
> But,the call to "setAppName" or "setPrecedenceClass" gives the
> IllegalAccessException.
> When I make the class "public", I am not getting this exception.
> 
> Any ideas on why I am getting this behaviour ?
> Thanks
> RM
> 
> 
> 
> --------- Original Message ---------
> 
> DATE: 01 Jul 2003 10:35:59 +120
> From: Simon Kitching <simon@ecnetwork.co.nz>
> To: radsforyou@lycos.com
> Cc: commons-user@jakarta.apache.org
> 
> >Hi,
> >
> >On Tue, 2003-07-01 at 02:10, Radhika Menon wrote:
> >> I am using Digester for parsing xml files in my application.I
> encounter a "IllegalAccessException" when it tries to invoke a public
> method on a "default" access class.
> 
> >
> >>From memory, I think this happens when the method being called
> throws an
> >exception. You should make sure this is not happening.
> >
> >If this guess isn't right, please provide more details, like:
> >* the digester rules
> >* the class being invoked.
> >
> >Regards,
> >
> >Simon
> >
> >
> 
> 
> 
> ____________________________________________________________
> Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
> http://login.mail.lycos.com/r/referral?aid=27005
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


Mime
View raw message