Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6370080

(ann) Method.getAnnotations() sometimes throw SecurityException: doPrivileged or javadoc missing?

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 6
    • 5.0, 6
    • core-libs
    • b91
    • generic, x86
    • generic, windows_xp

        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)

              darcy Joe Darcy
              dfuchs Daniel Fuchs
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: