Mercurial > hg > release > icedtea7-forest-2.4 > jdk
changeset 6304:4f7b8bc95616
8009165: Fix for 8008817 needs revision
Summary: The fix for JDK-8008817 added a new ReflectUtil.ensureClassAccess method which is not an appropriate utility method in ReflectUtil.
Reviewed-by: alanb, mchung, dfuchs
author | dsamersoff |
---|---|
date | Fri, 01 Mar 2013 21:35:49 +0400 |
parents | 9cc342866505 |
children | 245c2dce7225 698d0997fef1 |
files | src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java src/share/classes/sun/reflect/misc/ReflectUtil.java |
diffstat | 2 files changed, 12 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java Fri Mar 01 03:50:33 2013 +0400 +++ b/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java Fri Mar 01 21:35:49 2013 +0400 @@ -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 Fri Mar 01 03:50:33 2013 +0400 +++ b/src/share/classes/sun/reflect/misc/ReflectUtil.java Fri Mar 01 21:35:49 2013 +0400 @@ -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.