openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yingw...@apache.org
Subject svn commit: r936439 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: intercept/ intercept/ejb/ intercept/webbeans/ portable/ proxy/ xml/
Date Wed, 21 Apr 2010 18:52:17 GMT
Author: yingwang
Date: Wed Apr 21 18:52:16 2010
New Revision: 936439

URL: http://svn.apache.org/viewvc?rev=936439&view=rev
Log:
[OWB-312] Part 2 in core.

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=936439&r1=936438&r2=936439&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
Wed Apr 21 18:52:16 2010
@@ -45,6 +45,7 @@ import org.apache.webbeans.exception.Web
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.SecurityUtil;
 
 public final class InterceptorUtil
 {
@@ -157,7 +158,7 @@ public final class InterceptorUtil
     public static boolean isBusinessMethodInterceptor(Class<?> clazz)
     {
         Asserts.nullCheckForClass(clazz);
-        Method[] methods = clazz.getDeclaredMethods();
+        Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
         for (Method method : methods)
         {
             if (AnnotationUtil.hasMethodAnnotation(method, AroundInvoke.class))
@@ -189,7 +190,7 @@ public final class InterceptorUtil
     public static boolean isLifecycleMethodInterceptor(Class<?> clazz)
     {
         Asserts.nullCheckForClass(clazz);
-        Method[] methods = clazz.getDeclaredMethods();
+        Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
         for (Method method : methods)
         {
             if (AnnotationUtil.hasMethodAnnotation(method, PostConstruct.class) || AnnotationUtil.hasMethodAnnotation(method,
PreDestroy.class)
@@ -288,7 +289,7 @@ public final class InterceptorUtil
     {
         Asserts.nullCheckForClass(clazz);
         
-        Method[] methods = clazz.getDeclaredMethods();
+        Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
         for(Method method : methods)
         {
             if(AnnotationUtil.hasMethodAnnotation(method, Produces.class))
@@ -377,7 +378,7 @@ public final class InterceptorUtil
             throw new WebBeansConfigurationException("Final Simple class with name : " +
clazz.getName() + " can not define any InterceptorBindings");
         }
 
-        Method[] methods = clazz.getDeclaredMethods();
+        Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
 
         for (Method method : methods)
         {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java?rev=936439&r1=936438&r2=936439&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
Wed Apr 21 18:52:16 2010
@@ -29,6 +29,7 @@ import org.apache.webbeans.component.Owb
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
 import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.SecurityUtil;
 
 /**
  * Implementation of the {@link InvocationContext} interface.
@@ -197,7 +198,7 @@ public class InvocationContextImpl imple
             
             if (!method.isAccessible())
             {
-                method.setAccessible(true);
+                SecurityUtil.doPrivilegedSetAccessible(method, true);
             }
             
             Object t = intc.createNewInstance(this.target,(CreationalContextImpl<?>)this.creationalContext);
@@ -213,7 +214,7 @@ public class InvocationContextImpl imple
             
             if(!accessible)
             {
-                method.setAccessible(false);
+                SecurityUtil.doPrivilegedSetAccessible(method, false);
             }
 
         }
@@ -224,14 +225,14 @@ public class InvocationContextImpl imple
                 boolean accessible = this.method.isAccessible();
                 if(!accessible)
                 {                
-                    this.method.setAccessible(true);
+                    SecurityUtil.doPrivilegedSetAccessible(method, true);
                 }
                 
                 result = this.method.invoke(target, parameters);
                 
                 if(!accessible)
                 {
-                    this.method.setAccessible(false);   
+                    SecurityUtil.doPrivilegedSetAccessible(method, false);
                 }                
             }
         }
@@ -267,7 +268,7 @@ public class InvocationContextImpl imple
 
             if (!method.isAccessible())
             {
-                method.setAccessible(true);
+                SecurityUtil.doPrivilegedSetAccessible(method, true);                
             }
 
             currentMethod++;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java?rev=936439&r1=936438&r2=936439&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
Wed Apr 21 18:52:16 2010
@@ -39,6 +39,7 @@ import org.apache.webbeans.exception.Web
 import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.SecurityUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 
 /**
@@ -272,7 +273,7 @@ public final class WebBeansInterceptorCo
         
         //GE : I added for private, protected etc. methods.
         //Not just for public methods.
-        methods = clazz.getDeclaredMethods();
+        methods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
         for(Method m : methods)
         {
             set.add(m);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java?rev=936439&r1=936438&r2=936439&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
Wed Apr 21 18:52:16 2010
@@ -28,6 +28,7 @@ import org.apache.webbeans.intercept.Int
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.SecurityUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 
 /**
@@ -221,7 +222,7 @@ public final class EJBInterceptorConfig
         // 3- Look bean around invoke
 
         // 1-
-        Method[] methods = clazz.getDeclaredMethods();
+        Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
 
         for (Method method : methods)
         {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=936439&r1=936438&r2=936439&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
Wed Apr 21 18:52:16 2010
@@ -51,6 +51,7 @@ import org.apache.webbeans.intercept.Web
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.proxy.JavassistProxyFactory;
 import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.SecurityUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 import org.apache.webbeans.xml.XMLAnnotationTypeManager;
 
@@ -107,7 +108,7 @@ public class WebBeansInterceptor<T> exte
      */
     public void addInterceptorBinding(Class<? extends Annotation> binding, Annotation
annot)
     {
-        Method[] methods = binding.getDeclaredMethods();
+        Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(binding);
 
         for (Method method : methods)
         {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java?rev=936439&r1=936438&r2=936439&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
Wed Apr 21 18:52:16 2010
@@ -23,6 +23,8 @@ import javax.enterprise.inject.spi.Annot
 import javax.enterprise.inject.spi.AnnotatedMethod;
 import javax.enterprise.inject.spi.AnnotatedType;
 
+import org.apache.webbeans.util.SecurityUtil;
+
 /**
  * Factory for {@link Annotated} elements.
  * 
@@ -47,10 +49,9 @@ public final class AnnotatedElementFacto
     {
         AnnotatedTypeImpl<X> annotatedType = new AnnotatedTypeImpl<X>(annotatedClass);
         
-        Field[] fields = annotatedClass.getDeclaredFields();
-        Method[] methods = annotatedClass.getDeclaredMethods();
-        Constructor<X>[] ctxs = (Constructor<X>[])annotatedClass.getDeclaredConstructors();
-        
+        Field[] fields = SecurityUtil.doPrivilegedGetDeclaredFields(annotatedClass);
+        Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(annotatedClass);
+        Constructor<X>[] ctxs = (Constructor<X>[])SecurityUtil.doPrivilegedGetDeclaredConstructors(annotatedClass);
         for(Field f : fields)
         {
             AnnotatedField<X> af = new AnnotatedFieldImpl<X>(f, annotatedType);

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=936439&r1=936438&r2=936439&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 18:52:16 2010
@@ -42,6 +42,7 @@ import org.apache.webbeans.intercept.Int
 import org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler;
 import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
 import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.SecurityUtil;
 
 public final class JavassistProxyFactory
 {
@@ -199,7 +200,7 @@ public final class JavassistProxyFactory
     	Class<?> proxyClass = null;
         try
         {
-        	proxyClass = factory.createClass();
+        	proxyClass = SecurityUtil.doPrivilegedCreateClass(factory);
         	
         }catch(Exception e)
         {
@@ -213,7 +214,7 @@ public final class JavassistProxyFactory
             	
             };
             
-            proxyClass = factory.createClass();        	
+            proxyClass = SecurityUtil.doPrivilegedCreateClass(factory);       	
         }                
             	
         return proxyClass;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java?rev=936439&r1=936438&r2=936439&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
Wed Apr 21 18:52:16 2010
@@ -60,6 +60,7 @@ import org.apache.webbeans.proxy.Javassi
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.SecurityUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -195,7 +196,7 @@ public final class XMLDefinitionUtil
             Class<? extends Annotation> temp = it.next();
             if (AnnotationUtil.isQualifierAnnotation(temp))
             {
-                Method[] methods = temp.getDeclaredMethods();
+                Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(temp);
 
                 for (Method method : methods)
                 {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java?rev=936439&r1=936438&r2=936439&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java Wed
Apr 21 18:52:16 2010
@@ -39,6 +39,7 @@ import org.apache.webbeans.proxy.Javassi
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.SecurityUtil;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -735,7 +736,7 @@ public class XMLUtil {
                 try
                 {
                     /* Contains value member method */
-                    annotClazz.getDeclaredMethod("value", new Class[] {});
+                    SecurityUtil.doPrivilegedGetDeclaredMethod(annotClazz, "value", new Class[]
{});
 
                 }
                 catch (SecurityException e)
@@ -755,8 +756,7 @@ public class XMLUtil {
         {
             try
             {
-                annotClazz.getDeclaredMethod(attrName, new Class[] {});
-
+                SecurityUtil.doPrivilegedGetDeclaredMethod(annotClazz, attrName, new Class[]
{});
             }
             catch (SecurityException e)
             {
@@ -770,7 +770,7 @@ public class XMLUtil {
         }
 
         /* Non-default members must defined in the xml */
-        Method[] members = annotClazz.getDeclaredMethods();
+        Method[] members = ClassUtil.getDeclaredMethods(annotClazz);
         for (Method member : members)
         {
             if (member.getDefaultValue() == null && value == null)
@@ -814,7 +814,7 @@ public class XMLUtil {
             Class returnType = null;
             try
             {
-                returnType = annotClazz.getDeclaredMethod(attrName, new Class[] {}).getReturnType();
+                returnType = SecurityUtil.doPrivilegedGetDeclaredMethod(annotClazz, attrName,
new Class[] {}).getReturnType();
                 Object value = null;
                 if (returnType.isPrimitive())
                 {



Mime
View raw message