changeset 6864:dc04e86b0dac

8025448: Enhance listening events Reviewed-by: art, skoivu
author malenkov
date Fri, 04 Oct 2013 19:39:59 +0400
parents 7f2fc6c7c6dd
children 15c242aefefd
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	Thu Sep 19 10:40:16 2013 +0800
+++ b/src/share/classes/javax/swing/event/EventListenerList.java	Fri Oct 04 19:39:59 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
@@ -270,7 +271,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);
         }
     }