8025448: Enhance listening events
authormalenkov
Fri, 04 Oct 2013 19:23:02 +0400
changeset 22319 8fbc2b703ae5
parent 22318 5df7062f4a68
child 22320 d66c8815bebc
8025448: Enhance listening events Reviewed-by: art, skoivu
jdk/src/share/classes/javax/swing/event/EventListenerList.java
--- a/jdk/src/share/classes/javax/swing/event/EventListenerList.java	Fri Oct 04 14:51:17 2013 +0100
+++ b/jdk/src/share/classes/javax/swing/event/EventListenerList.java	Fri Oct 04 19:23:02 2013 +0400
@@ -27,6 +27,7 @@
 import java.io.*;
 import java.util.*;
 import java.lang.reflect.Array;
+import sun.reflect.misc.ReflectUtil;
 
 /**
  * A class that holds a list of EventListeners.  A single instance
@@ -271,7 +272,9 @@
         while (null != (listenerTypeOrNull = s.readObject())) {
             ClassLoader cl = Thread.currentThread().getContextClassLoader();
             EventListener l = (EventListener)s.readObject();
-            add((Class<EventListener>)Class.forName((String)listenerTypeOrNull, true, cl), l);
+            String name = (String) listenerTypeOrNull;
+            ReflectUtil.checkPackageAccess(name);
+            add((Class<EventListener>)Class.forName(name, true, cl), l);
         }
     }