-
Bug
-
Resolution: Fixed
-
P2
-
5.0, 6
-
b91
-
generic, x86
-
generic, windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2141009 | 5.0u12 | Joe Darcy | P3 | Resolved | Fixed | b01 |
The method Method.getAnnotations() sometimes throws a SecurityException.
The security exception is not documented in the Javadoc for this method.
So a) either throws SecurityException is missing from the javadoc,
b) or a doPriviledge is missing somewhere in the implementation of getAnnotations()
(e.g. sun.reflect.annotation.AnnotationParser or
sun.reflect.annotation.AnnotationType?)
See the stack trace:
java version "1.6.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b66)
Java HotSpot(TM) Server VM (build 1.6.0-rc-b66, mixed mode)
java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:321)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
at java.lang.Class.checkMemberAccess(Class.java:2156)
at java.lang.Class.getDeclaredMethods(Class.java:1789)
at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:81)
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:64)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:202)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.reflect.Method.declaredAnnotations(Method.java:687)
at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:680)
at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:189)
The security exception is not documented in the Javadoc for this method.
So a) either throws SecurityException is missing from the javadoc,
b) or a doPriviledge is missing somewhere in the implementation of getAnnotations()
(e.g. sun.reflect.annotation.AnnotationParser or
sun.reflect.annotation.AnnotationType?)
See the stack trace:
java version "1.6.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b66)
Java HotSpot(TM) Server VM (build 1.6.0-rc-b66, mixed mode)
java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:321)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
at java.lang.Class.checkMemberAccess(Class.java:2156)
at java.lang.Class.getDeclaredMethods(Class.java:1789)
at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:81)
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:64)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:202)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.reflect.Method.declaredAnnotations(Method.java:687)
at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:680)
at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:189)
- backported by
-
JDK-2141009 (ann) Method.getAnnotations() sometimes throw SecurityException: doPrivileged or javadoc missing?
- Resolved
- duplicates
-
JDK-6366543 A valid MBean is rejected as NotCompliant when some security is in use
- Closed
-
JDK-6353215 java.lang.Class.isAnnotationPresent requires accessDeclaredMembers unnecessarily
- Closed
- relates to
-
JDK-6761678 (ann) SecurityException in AnnotationInvocationHandler.getMemberMethods
- Closed