You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2011/03/15 12:56:10 UTC

svn commit: r1081742 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/ webbeans-impl/s...

Author: struberg
Date: Tue Mar 15 11:56:09 2011
New Revision: 1081742

URL: http://svn.apache.org/viewvc?rev=1081742&view=rev
Log:
OWB-545 move all doPrivilegedGetDeclaredConstructor to SecurityService


Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/ManagedSecurityService.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/SimpleSecurityService.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/SecurityService.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java?rev=1081742&r1=1081741&r2=1081742&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java Tue Mar 15 11:56:09 2011
@@ -78,10 +78,10 @@ public class ManagedBeanCreatorImpl<T> e
     @Override
     public void defineConstructor()
     {
-        Constructor<T> constructor = null;
+        Constructor<T> constructor;
         if(isDefaultMetaDataProvider())
         {
-            constructor = WebBeansUtil.defineConstructor(getBean().getReturnType());
+            constructor = webBeansContext.getWebBeansUtil().defineConstructor(getBean().getReturnType());
             DefinitionUtil.addConstructorInjectionPointMetaData(getBean(), constructor);
         }
         else

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java?rev=1081742&r1=1081741&r2=1081742&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java Tue Mar 15 11:56:09 2011
@@ -150,7 +150,7 @@ public final class ManagedBeanConfigurat
         DefinitionUtil.defineQualifiers(component, clazzAnns);
         DefinitionUtil.defineName(component, clazzAnns, WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
 
-        Constructor<T> constructor = WebBeansUtil.defineConstructor(clazz);
+        Constructor<T> constructor = webBeansContext.getWebBeansUtil().defineConstructor(clazz);
         component.setConstructor(constructor);
         DefinitionUtil.addConstructorInjectionPointMetaData(component, constructor);
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/ManagedSecurityService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/ManagedSecurityService.java?rev=1081742&r1=1081741&r2=1081742&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/ManagedSecurityService.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/ManagedSecurityService.java Tue Mar 15 11:56:09 2011
@@ -62,13 +62,13 @@ public class ManagedSecurityService impl
     }
 
     @Override
-    public <T> Constructor<T> doPrivilegedGetDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes) throws NoSuchMethodException
+    public <T> Constructor<T> doPrivilegedGetDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes)
     {
         Object obj = AccessController.doPrivileged(
                 new PrivilegedActionForClass(clazz, parameterTypes, METHOD_CLASS_GETDECLAREDCONSTRUCTOR));
         if (obj instanceof NoSuchMethodException)
         {
-            throw (NoSuchMethodException)obj;
+            return null;
         }
         return (Constructor<T>)obj;
     }
@@ -83,13 +83,12 @@ public class ManagedSecurityService impl
 
     @Override
     public <T> Method doPrivilegedGetDeclaredMethod(Class<T> clazz, String name, Class<?>... parameterTypes)
-    throws NoSuchMethodException
     {
         Object obj = AccessController.doPrivileged(
                 new PrivilegedActionForClass(clazz, new Object[] {name, parameterTypes}, METHOD_CLASS_GETDECLAREDMETHOD));
         if (obj instanceof NoSuchMethodException)
         {
-            throw (NoSuchMethodException)obj;
+            return null;
         }
         return (Method)obj;
     }
@@ -103,13 +102,13 @@ public class ManagedSecurityService impl
     }
 
     @Override
-    public <T> Field doPrivilegedGetDeclaredField(Class<T> clazz, String name) throws NoSuchFieldException
+    public <T> Field doPrivilegedGetDeclaredField(Class<T> clazz, String name)
     {
         Object obj = AccessController.doPrivileged(
                 new PrivilegedActionForClass(clazz, name, METHOD_CLASS_GETDECLAREDFIELD));
         if (obj instanceof NoSuchFieldException)
         {
-            throw (NoSuchFieldException)obj;
+            return null;
         }
         return (Field)obj;
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/SimpleSecurityService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/SimpleSecurityService.java?rev=1081742&r1=1081741&r2=1081742&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/SimpleSecurityService.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/SimpleSecurityService.java Tue Mar 15 11:56:09 2011
@@ -46,9 +46,16 @@ public class SimpleSecurityService imple
     }
 
     @Override
