[jboss-user] [JBoss Microcontainer Development] New message: "Re: JBREFLECT - Exception processing non-public annotation"
Ales Justin
do-not-reply at jboss.com
Mon Feb 1 09:13:05 EST 2010
User development,
A new message was posted in the thread "JBREFLECT - Exception processing non-public annotation":
http://community.jboss.org/message/523364#523364
Author : Ales Justin
Profile : http://community.jboss.org/people/alesj
Message:
--------------------------------------------------------------
I added this patch.
Index: src/main/java/org/jboss/reflect/plugins/introspection/ReflectMethodInfoImpl.java
===================================================================
--- src/main/java/org/jboss/reflect/plugins/introspection/ReflectMethodInfoImpl.java (revision 94787)
+++ src/main/java/org/jboss/reflect/plugins/introspection/ReflectMethodInfoImpl.java Mon Feb 01 15:03:48 CET 2010
@@ -101,12 +101,17 @@
*/
public void setMethod(Method method)
{
+ boolean isDeclaringClassPublic = true;
if (method != null)
+ {
accessCheck(Modifier.isPublic(method.getModifiers()));
+ isDeclaringClassPublic = isDeclaringClassPublic(method);
+ accessCheck(isDeclaringClassPublic);
+ }
this.method = method;
- if (isPublic() == false && method != null)
+ if (method != null && (isPublic() == false || isDeclaringClassPublic == false))
setAccessible();
}
@@ -120,13 +125,25 @@
accessCheck();
return method;
}
-
+
/**
+ * Is declaring class public.
+ *
+ * @param method the method
+ * @return if declaring class is public return true, else false
+ */
+ protected static boolean isDeclaringClassPublic(Method method)
+ {
+ Class<?> owner = method.getDeclaringClass();
+ return Modifier.isPublic(owner.getModifiers());
+ }
+
+ /**
* Check access permission.
*/
protected final void accessCheck() // final because we don't want subclasses to disable it
{
- accessCheck(isPublic());
+ accessCheck(isPublic() && (method == null || isDeclaringClassPublic(method)));
}
/**
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/523364#523364
More information about the jboss-user
mailing list