harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r597454 - /harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
Date Thu, 22 Nov 2007 17:08:28 GMT
Author: tellison
Date: Thu Nov 22 09:08:27 2007
New Revision: 597454

URL: http://svn.apache.org/viewvc?rev=597454&view=rev
Log:
EventHandler invocation should be in same security context as constructor.

Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java?rev=597454&r1=597453&r2=597454&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
Thu Nov 22 09:08:27 2007
@@ -21,6 +21,9 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Proxy;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.StringTokenizer;
 
 import org.apache.harmony.beans.internal.nls.Messages;
@@ -35,6 +38,8 @@
 
     private String listenerMethodName;
 
+    final private AccessControlContext context; 
+
     public EventHandler(Object target, String action, String eventPropertyName,
             String listenerMethodName) {
         if (target == null || action == null) {
@@ -44,9 +49,18 @@
         this.action = action;
         this.eventPropertyName = eventPropertyName;
         this.listenerMethodName = listenerMethodName;
+        this.context = AccessController.getContext();
+    }
+
+    public Object invoke(final Object proxy, final Method method, final Object[] arguments)
{
+        return AccessController.doPrivileged(new PrivilegedAction<Object>() {
+            public Object run() {
+                return invokeImpl(proxy, method, arguments);
+            }
+        }, context);
     }
 
-    public Object invoke(Object proxy, Method method, Object[] arguments) {
+    private Object invokeImpl(Object proxy, Method method, Object[] arguments) {
         Class<?> proxyClass;
         Object result = null;
 



Mime
View raw message