Mercurial > hg > release > icedtea7-forest-2.1 > jdk
changeset 4955:80fba79ca568
8009165: Fix for 8006435 needs revision
Summary: The fix for JDK-8006435 added a new ReflectUtil.ensureClassAccess method which is not an appropriate utility method in ReflectUtil.
Reviewed-by: alanb, mchung, dfuchs
author | andrew |
---|---|
date | Wed, 26 Jun 2013 22:20:19 -0500 |
parents | b904ff043716 |
children | 686d810cb9b6 |
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 Wed Jun 26 22:15:08 2013 -0500 +++ b/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java Wed Jun 26 22:20:19 2013 -0500 @@ -31,6 +31,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.lang.reflect.Constructor; +import java.lang.reflect.Modifier; import java.lang.reflect.InvocationTargetException; import java.security.AccessControlContext; import java.security.AccessController; @@ -227,7 +228,7 @@ // Instantiate the new object try { ReflectUtil.checkPackageAccess(theClass); - ReflectUtil.ensureClassAccess(theClass); + ensureClassAccess(theClass); moi= cons.newInstance(); } catch (InvocationTargetException e) { // Wrap the exception. @@ -303,7 +304,7 @@ } try { ReflectUtil.checkPackageAccess(theClass); - ReflectUtil.ensureClassAccess(theClass); + ensureClassAccess(theClass); moi = cons.newInstance(params); } catch (NoSuchMethodError error) { @@ -773,4 +774,13 @@ }, ctx); return loader; } + + 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 Wed Jun 26 22:15:08 2013 -0500 +++ b/src/share/classes/sun/reflect/misc/ReflectUtil.java Wed Jun 26 22:20:19 2013 -0500 @@ -47,14 +47,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.