-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b40
-
generic
-
generic
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2213886 | 6u30 | Mala Bankal | P2 | Closed | Fixed | b08 |
JDK-2213860 | 6u29-rev | Mala Bankal | P2 | Resolved | Fixed | b20 |
JDK-2211146 | 6u27-rev | Mala Bankal | P2 | Resolved | Fixed | b22 |
JDK-2168672 | OpenJDK6 | Joe Darcy | P3 | Resolved | Fixed | b13 |
Description:
sun/reflect/annotation/AnnotationInvocationHandler.java.getMemberMethods
might throw if there is a security manager that does not allow
getDeclaredMethods.
The author of this code (Josh Bloch) confirms that the intent was for the
doPrivileged block in this method to prevent security exceptions.
The methods cannot escape to untrusted code.
Evaluation:
Yes. Fix provided courtesy of Toby Reyelts and Josh Bloch at Google.
# HG changeset patch
# User martin
# Date 1224185752 25200
# Node ID 68730f05449cd4f39ce1cb82adc6c4e57f87554f
# Parent 214ebdcf7252d4862449fe0ae295e6c60a127315
SecurityException in AnnotationInvocationHandler.getMemberMethods
Summary: Move call to getDeclaredMethods inside doPrivileged
Reviewed-by:
Contributed-by: ###@###.###
diff --git a/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
b/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
--- a/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
+++ b/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
@@ -272,14 +272,14 @@
*/
private Method[] getMemberMethods() {
if (memberMethods == null) {
- final Method[] mm = type.getDeclaredMethods();
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
- public Void run() {
- AccessibleObject.setAccessible(mm, true);
- return null;
- }
- });
- memberMethods = mm;
+ memberMethods = AccessController.doPrivileged(
+ new PrivilegedAction<Method[]>() {
+ public Method[] run() {
+ final Method[] mm = type.getDeclaredMethods();
+ AccessibleObject.setAccessible(mm, true);
+ return mm;
+ }
+ });
}
return memberMethods;
}
- backported by
-
JDK-2211146 (ann) SecurityException in AnnotationInvocationHandler.getMemberMethods
- Resolved
-
JDK-2213860 (ann) SecurityException in AnnotationInvocationHandler.getMemberMethods
- Resolved
-
JDK-2168672 (ann) SecurityException in AnnotationInvocationHandler.getMemberMethods
- Resolved
-
JDK-2213886 (ann) SecurityException in AnnotationInvocationHandler.getMemberMethods
- Closed
- relates to
-
JDK-6370080 (ann) Method.getAnnotations() sometimes throw SecurityException: doPrivileged or javadoc missing?
- Resolved
-
JDK-7080038 (ann) Serializable types in sun.reflect.annotation do not declare serialVersionUIDs
- Closed