提交 a7407701 编写于 作者: D dsamersoff

8000539: JMX implementation allows invocation of methods of a system class

Summary: Added extra packageAccess check call
Reviewed-by: ahgross, dfuchs
Contributed-by: jaroslav.bachorik@oracle.com
上级 db55fc97
...@@ -56,6 +56,8 @@ import java.lang.reflect.Array; ...@@ -56,6 +56,8 @@ import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import javax.management.AttributeNotFoundException; import javax.management.AttributeNotFoundException;
import javax.management.openmbean.CompositeData; import javax.management.openmbean.CompositeData;
import sun.reflect.misc.MethodUtil;
import sun.reflect.misc.ReflectUtil;
/** /**
* This class contains the methods for performing all the tests needed to verify * This class contains the methods for performing all the tests needed to verify
...@@ -528,8 +530,10 @@ public class Introspector { ...@@ -528,8 +530,10 @@ public class Introspector {
// to locate method // to locate method
readMethod = SimpleIntrospector.getReadMethod(clazz, element); readMethod = SimpleIntrospector.getReadMethod(clazz, element);
} }
if (readMethod != null) if (readMethod != null) {
return readMethod.invoke(complex); ReflectUtil.checkPackageAccess(readMethod.getDeclaringClass());
return MethodUtil.invoke(readMethod, complex, new Class[0]);
}
throw new AttributeNotFoundException( throw new AttributeNotFoundException(
"Could not find the getter method for the property " + "Could not find the getter method for the property " +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册