# HG changeset patch # User smarks # Date 1363655131 25200 # Node ID 2899c3dbf5e8791b559c39a75a820c17c729c20f # Parent b453d9be6b3f5496aa217ade7478d3b7fa32b13b 8009857: Problem with plugin Reviewed-by: jdn, mchung diff --git openjdk/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java openjdk/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java --- jdk/src/share/classes/sun/reflect/misc/MethodUtil.java +++ jdk/src/share/classes/sun/reflect/misc/MethodUtil.java @@ -50,8 +50,27 @@ import sun.security.util.SecurityConstan class Trampoline { + static { + if (Trampoline.class.getClassLoader() == null) { + throw new Error( + "Trampoline must not be defined by the bootstrap classloader"); + } + } + + private static void ensureInvocableMethod(Method m) + throws InvocationTargetException + { + Class clazz = m.getDeclaringClass(); + if (clazz.equals(AccessController.class) || + clazz.equals(Method.class)) + throw new InvocationTargetException( + new UnsupportedOperationException("invocation not supported")); + } + private static Object invoke(Method m, Object obj, Object[] params) - throws InvocationTargetException, IllegalAccessException { + throws InvocationTargetException, IllegalAccessException + { + ensureInvocableMethod(m); return m.invoke(obj, params); } } @@ -255,10 +275,6 @@ public final class MethodUtil extends Se */ public static Object invoke(Method m, Object obj, Object[] params) throws InvocationTargetException, IllegalAccessException { - if (m.getDeclaringClass().equals(AccessController.class) || - m.getDeclaringClass().equals(Method.class)) - throw new InvocationTargetException( - new UnsupportedOperationException("invocation not supported")); try { return bounce.invoke(null, new Object[] {m, obj, params}); } catch (InvocationTargetException ie) { @@ -292,10 +307,10 @@ public final class MethodUtil extends Se types = new Class[] {Method.class, Object.class, Object[].class}; b = t.getDeclaredMethod("invoke", types); - ((AccessibleObject)b).setAccessible(true); - return b; - } - }); + b.setAccessible(true); + return b; + } + }); } catch (Exception e) { throw new InternalError("bouncer cannot be found"); }