-    public <T> Constructor<T> doPrivilegedGetDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes) throws NoSuchMethodException
+    public <T> Constructor<T> doPrivilegedGetDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes)
     {
-        return clazz.getDeclaredConstructor(parameterTypes);
+        try
+        {
+            return clazz.getDeclaredConstructor(parameterTypes);
+        }
+        catch (NoSuchMethodException e)
+        {
+            return null;
+        }
     }
 
     @Override
@@ -58,9 +65,16 @@ public class SimpleSecurityService imple
     }
 
     @Override
-    public <T> Method doPrivilegedGetDeclaredMethod(Class<T> clazz, String name, Class<?>... parameterTypes) throws NoSuchMethodException
+    public <T> Method doPrivilegedGetDeclaredMethod(Class<T> clazz, String name, Class<?>... parameterTypes)
     {
-        return clazz.getDeclaredMethod(name, parameterTypes);
+        try
+        {
+            return clazz.getDeclaredMethod(name, parameterTypes);
+        }
+        catch (NoSuchMethodException e)
+        {
+            return null;
+        }
     }
 
     @Override
@@ -70,9 +84,16 @@ public class SimpleSecurityService imple
     }
 
     @Override
-    public <T> Field doPrivilegedGetDeclaredField(Class<T> clazz, String name) throws NoSuchFieldException
+    public <T> Field doPrivilegedGetDeclaredField(Class<T> clazz, String name)
     {
-        return clazz.getDeclaredField(name);
+        try
+        {
+            return clazz.getDeclaredField(name);
+        }
+        catch (NoSuchFieldException e)
+        {
+            return null;
+        }
     }
 
     @Override

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java?rev=1081742&r1=1081741&r2=1081742&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java Tue Mar 15 11:56:09 2011
@@ -240,16 +240,7 @@ class InjectionPointImpl implements Inje
             String methodName = in.readUTF();
             Class<?>[] parameters = (Class<?>[])in.readObject();
             
-            Method method;
-            try
-            {
-                method = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethod(beanClass, methodName, parameters);
-            }
-            catch (NoSuchMethodException e)
-            {
-                // just ignore
-                method = null;
-            }
+            Method method = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethod(beanClass, methodName, parameters);
             this.injectionMember = method;
             
             AnnotatedType<?> annotatedType = annotatedElementFactory.newAnnotatedType(beanClass);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java?rev=1081742&r1=1081741&r2=1081742&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java Tue Mar 15 11:56:09 2011
@@ -37,7 +37,6 @@ import org.apache.webbeans.inject.OWBInj
 import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.plugins.OpenWebBeansEjbLCAPlugin;
