[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Annotation hash check with security enabled

adrian@jboss.org do-not-reply at jboss.com
Tue Apr 1 11:44:50 EDT 2008


"alesj" wrote : 
  | 
  |   | 7828 ERROR [AbstractKernelController] Error installing to Instantiated: name=SimpleBean state=Described
  |   | java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
  |   | 	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
  |   | 	at java.security.AccessController.checkPermission(AccessController.java:427)
  |   | 	at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
  |   | 	at java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
  |   | 	at java.lang.Class.checkMemberAccess(Class.java:2125)
  |   | 	at java.lang.Class.getDeclaredMethods(Class.java:1762)
  |   | 	at sun.reflect.annotation.AnnotationInvocationHandler.getMemberMethods(AnnotationInvocationHandler.java:257)
  |   | 	at sun.reflect.annotation.AnnotationInvocationHandler.equalsImpl(AnnotationInvocationHandler.java:169)
  |   | 	at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:40)
  |   | 	at $Proxy34.equals(Unknown Source)
  |   | 
  | 
  | This looks like a bug in the JDK.
  | 
  | Looking at the open jdk source, the invocation of getDeclaredMembers()
  | should be in a privileged block.
  | 
  | 
  |   | 
  |   |     /**
  |   |      * Returns the member methods for our annotation type.  These are
  |   |      * obtained lazily and cached, as they're expensive to obtain
  |   |      * and we only need them if our equals method is invoked (which should
  |   |      * be rare).
  |   |      */
  |   |     private Method[] getMemberMethods() {
  |   |         if (memberMethods == null) {
  |   |             final Method[] mm = type.getDeclaredMethods(); // This fails if the calling context of the annotation.equals() doesn't have accessDelcaredMembers for the annotation class
  |   |             AccessController.doPrivileged(new PrivilegedAction() {
  |   |                 public Object run() {
  |   |                     AccessibleObject.setAccessible(mm, true);
  |   |                     return null;
  |   |                 }
  |   |             });
  |   |             memberMethods = mm;
  |   |         }
  |   |         return memberMethods;
  |   |     }
  |   |     private transient volatile Method[] memberMethods = null;
  |   | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140596#4140596

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140596



More information about the jboss-dev-forums mailing list