changeset 6005:698d0997fef1

Merge
author asaha
date Mon, 04 Mar 2013 12:35:10 -0800
parents 62eee603f25a 4f7b8bc95616
children af6be9d7aed7
files
diffstat 2 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java	Mon Mar 04 11:46:59 2013 -0800
+++ b/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java	Mon Mar 04 12:35:10 2013 -0800
@@ -32,6 +32,7 @@
 import java.io.ObjectInputStream;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
 import java.security.Permission;
 import java.util.Map;
 import java.util.logging.Level;
@@ -223,7 +224,7 @@
         // Instantiate the new object
         try {
             ReflectUtil.checkPackageAccess(theClass);
-            ReflectUtil.ensureClassAccess(theClass);
+            ensureClassAccess(theClass);
             moi= cons.newInstance();
         } catch (InvocationTargetException e) {
             // Wrap the exception.
@@ -299,7 +300,7 @@
         }
         try {
             ReflectUtil.checkPackageAccess(theClass);
-            ReflectUtil.ensureClassAccess(theClass);
+            ensureClassAccess(theClass);
             moi = cons.newInstance(params);
         }
         catch (NoSuchMethodError error) {
@@ -741,4 +742,13 @@
             sm.checkPermission(perm);
         }
     }
+
+    private static void ensureClassAccess(Class clazz)
+            throws IllegalAccessException
+    {
+        int mod = clazz.getModifiers();
+        if (!Modifier.isPublic(mod)) {
+            throw new IllegalAccessException("Class is not public and can't be instantiated");
+        }
+    }
 }
--- a/src/share/classes/sun/reflect/misc/ReflectUtil.java	Mon Mar 04 11:46:59 2013 -0800
+++ b/src/share/classes/sun/reflect/misc/ReflectUtil.java	Mon Mar 04 12:35:10 2013 -0800
@@ -46,14 +46,6 @@
         return cls.newInstance();
     }
 
-    public static void ensureClassAccess(Class clazz)
-           throws IllegalAccessException
-    {
-        int mod = clazz.getModifiers();
-        if ( ! Modifier.isPublic(mod) ){
-            throw new IllegalAccessException("Class is not public and can't be instantiated");
-        }
-    }
     /*
      * Reflection.ensureMemberAccess is overly-restrictive
      * due to a bug. We awkwardly work around it for now.