提交 bf522c97 编写于 作者: J jfdenise

8009004: Better implementation of RMI connections

Summary: Better class handling.
Reviewed-by: alanb, dfuchs, skoivu, jbachorik
Contributed-by: jean-francois.denise@oracle.com
上级 ba5d4577
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
package com.sun.jmx.remote.util; package com.sun.jmx.remote.util;
import sun.reflect.misc.ReflectUtil;
public class OrderClassLoaders extends ClassLoader { public class OrderClassLoaders extends ClassLoader {
public OrderClassLoaders(ClassLoader cl1, ClassLoader cl2) { public OrderClassLoaders(ClassLoader cl1, ClassLoader cl2) {
super(cl1); super(cl1);
...@@ -32,9 +34,10 @@ public class OrderClassLoaders extends ClassLoader { ...@@ -32,9 +34,10 @@ public class OrderClassLoaders extends ClassLoader {
this.cl2 = cl2; this.cl2 = cl2;
} }
protected Class<?> findClass(String name) throws ClassNotFoundException { protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
ReflectUtil.checkPackageAccess(name);
try { try {
return super.findClass(name); return super.loadClass(name, resolve);
} catch (ClassNotFoundException cne) { } catch (ClassNotFoundException cne) {
if (cl2 != null) { if (cl2 != null) {
return cl2.loadClass(name); return cl2.loadClass(name);
......
...@@ -48,6 +48,7 @@ import javax.management.remote.JMXServerErrorException; ...@@ -48,6 +48,7 @@ import javax.management.remote.JMXServerErrorException;
import javax.management.remote.NotificationResult; import javax.management.remote.NotificationResult;
import javax.management.remote.TargetedNotification; import javax.management.remote.TargetedNotification;
import javax.security.auth.Subject; import javax.security.auth.Subject;
import sun.reflect.misc.ReflectUtil;
import static com.sun.jmx.mbeanserver.Util.cast; import static com.sun.jmx.mbeanserver.Util.cast;
import com.sun.jmx.remote.internal.ServerCommunicatorAdmin; import com.sun.jmx.remote.internal.ServerCommunicatorAdmin;
...@@ -1792,6 +1793,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -1792,6 +1793,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
@Override @Override
protected Class<?> loadClass(String name, boolean resolve) protected Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException { throws ClassNotFoundException {
ReflectUtil.checkPackageAccess(name);
try { try {
super.loadClass(name, resolve); super.loadClass(name, resolve);
} catch(Exception e) { } catch(Exception e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册