openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yingw...@apache.org
Subject svn commit: r936468 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java
Date Wed, 21 Apr 2010 19:46:47 GMT
Author: yingwang
Date: Wed Apr 21 19:46:46 2010
New Revision: 936468

URL: http://svn.apache.org/viewvc?rev=936468&view=rev
Log:
[OWB-312] missing 2 files.

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
    openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java?rev=936468&r1=936467&r2=936468&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
Wed Apr 21 19:46:46 2010
@@ -86,7 +86,7 @@ public final class JavassistProxyFactory
         }
         else
         {
-            clazz = factory.createClass();
+            clazz = SecurityUtil.doPrivilegedCreateClass(factory);
             ejbProxyClasses.put(bean, clazz);
         }
         

Modified: openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java?rev=936468&r1=936467&r2=936468&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java
(original)
+++ openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java
Wed Apr 21 19:46:46 2010
@@ -34,8 +34,11 @@ import org.apache.naming.ContextAccessCo
 
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
+import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Field;
 import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Map;
@@ -360,8 +363,8 @@ public class ContextLifecycleListener im
     {
         try
         {
-            Field field = ContainerBase.class.getDeclaredField("children");
-            field.setAccessible(true);
+            Field field = (Field)AccessController.doPrivileged(new PrivilegedActionForClass(ContainerBase.class,
"children"));
+            AccessController.doPrivileged(new PrivilegedActionForAccessibleObject(field,
true));
             Map<Object,Object> children = (Map<Object,Object>) field.get(containerBase);
             if (children instanceof ContextLifecycleListener.MoniterableHashMap)
             {
@@ -409,4 +412,52 @@ public class ContextLifecycleListener im
             return value;
         }
     }
+    
+	protected static class PrivilegedActionForAccessibleObject implements PrivilegedAction<Object>

+	{
+		
+		AccessibleObject object;
+		
+		boolean flag;
+		
+		protected PrivilegedActionForAccessibleObject(AccessibleObject object, boolean flag) 
+		{
+			this.object = object;
+			this.flag = flag;
+		}
+		
+		public Object run() 
+		{
+			object.setAccessible(flag);
+			return null;
+		}
+	}
+	
+	protected static class PrivilegedActionForClass implements PrivilegedAction<Object>

+	{
+		Class<?> clazz;
+		
+		Object parameters;
+		
+		protected PrivilegedActionForClass(Class<?> clazz, Object parameters) 
+		{
+			this.clazz = clazz;
+			this.parameters = parameters;
+		}
+		
+		public Object run()
+		{
+			try 
+			{
+				return clazz.getDeclaredField((String)parameters);
+			} 
+			catch (Exception exception) 
+			{
+				return exception;
+			}
+		}			
+		
+	}
+
+    
 }



Mime
View raw message