changeset 9041:282c5e92d9a0

8025448: Enhance listening events Reviewed-by: art, skoivu
author malenkov
date Fri, 04 Oct 2013 19:23:02 +0400
parents 1e3216123667
children 146dd44703f7
files src/share/classes/javax/swing/event/EventListenerList.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/event/EventListenerList.java	Fri Oct 04 14:51:17 2013 +0100
+++ b/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);
         }
     }