changeset 5911:ae0dfa5bb05b

8009004: Better implementation of RMI connections Summary: Better class handling. Reviewed-by: alanb, dfuchs, skoivu, jbachorik Contributed-by: jean-francois.denise@oracle.com
author jfdenise
date Mon, 18 Mar 2013 13:50:19 +0100
parents 48aff3ba41eb
children 3927a18bbcbf
files src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java	Mon Mar 18 11:17:06 2013 +0100
+++ b/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java	Mon Mar 18 13:50:19 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/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java	Mon Mar 18 11:17:06 2013 +0100
+++ b/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java	Mon Mar 18 13:50:19 2013 +0100
@@ -79,6 +79,7 @@
 import javax.management.remote.NotificationResult;
 import javax.management.remote.TargetedNotification;
 import javax.security.auth.Subject;
+import sun.reflect.misc.ReflectUtil;
 
 /**
  * <p>Implementation of the {@link RMIConnection} interface.  User
@@ -1813,6 +1814,7 @@
         @Override
         protected Class<?> loadClass(String name, boolean resolve)
         throws ClassNotFoundException {
+            ReflectUtil.checkPackageAccess(name);
             try {
                 super.loadClass(name, resolve);
             } catch(Exception e) {