8030051: Check class loaders usage in Swing classes
authoralexsch
Tue, 22 Jul 2014 13:23:01 +0400
changeset 25793 56060390dd25
parent 25792 80fae5c73cb9
child 25794 f8fcbb8737be
child 26000 7d2b9a7ae7ce
8030051: Check class loaders usage in Swing classes Reviewed-by: serb, pchelko
jdk/src/share/classes/javax/swing/JEditorPane.java
--- a/jdk/src/share/classes/javax/swing/JEditorPane.java	Tue Jul 22 13:14:59 2014 +0400
+++ b/jdk/src/share/classes/javax/swing/JEditorPane.java	Tue Jul 22 13:23:01 2014 +0400
@@ -39,6 +39,7 @@
 import javax.swing.event.*;
 import javax.swing.text.html.*;
 import javax.accessibility.*;
+import sun.reflect.misc.ReflectUtil;
 
 /**
  * A text component to edit various kinds of content.
@@ -1193,12 +1194,12 @@
             try {
                 Class<?> c;
                 if (loader != null) {
+                    ReflectUtil.checkPackageAccess(classname);
                     c = loader.loadClass(classname);
                 } else {
                     // Will only happen if developer has invoked
                     // registerEditorKitForContentType(type, class, null).
-                    c = Class.forName(classname, true, Thread.currentThread().
-                                      getContextClassLoader());
+                    c = SwingUtilities.loadSystemClass(classname);
                 }
                 k = (EditorKit) c.newInstance();
                 kitRegistry.put(type, k);