-import org.apache.webbeans.util.WebBeansUtil;
 
 /**
  * Abstract implementation of the {@link InterceptorData} api contract.
@@ -446,7 +445,7 @@ public class InterceptorDataImpl impleme
             ctx = ownerCreationalContext.getEjbInterceptor(ownerInstance, this.interceptorClass);
             if (ctx == null)
             {
-                interceptor = WebBeansUtil.newInstanceForced(this.interceptorClass);
+                interceptor = webBeansContext.getWebBeansUtil().newInstanceForced(this.interceptorClass);
                 try
                 {
                     OWBInjector injector = new OWBInjector(webBeansContext);

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=1081742&r1=1081741&r2=1081742&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 Tue Mar 15 11:56:09 2011
@@ -718,16 +718,8 @@ public final class InterceptorUtil
 
                 // get the interceptor method of the parent
                 Method superInterceptorMethod = superInterceptorData.getInterceptorMethod();
-                Method childInterceptorMethod = null;
-                try
-                {
-                    childInterceptorMethod = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethod(interceptorClass,
-                            superInterceptorMethod.getName(), superInterceptorMethod.getParameterTypes());
-                }
-                catch (NoSuchMethodException e)
-                {
-                    childInterceptorMethod = null;
-                }
+                Method childInterceptorMethod = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethod(interceptorClass,
+                                              superInterceptorMethod.getName(), superInterceptorMethod.getParameterTypes());
 
                 if (null != childInterceptorMethod && ClassUtil.isOverriden(childInterceptorMethod, superInterceptorMethod))
                 {
@@ -766,12 +758,9 @@ public final class InterceptorUtil
 
         if (!declaringClass.equals(clazz) && checkInInterceptorHierarchy(clazz, declaringClass))
         {
-            Method found = null;
-            try
-            {
-                found = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethod(clazz, interceptor.getName(), interceptor.getParameterTypes());
-            }
-            catch (NoSuchMethodException e)
+            Method found = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethod(clazz, interceptor.getName(), interceptor.getParameterTypes());
+
+            if (found == null)
             {
                 Class<?> superClass = clazz.getSuperclass();
                 if (superClass != null && !superClass.equals(Object.class))

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=1081742&r1=1081741&r2=1081742&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java Tue Mar 15 11:56:09 2011
@@ -445,21 +445,6 @@ public final class ClassUtil
 
     }
 
-    public static <T> Constructor<T> isContaintNoArgConstructor(Class<T> clazz)
-    {
-        Asserts.nullCheckForClass(clazz);
-        try
-        {
-            return SecurityUtil.doPrivilegedGetDeclaredConstructor(clazz, new Class<?>[] {});
-
-        }
-        catch (Exception e)
-        {
-            return null;
-        }
-
-    }
-
     /**
      * Check the modifiers contains the public keyword.
      * 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java?rev=1081742&r1=1081741&r2=1081742&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java Tue Mar 15 11:56:09 2011
@@ -50,18 +50,6 @@ public class SecurityUtil
     private static final PrivilegedActionGetSystemProperties SYSTEM_PROPERTY_ACTION = new PrivilegedActionGetSystemProperties();
 
     @SuppressWarnings("unchecked")
-    public static <T> Constructor<T> doPrivilegedGetDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes) throws NoSuchMethodException
-    {
-        Object obj = AccessController.doPrivileged(
-                new PrivilegedActionForClass(clazz, parameterTypes, METHOD_CLASS_GETDECLAREDCONSTRUCTOR));
-        if (obj instanceof NoSuchMethodException)
-        {
-            throw (NoSuchMethodException)obj;
-        }
-        return (Constructor<T>)obj;
-    }
-
-    @SuppressWarnings("unchecked")
     /** @deprecated  use SecurityService instaed */
     public static <T> Constructor<T>[] doPrivilegedGetDeclaredConstructors(Class<T> clazz)
     {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1081742&r1=1081741&r2=1081742&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Tue Mar 15 11:56:09 2011
@@ -43,13 +43,9 @@ import java.util.concurrent.ConcurrentHa
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.decorator.Decorator;
-import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.context.Conversation;
-import javax.enterprise.context.ConversationScoped;
 import javax.enterprise.context.Dependent;
 import javax.enterprise.context.NormalScope;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.context.SessionScoped;
 import javax.enterprise.context.spi.Contextual;
 import javax.enterprise.event.Event;
 import javax.enterprise.event.Observes;
@@ -135,7 +131,6 @@ import org.apache.webbeans.decorator.Dec
 import org.apache.webbeans.decorator.WebBeansDecoratorConfig;
 import org.apache.webbeans.event.ObserverMethodImpl;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
-import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.exception.helper.ViolationMessageBuilder;
 import org.apache.webbeans.exception.inject.DefinitionException;
 import org.apache.webbeans.exception.inject.DeploymentException;
@@ -430,7 +425,7 @@ public final class WebBeansUtil
      * @return constructor
      * @throws WebBeansConfigurationException any configuration exception
      */
-    public static <T> Constructor<T> defineConstructor(Class<T> clazz) throws WebBeansConfigurationException
+    public <T> Constructor<T> defineConstructor(Class<T> clazz) throws WebBeansConfigurationException
     {
         Asserts.nullCheckForClass(clazz);
         Constructor<T>[] constructors = ClassUtil.getConstructors(clazz);
@@ -440,7 +435,7 @@ public final class WebBeansUtil
     }
 
 
-    public static <T>  Constructor<T> defineConstructor(Constructor<T>[] constructors, Class<T> clazz)
+    public <T> Constructor<T> defineConstructor(Constructor<T>[] constructors, Class<T> clazz)
     {
         Constructor<T> result = null;
 
@@ -463,7 +458,7 @@ public final class WebBeansUtil
 
         if (result == null)
         {
-            result = ClassUtil.isContaintNoArgConstructor(clazz);
+            result = getNoArgConstructor(clazz);
 
             if(result == null)
             {
@@ -502,11 +497,11 @@ public final class WebBeansUtil
      * @throws WebBeansConfigurationException if the web beans has incompatible
      *             constructor
      */
-    public static boolean isConstructureOk(Class<?> clazz) throws WebBeansConfigurationException
+    public boolean isConstructureOk(Class<?> clazz) throws WebBeansConfigurationException
     {
         Asserts.nullCheckForClass(clazz);
 
-        if (ClassUtil.isContaintNoArgConstructor(clazz) != null)
+        if (getNoArgConstructor(clazz) != null)
         {
             return true;
         }
@@ -572,66 +567,6 @@ public final class WebBeansUtil
     }
 
     /**
-     * Check conditions for the new binding.
-     * @param annotations annotations
-     * @return Annotation[] with all binding annotations
-     * @throws WebBeansConfigurationException if New plus any other binding annotation is set
-     */
-    @Deprecated
-    public static Annotation[] checkForNewQualifierForDeployment(Type type, Class<?> clazz, String name,
-                                                                 Annotation[] annotations)
-    {
-        return WebBeansContext.getInstance().getAnnotationManager().checkForNewQualifierForDeployment(type, clazz, name, annotations);
-    }
-
-    /**
-     * Returns true if src scope encloses the target.
-     *
-     * @param src src scope
-     * @param target target scope
-     * @return true if src scope encloses the target
-     */
-    public static boolean isScopeEncloseOther(Class<? extends Annotation> src, Class<? extends Annotation> target)
-    {
-        Asserts.assertNotNull(src, "Src argument can not be null");
-        Asserts.assertNotNull(target, "Target argument can not be null");
-
-        if (src.equals(ConversationScoped.class))
-        {
-            return true;
-        }
-        else if (src.equals(ApplicationScoped.class))
-        {
-            if (target.equals(ConversationScoped.class) || (target.equals(ApplicationScoped.class)))
-            {
-                return false;
-            }
-            return true;
-
-        }
-        else if (src.equals(SessionScoped.class))
-        {
-            if (target.equals(ConversationScoped.class) ||
-                target.equals(ApplicationScoped.class) ||
-                target.equals(SessionScoped.class))
-            {
-                return false;
-            }
-            return true;
-
-        }
-        else if (src.equals(RequestScoped.class))
-        {
-            return false;
-        }
-        else
-        {
-            throw new WebBeansException("Scope is not correct");
-        }
-
-    }
-
-    /**
      * New WebBeans component class.
      *
      * @param <T>
@@ -648,7 +583,7 @@ public final class WebBeansUtil
         {
             comp = new NewBean<T>(clazz, WebBeansType.MANAGED, webBeansContext);
             comp.setImplScopeType(new DependentScopeLiteral());
-            comp.setConstructor(WebBeansUtil.defineConstructor(clazz));
+            comp.setConstructor(defineConstructor(clazz));
             DefinitionUtil.addConstructorInjectionPointMetaData(comp, comp.getConstructor());
 
             DefinitionUtil.defineInjectedFields(comp);
@@ -1200,7 +1135,7 @@ public final class WebBeansUtil
         {
             if(definedInInterceptorClass)
             {
-                Constructor<?> ct = ClassUtil.isContaintNoArgConstructor(interceptorClass);
+                Constructor<?> ct = getNoArgConstructor(interceptorClass);
                 if (ct == null)
                 {
                     throw new WebBeansConfigurationException("class : " + interceptorClass.getName()
@@ -1296,10 +1231,10 @@ public final class WebBeansUtil
      * @return
      * @throws WebBeansConfigurationException
      */
-    public static <T> T newInstanceForced(Class<T> clazz) throws WebBeansConfigurationException
+    public <T> T newInstanceForced(Class<T> clazz) throws WebBeansConfigurationException
     {
         // FIXME: This new instance should have JCDI injection performed
-        Constructor<T> ct = ClassUtil.isContaintNoArgConstructor(clazz);
+        Constructor<T> ct = getNoArgConstructor(clazz);
         if (ct == null)
         {
             throw new WebBeansConfigurationException("class : " + clazz.getName() + " must have no-arg constructor");
@@ -1944,7 +1879,7 @@ public final class WebBeansUtil
 
                     if(!violationMessage.containsViolation())
                     {
-                        Constructor<?> cons = ClassUtil.isContaintNoArgConstructor(beanClass);
+                        Constructor<?> cons = getNoArgConstructor(beanClass);
 
                         if (ClassUtil.isFinal(beanClass.getModifiers()))
                         {
@@ -1975,6 +1910,11 @@ public final class WebBeansUtil
         }
     }
 
+    private <T> Constructor<T> getNoArgConstructor(Class<T> clazz)
+    {
+        return webBeansContext.getSecurityService().doPrivilegedGetDeclaredConstructor(clazz, new Class<?>[] {});
+    }
+
     public static void checkNullable(Class<?> type, AbstractOwbBean<?> component)
     {
         Asserts.assertNotNull(type, "type parameter can not be null");
@@ -2799,7 +2739,7 @@ public final class WebBeansUtil
         //X TODO move proxy instance creation into JavassistProxyFactory!
         Class clazz = webBeansContext.getJavassistProxyFactory().createAbstractDecoratorProxyClass(bean);
 
-        bean.setConstructor(WebBeansUtil.defineConstructor(clazz));
+        bean.setConstructor(defineConstructor(clazz));
         bean.setIsAbstractDecorator(true);
         return bean;
     }

Modified: openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/SecurityService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/SecurityService.java?rev=1081742&r1=1081741&r2=1081742&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/SecurityService.java (original)
+++ openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/SecurityService.java Tue Mar 15 11:56:09 2011
@@ -50,8 +50,7 @@ public interface SecurityService
     /**
      * @see Class#getDeclaredConstructor(Class[])
      */
-    public <T> Constructor<T> doPrivilegedGetDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes)
-    throws NoSuchMethodException;
+    public <T> Constructor<T> doPrivilegedGetDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes);
 
     /**
      * @see Class#getDeclaredConstructors()
@@ -61,8 +60,7 @@ public interface SecurityService
     /**
      * @see Class#getDeclaredMethod(String, Class[])
      */
-    public <T> Method doPrivilegedGetDeclaredMethod(Class<T> clazz, String name, Class<?>... parameterTypes)
-    throws NoSuchMethodException;
+    public <T> Method doPrivilegedGetDeclaredMethod(Class<T> clazz, String name, Class<?>... parameterTypes);
 
     /**
      * @see Class#getDeclaredMethods()
@@ -72,7 +70,7 @@ public interface SecurityService
     /**
      * @see Class#getDeclaredField(String)
      */
-    public <T> Field doPrivilegedGetDeclaredField(Class<T> clazz, String name) throws NoSuchFieldException;
+    public <T> Field doPrivilegedGetDeclaredField(Class<T> clazz, String name);
 
     /**
      * @see Class#getDeclaredFields()