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

(jsr-292) findConstructor throws ExceptionInInitializerError if run under SecurityManager

    Details

    • Subcomponent:
    • Resolved In Build:
      b145
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      Minimized test:
      ===============
      $ cat test.java
      import java.lang.invoke.*;

      public class test {
          public static void main(String[] args) throws Throwable {
              System.setSecurityManager(new SM());
              MethodHandles.lookup().findConstructor(
                      Ctor.class, MethodType.methodType(void.class));
          }
      }

      class SM extends SecurityManager {
          protected SM() { super(); }
      }

      class Ctor {
          Ctor() {}
      }


      Minimized test output:
      ======================
      $ javac test.java

      $ java -verify test
      Exception in thread "main" java.lang.ExceptionInInitializerError
              at java.lang.invoke.MethodHandles.identity(MethodHandles.java:1593)
              at java.lang.invoke.MethodHandleImpl.makeAllocator(MethodHandleImpl.java:107)
              at java.lang.invoke.MethodHandles$Lookup.findConstructor(MethodHandles.java:665)
              at test.main(test.java:9)
      Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "sun.invoke.util.ValueConversions.MAX_ARITY" "read")
              at java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)
              at java.security.AccessController.checkPermission(AccessController.java:555)
              at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
              at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1302)
              at java.lang.System.getProperty(System.java:706)
              at java.lang.Integer.getInteger(Integer.java:887)
              at java.lang.Integer.getInteger(Integer.java:844)
              at sun.invoke.util.ValueConversions.<clinit>(ValueConversions.java:41)
              ... 4 more

        Attachments

          Activity

            People

            • Assignee:
              jrose John Rose
              Reporter:
              ygaevsky Yuri Gaevsky
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: