8009004: Better implementation of RMI connections
authorjfdenise
Tue, 26 Mar 2013 09:12:18 +0100
changeset 18205 17a6d802d24a
parent 18204 ccbc76c1d229
child 18206 136373d8d805
8009004: Better implementation of RMI connections Summary: Better class handling. Reviewed-by: alanb, dfuchs, skoivu, jbachorik Contributed-by: jean-francois.denise@oracle.com
jdk/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java
jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
--- a/jdk/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java	Thu Mar 21 12:14:59 2013 +0000
+++ b/jdk/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java	Tue Mar 26 09:12:18 2013 +0100
@@ -25,6 +25,8 @@
 
 package com.sun.jmx.remote.util;
 
+import sun.reflect.misc.ReflectUtil;
+
 public class OrderClassLoaders extends ClassLoader {
     public OrderClassLoaders(ClassLoader cl1, ClassLoader cl2) {
         super(cl1);
@@ -32,9 +34,10 @@
         this.cl2 = cl2;
     }
 
-    protected Class<?> findClass(String name) throws ClassNotFoundException {
+    protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+        ReflectUtil.checkPackageAccess(name);
         try {
-            return super.findClass(name);
+            return super.loadClass(name, resolve);
         } catch (ClassNotFoundException cne) {
             if (cl2 != null) {
                 return cl2.loadClass(name);
--- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java	Thu Mar 21 12:14:59 2013 +0000
+++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java	Tue Mar 26 09:12:18 2013 +0100
@@ -48,6 +48,7 @@
 import javax.management.remote.NotificationResult;
 import javax.management.remote.TargetedNotification;
 import javax.security.auth.Subject;
+import sun.reflect.misc.ReflectUtil;
 
 import static com.sun.jmx.mbeanserver.Util.cast;
 import com.sun.jmx.remote.internal.ServerCommunicatorAdmin;
@@ -1792,6 +1793,7 @@
         @Override
         protected Class<?> loadClass(String name, boolean resolve)
         throws ClassNotFoundException {
+            ReflectUtil.checkPackageAccess(name);
             try {
                 super.loadClass(name, resolve);
             } catch(Exception e) {