Author: struberg
Date: Tue Mar 15 11:12:28 2011
New Revision: 1081727

URL: http://svn.apache.org/viewvc?rev=1081727&view=rev
Log:
OWB-503 make a few static methods non-static

Modified:
    
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorRuntimeSupport.java
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
    
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
    
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java
    
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java

Modified: 
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java?rev=1081727&r1=1081726&r2=1081727&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
 (original)
+++ 
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
 Tue Mar 15 11:12:28 2011
@@ -60,7 +60,6 @@ import org.apache.webbeans.inject.OWBInj
 import org.apache.webbeans.intercept.InterceptorData;
 import org.apache.webbeans.intercept.InterceptorDataImpl;
 import org.apache.webbeans.intercept.InterceptorType;
-import org.apache.webbeans.intercept.InterceptorUtil;
 import org.apache.webbeans.intercept.InvocationContextImpl;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.proxy.JavassistProxyFactory;
@@ -110,7 +109,7 @@ public class OpenWebBeansEjbInterceptor 
     
     /** cache of associated WebBeansContext */
     private transient WebBeansContext webBeansContext;
-    
+
     /* EJB InvocationContext.getTarget() provides underlying bean instance, 
which we do not want to hold a reference to */
     private CreationalKey ccKey;
     /**
@@ -220,7 +219,7 @@ public class OpenWebBeansEjbInterceptor 
             if ((this.contextual != null) && 
WebBeansUtil.isContainsInterceptorMethod(this.contextual.getInterceptorStack(), 
interceptorType))
             {
                 InvocationContextImpl impl = new 
InvocationContextImpl(webBeansContext, this.contextual, context.getTarget(), 
null, null,
-                        
InterceptorUtil.getInterceptorMethods(this.contextual.getInterceptorStack(), 
interceptorType), interceptorType);
+                        
webBeansContext.getInterceptorUtil().getInterceptorMethods(this.contextual.getInterceptorStack(),
 interceptorType), interceptorType);
                 impl.setCreationalContext(this.cc);
                 impl.setEJBInvocationContext(context); // If the final 299 
interceptor calls ic.proceed, the InvocationContext calls the 
ejbContext.proceed()
                 impl.setCcKey(this.ccKey);
@@ -541,8 +540,8 @@ public class OpenWebBeansEjbInterceptor 
                 List<InterceptorData> filteredInterceptorStack = new 
ArrayList<InterceptorData>(interceptorStack);
 
                 // Filter both EJB and WebBeans interceptors
-                
InterceptorUtil.filterCommonInterceptorStackList(filteredInterceptorStack, 
method);
-                
InterceptorUtil.filterOverridenAroundInvokeInterceptor(injectionTarget.getBeanClass(),
 filteredInterceptorStack);
+                
webBeansContext.getInterceptorUtil().filterCommonInterceptorStackList(filteredInterceptorStack,
 method);
+                
webBeansContext.getInterceptorUtil().filterOverridenAroundInvokeInterceptor(injectionTarget.getBeanClass(),
 filteredInterceptorStack);
 
                 this.interceptedMethodMap.put(method, 
filteredInterceptorStack);
             }
@@ -560,8 +559,9 @@ public class OpenWebBeansEjbInterceptor 
             // Call Around Invokes, 
             //      If there were decorators, the DelegatHandler will handle 
the  ejbcontext.proceed at the top of the stack.
             //      If there were no decorators, we will fall off the end of 
our own InvocationContext and take care of ejbcontext.proceed.
-            rv = InterceptorUtil.callAroundInvokes(webBeansContext, 
this.contextual, instance, (CreationalContextImpl<?>) this.cc, method,
-                    arguments, 
InterceptorUtil.getInterceptorMethods(filteredInterceptorStack, 
InterceptorType.AROUND_INVOKE), ejbContext, this.ccKey);
+            rv = 
webBeansContext.getInterceptorUtil().callAroundInvokes(webBeansContext, 
this.contextual, instance, (CreationalContextImpl<?>) this.cc, method,
+                    arguments, 
webBeansContext.getInterceptorUtil().getInterceptorMethods(filteredInterceptorStack,
 InterceptorType.AROUND_INVOKE),
+                                                                               
           ejbContext, this.ccKey);
         }
         
         return rv;
@@ -585,7 +585,9 @@ public class OpenWebBeansEjbInterceptor 
             try
             {
                     InvocationContextImpl impl = new 
InvocationContextImpl(webBeansContext, null, context.getTarget(), null, null,
-                            
InterceptorUtil.getInterceptorMethods(this.contextual.getInterceptorStack(), 
InterceptorType.AROUND_TIMEOUT), InterceptorType.AROUND_TIMEOUT);
+                            
webBeansContext.getInterceptorUtil().getInterceptorMethods(this.contextual.getInterceptorStack(),
+                                                                               
        InterceptorType.AROUND_TIMEOUT),
+                                                                               
        InterceptorType.AROUND_TIMEOUT);
                     impl.setCreationalContext(this.cc);
                     impl.setEJBInvocationContext(context);
                     impl.setCcKey((Object)this.ccKey);

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java?rev=1081727&r1=1081726&r2=1081727&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
 Tue Mar 15 11:12:28 2011
@@ -48,7 +48,6 @@ import org.apache.webbeans.inject.Inject
 import org.apache.webbeans.inject.InjectableMethods;
 import org.apache.webbeans.intercept.InterceptorData;
 import org.apache.webbeans.intercept.InterceptorType;
-import org.apache.webbeans.intercept.InterceptorUtil;
 import org.apache.webbeans.intercept.InvocationContextImpl;
 import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
 import org.apache.webbeans.proxy.JavassistProxyFactory;
@@ -250,9 +249,9 @@ public abstract class AbstractInjectionT
             if 
(WebBeansUtil.isContainsInterceptorMethod(getInterceptorStack(), 
InterceptorType.POST_CONSTRUCT))
             {
                 InvocationContextImpl impl = new 
InvocationContextImpl(getWebBeansContext(), null, instance, null, null,
-                        
InterceptorUtil.getInterceptorMethods(getInterceptorStack(),
-                                                              
InterceptorType.POST_CONSTRUCT),
-                                                              
InterceptorType.POST_CONSTRUCT);
+                        
getWebBeansContext().getInterceptorUtil().getInterceptorMethods(getInterceptorStack(),
+                                                                               
         InterceptorType.POST_CONSTRUCT),
+                                                                               
         InterceptorType.POST_CONSTRUCT);
                 impl.setCreationalContext(ownerCreationalContext);
                 try
                 {
@@ -289,9 +288,9 @@ public abstract class AbstractInjectionT
             if 
(WebBeansUtil.isContainsInterceptorMethod(getInterceptorStack(), 
InterceptorType.PRE_DESTROY))
             {                
                 InvocationContextImpl impl = new 
InvocationContextImpl(getWebBeansContext(), null, instance, null, null,
-                        
InterceptorUtil.getInterceptorMethods(getInterceptorStack(),
-                                                              
InterceptorType.PRE_DESTROY),
-                                                              
InterceptorType.PRE_DESTROY);
+                        
getWebBeansContext().getInterceptorUtil().getInterceptorMethods(getInterceptorStack(),
+                                                                               
         InterceptorType.PRE_DESTROY),
+                                                                               
         InterceptorType.PRE_DESTROY);
                 impl.setCreationalContext(creationalContext);
                 try
                 {

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=1081727&r1=1081726&r2=1081727&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
 Tue Mar 15 11:12:28 2011
@@ -73,7 +73,6 @@ import org.apache.webbeans.event.Notific
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.intercept.InterceptorData;
 import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
-import org.apache.webbeans.intercept.ejb.EJBInterceptorConfig;
 import org.apache.webbeans.spi.api.ResourceReference;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
@@ -1169,20 +1168,21 @@ public final class DefinitionUtil
         // If bean is not session bean
         if(!(bean instanceof EnterpriseBeanMarker))
         {
-            
EJBInterceptorConfig.configure(((AbstractOwbBean)bean).getReturnType(), 
bean.getInterceptorStack(), bean);
+            
bean.getWebBeansContext().getEJBInterceptorConfig().configure(((AbstractOwbBean)bean).getReturnType(),
 bean.getInterceptorStack());
         }
         else
         {
             //Check for injected fields in EJB @Interceptors
             List<InterceptorData> stack = new ArrayList<InterceptorData>();
-            EJBInterceptorConfig.configure(bean.getBeanClass(), stack, bean);
+            
bean.getWebBeansContext().getEJBInterceptorConfig().configure(bean.getBeanClass(),
 stack);
             for(InterceptorData data : stack)
             {
                 if(data.isDefinedInInterceptorClass())
                 {
                     
if(!AnnotationManager.checkInjectionPointForInterceptorPassivation(data.getInterceptorClass()))
                     {
-                        throw new WebBeansConfigurationException("Enterprise 
bean : " + bean.toString() + " interceptors must have serializable injection 
points");
+                        throw new WebBeansConfigurationException("Enterprise 
bean : " + bean.toString() +
+                                                                 " 
interceptors must have serializable injection points");
                     }
                 }
             }

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java?rev=1081727&r1=1081726&r2=1081727&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
 Tue Mar 15 11:12:28 2011
@@ -41,6 +41,7 @@ import org.apache.webbeans.inject.Altern
 import org.apache.webbeans.inject.impl.InjectionPointFactory;
 import org.apache.webbeans.intercept.InterceptorUtil;
 import org.apache.webbeans.intercept.InterceptorsManager;
+import org.apache.webbeans.intercept.ejb.EJBInterceptorConfig;
 import org.apache.webbeans.jms.JMSManager;
 import org.apache.webbeans.plugins.PluginLoader;
 import org.apache.webbeans.portable.AnnotatedElementFactory;
@@ -71,6 +72,7 @@ public class WebBeansContext
     private ConversationManager conversationManager = new 
ConversationManager(this);
     private CreationalContextFactory creationalContextFactory = new 
CreationalContextFactory(this);
     private DecoratorsManager decoratorsManager = new DecoratorsManager(this);
+    private EJBInterceptorConfig ejbInterceptorConfig = new 
EJBInterceptorConfig(this);
     private ExtensionLoader extensionLoader = new ExtensionLoader(this);
     private InterceptorsManager interceptorsManager = new 
InterceptorsManager(this);
     private JMSManager jmsManager = new JMSManager();
@@ -245,6 +247,11 @@ public class WebBeansContext
         return decoratorsManager;
     }
 
+    public EJBInterceptorConfig getEJBInterceptorConfig()
+    {
+        return ejbInterceptorConfig;
+    }
+
     public StereoTypeManager getStereoTypeManager()
     {
         return stereoTypeManager;

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java?rev=1081727&r1=1081726&r2=1081727&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
 Tue Mar 15 11:12:28 2011
@@ -154,6 +154,8 @@ public abstract class InterceptorHandler
 
     protected WebBeansContext webBeansContext;
 
+    protected InterceptorUtil interceptorUtil;
+
     /**
      * Creates a new handler.
      * @param bean proxied bean
@@ -162,6 +164,7 @@ public abstract class InterceptorHandler
     {
         this.bean = bean;
         this.webBeansContext = bean.getWebBeansContext();
+        this.interceptorUtil = webBeansContext.getInterceptorUtil();
     }
 
     /**
@@ -252,8 +255,8 @@ public abstract class InterceptorHandler
                             }
         
                             // Filter both EJB and WebBeans interceptors
-                            
InterceptorUtil.filterCommonInterceptorStackList(filteredInterceptorStack, 
method);
-                            
InterceptorUtil.filterOverridenAroundInvokeInterceptor(bean.getBeanClass(), 
filteredInterceptorStack);
+                            
interceptorUtil.filterCommonInterceptorStackList(filteredInterceptorStack, 
method);
+                            
interceptorUtil.filterOverridenAroundInvokeInterceptor(bean.getBeanClass(), 
filteredInterceptorStack);
                             this.interceptedMethodMap.put(method, 
filteredInterceptorStack);
                             interceptorMethods = filteredInterceptorStack;
                         }

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorRuntimeSupport.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorRuntimeSupport.java?rev=1081727&r1=1081726&r2=1081727&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorRuntimeSupport.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorRuntimeSupport.java
 Tue Mar 15 11:12:28 2011
@@ -29,7 +29,7 @@ import org.apache.webbeans.component.Owb
  * evaluating and performing interceptor handling for those
  * contextual instances at runtime</p>
  * 
- * <p>For each {@link OwbBean<T>} which is either decorated with a
+ * <p>For each {@link OwbBean} which is either decorated with a
  * {@link javax.enterprise.inject.spi.Decorator} or intercepted
  * by a {@link javax.enterprise.inject.spi.Interceptor} we 
  * dynamically create a subclass and use bytecode creation to 
@@ -51,8 +51,9 @@ public class InterceptorRuntimeSupport
      * @param <T>
      * @param bean
      * @return the interceptor subclass or <code>null</code> if there is no 
need to.
+     * TODO this is part of the unfinished subclassing work, see OWB-344
      */
-    public static final <T> Class<? extends T> 
getInterceptorSubClass(OwbBean<T> bean)
+    public final <T> Class<? extends T> getInterceptorSubClass(OwbBean<T> bean)
     {
         if (!(bean instanceof AbstractInjectionTargetBean<?>))
         {
@@ -63,9 +64,11 @@ public class InterceptorRuntimeSupport
         AbstractInjectionTargetBean<T> interceptableBean = 
(AbstractInjectionTargetBean<T>) bean;
         
         List<InterceptorData> interceptorStack =  
interceptableBean.getInterceptorStack();
-        
+
+        InterceptorUtil interceptorUtil = 
bean.getWebBeansContext().getInterceptorUtil();
+
         // we only subclass
-        List<InterceptorData> aroundInvokes = 
InterceptorUtil.getInterceptorMethods(interceptorStack, 
InterceptorType.AROUND_INVOKE);
+        List<InterceptorData> aroundInvokes = 
interceptorUtil.getInterceptorMethods(interceptorStack, 
InterceptorType.AROUND_INVOKE);
         
         if (aroundInvokes == null || aroundInvokes.size() == 0)
         {

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=1081727&r1=1081726&r2=1081727&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:12:28 2011
@@ -159,7 +159,7 @@ public final class InterceptorUtil
     }
 
     @SuppressWarnings("unchecked")
-    public static <T> boolean isBusinessMethodInterceptor(AnnotatedType<T> 
annotatedType)
+    public <T> boolean isBusinessMethodInterceptor(AnnotatedType<T> 
annotatedType)
     {
         Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
         for(AnnotatedMethod<? super T> methodA : methods)
@@ -198,7 +198,7 @@ public final class InterceptorUtil
     }
 
 
-    public static boolean isBusinessMethodInterceptor(Class<?> clazz)
+    public boolean isBusinessMethodInterceptor(Class<?> clazz)
     {
         Asserts.nullCheckForClass(clazz);
         Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
@@ -470,7 +470,7 @@ public final class InterceptorUtil
      * @return list of interceptor
      */
     @SuppressWarnings("unchecked")
-    public static List<InterceptorData> 
getInterceptorMethods(List<InterceptorData> stack, InterceptorType type)
+    public List<InterceptorData> getInterceptorMethods(List<InterceptorData> 
stack, InterceptorType type)
     {
         List<InterceptorData> interceptors = new ArrayList<InterceptorData>();
 
@@ -520,7 +520,7 @@ public final class InterceptorUtil
      * @param method called method
      * @return true if this interceptor data is not related
      */
-    private static boolean shouldRemoveInterceptorCommon(InterceptorData id, 
Method method)
+    private boolean shouldRemoveInterceptorCommon(InterceptorData id, Method 
method)
     {
         boolean isMethodAnnotatedWithExcludeInterceptorClass = false;
         if (AnnotationUtil.hasMethodAnnotation(method, 
ExcludeClassInterceptors.class))
@@ -552,7 +552,7 @@ public final class InterceptorUtil
      * @param stack interceptor stack
      * @param method called method on proxy
      */
-    public static void filterCommonInterceptorStackList(List<InterceptorData> 
stack, Method method)
+    public void filterCommonInterceptorStackList(List<InterceptorData> stack, 
Method method)
     {
         Iterator<InterceptorData> it = stack.iterator();
         while (it.hasNext())
@@ -566,7 +566,7 @@ public final class InterceptorUtil
         }
     }
 
-    public static Object callAroundInvokes(WebBeansContext webBeansContext, 
InjectionTargetBean<?> bean,Object instance, CreationalContextImpl<?> 
creationalContext,
+    public Object callAroundInvokes(WebBeansContext webBeansContext, 
InjectionTargetBean<?> bean,Object instance, CreationalContextImpl<?> 
creationalContext,
             Method proceed, Object[] arguments, List<InterceptorData> stack, 
InvocationContext ejbInvocationContext, Object altKey) throws Exception
     {
         InvocationContextImpl impl = new 
InvocationContextImpl(webBeansContext, bean, instance,
@@ -597,7 +597,7 @@ public final class InterceptorUtil
      * @return true if candidate class is a super class of given interceptor
      *         class
      */
-    public static boolean checkInInterceptorHierarchy(Class<?> 
interceptorClass, Class<?> candidateClass)
+    public boolean checkInInterceptorHierarchy(Class<?> interceptorClass, 
Class<?> candidateClass)
     {
         Class<?> superClassInterceptor = interceptorClass.getSuperclass();
         if (superClassInterceptor != null && 
!superClassInterceptor.equals(Object.class))
@@ -623,7 +623,7 @@ public final class InterceptorUtil
      * @param beanClass bean class
      * @param stack bean interceptor stack
      */
-    public static void filterOverridenLifecycleInterceptor(Class<?> beanClass, 
List<InterceptorData> stack)
+    public void filterOverridenLifecycleInterceptor(Class<?> beanClass, 
List<InterceptorData> stack)
     {
         List<InterceptorData> overridenInterceptors = new 
ArrayList<InterceptorData>();
         Iterator<InterceptorData> it = stack.iterator();
@@ -656,7 +656,7 @@ public final class InterceptorUtil
      * @param beanClass bean class
      * @param stack bean interceptor stack
      */
-    public static void filterOverridenAroundInvokeInterceptor(Class<?> 
beanClass, List<InterceptorData> stack)
+    public void filterOverridenAroundInvokeInterceptor(Class<?> beanClass, 
List<InterceptorData> stack)
     {
 
         List<InterceptorData> overridenInterceptors = null;
@@ -699,7 +699,7 @@ public final class InterceptorUtil
      * @param stack
      * @return the overriden InterceptorData that represents the parent
      */
-    private static InterceptorData getOverridenInterceptor(Class<?> clazz, 
InterceptorData interceptorData, List<InterceptorData> stack)
+    private InterceptorData getOverridenInterceptor(Class<?> clazz, 
InterceptorData interceptorData, List<InterceptorData> stack)
     {
         Method interceptor = interceptorData.getInterceptorMethod();
         Class<?> interceptorClass = interceptor.getDeclaringClass();
@@ -718,7 +718,16 @@ public final class InterceptorUtil
 
                 // get the interceptor method of the parent
                 Method superInterceptorMethod = 
superInterceptorData.getInterceptorMethod();
-                Method childInterceptorMethod = 
ClassUtil.getDeclaredMethod(interceptorClass, superInterceptorMethod.getName(), 
superInterceptorMethod.getParameterTypes());
+                Method childInterceptorMethod = null;
+                try
+                {
+                    childInterceptorMethod = 
webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethod(interceptorClass,
+                            superInterceptorMethod.getName(), 
superInterceptorMethod.getParameterTypes());
+                }
+                catch (NoSuchMethodException e)
+                {
+                    childInterceptorMethod = null;
+                }
 
                 if (null != childInterceptorMethod && 
ClassUtil.isOverriden(childInterceptorMethod, superInterceptorMethod))
                 {
@@ -744,7 +753,7 @@ public final class InterceptorUtil
      * @param interceptorData
      * @return
      */
-    private static InterceptorData 
removeInheritedButOverridenInterceptor(Class<?> clazz, InterceptorData 
interceptorData)
+    private InterceptorData removeInheritedButOverridenInterceptor(Class<?> 
clazz, InterceptorData interceptorData)
     {
         Method interceptor = interceptorData.getInterceptorMethod();
         Class<?> declaringClass = interceptor.getDeclaringClass();
@@ -757,16 +766,12 @@ public final class InterceptorUtil
 
         if (!declaringClass.equals(clazz) && 
checkInInterceptorHierarchy(clazz, declaringClass))
         {
-            Method found = ClassUtil.getDeclaredMethod(clazz, 
interceptor.getName(), interceptor.getParameterTypes());
-            if (found != null)
+            Method found = null;
+            try
             {
-                if (logger.wblWillLogDebug())
-                {
-                    logger.debug("KEEPING child " + clazz);
-                }
-                return interceptorData;
+                found = 
webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethod(clazz, 
interceptor.getName(), interceptor.getParameterTypes());
             }
-            else
+            catch (NoSuchMethodException e)
             {
                 Class<?> superClass = clazz.getSuperclass();
                 if (superClass != null && !superClass.equals(Object.class))
@@ -774,6 +779,8 @@ public final class InterceptorUtil
                     return removeInheritedButOverridenInterceptor(superClass, 
interceptorData);
                 }
             }
+
+            return interceptorData;
         }
 
         return null;
@@ -786,7 +793,7 @@ public final class InterceptorUtil
      * @param candidateClass interceptor candidate class
      * @return true if given candidate is listed in interceptors list
      */
-    public static boolean checkGivenClassIsInInterceptorList(Class<?> 
mainClass, Class<?> candidateClass)
+    public boolean checkGivenClassIsInInterceptorList(Class<?> mainClass, 
Class<?> candidateClass)
     {
         if (AnnotationUtil.hasClassAnnotation(mainClass, Interceptors.class))
         {

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=1081727&r1=1081726&r2=1081727&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
 Tue Mar 15 11:12:28 2011
@@ -28,10 +28,8 @@ import javax.interceptor.AroundInvoke;
 import javax.interceptor.AroundTimeout;
 import javax.interceptor.Interceptors;
 
-import org.apache.webbeans.component.AbstractInjectionTargetBean;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.intercept.InterceptorData;
-import org.apache.webbeans.intercept.InterceptorUtil;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;
@@ -56,20 +54,9 @@ public final class EJBInterceptorConfig
     /**
      * Configures the given class for applicable interceptors.
      *
-     * @param component
      * @param clazz configuration interceptors for this
      */
-    public static void configure(Class<?> clazz, List<InterceptorData> stack, 
AbstractInjectionTargetBean<?> component)
-    {
-        new 
EJBInterceptorConfig(component.getWebBeansContext())._configure(clazz, stack);
-    }
-
-    /**
-     * Configures the given class for applicable interceptors.
-     *
-     * @param clazz configuration interceptors for this
-     */
-    public void _configure(Class<?> clazz, List<InterceptorData> stack)
+    public void configure(Class<?> clazz, List<InterceptorData> stack)
     {
         Asserts.nullCheckForClass(clazz);
 
@@ -85,8 +72,7 @@ public final class EJBInterceptorConfig
 
         }
         _configureBeanAnnots(clazz, stack);
-        InterceptorUtil.filterOverridenLifecycleInterceptor(clazz, stack);
-
+        
webBeansContext.getInterceptorUtil().filterOverridenLifecycleInterceptor(clazz, 
stack);
     }
 
     /**
@@ -107,13 +93,13 @@ public final class EJBInterceptorConfig
         }
 
         webBeansContext.getWebBeansUtil().configureInterceptorMethods(null, 
clazz, AroundInvoke.class,
-                                                                               
      true, isMethod, stack, m, false);
+                                                                      true, 
isMethod, stack, m, false);
         webBeansContext.getWebBeansUtil().configureInterceptorMethods(null, 
clazz, AroundTimeout.class,
-                                                                               
      true, isMethod, stack, m, false);
+                                                                      true, 
isMethod, stack, m, false);
         webBeansContext.getWebBeansUtil().configureInterceptorMethods(null, 
clazz, PostConstruct.class,
-                                                                               
      true, isMethod, stack, m, false);
+                                                                      true, 
isMethod, stack, m, false);
         webBeansContext.getWebBeansUtil().configureInterceptorMethods(null, 
clazz, PreDestroy.class,
-                                                                               
      true, isMethod, stack, m, false);
+                                                                      true, 
isMethod, stack, m, false);
 
     }
 
@@ -152,13 +138,13 @@ public final class EJBInterceptorConfig
 
         // 3- Bean itself
         webBeansContext.getWebBeansUtil().configureInterceptorMethods(null, 
clazz, AroundInvoke.class,
-                                                                               
      false, false, stack, null, false);
+                                                                      false, 
false, stack, null, false);
         webBeansContext.getWebBeansUtil().configureInterceptorMethods(null, 
clazz, AroundTimeout.class,
-                                                                               
      false, false, stack, null, false);
+                                                                      false, 
false, stack, null, false);
         webBeansContext.getWebBeansUtil().configureInterceptorMethods(null, 
clazz, PostConstruct.class,
-                                                                               
      false, false, stack, null, false);
+                                                                      false, 
false, stack, null, false);
         webBeansContext.getWebBeansUtil().configureInterceptorMethods(null, 
clazz, PreDestroy.class,
-                                                                               
      false, false, stack, null, false);
+                                                                      false, 
false, stack, null, false);
 
     }
 
@@ -177,17 +163,17 @@ public final class EJBInterceptorConfig
             if (!clazz.equals(Object.class))
             {
                 
webBeansContext.getWebBeansUtil().configureInterceptorMethods(null, clazz,
-                                                                               
              AroundInvoke.class, false,
-                                                                               
              false, stack, null, false);
+                                                                              
AroundInvoke.class, false,
+                                                                              
false, stack, null, false);
                 
webBeansContext.getWebBeansUtil().configureInterceptorMethods(null, clazz,
-                                                                               
              AroundTimeout.class, false,
-                                                                               
              false, stack, null, false);
+                                                                              
AroundTimeout.class, false,
+                                                                              
false, stack, null, false);
                 
webBeansContext.getWebBeansUtil().configureInterceptorMethods(null, clazz,
-                                                                               
              PostConstruct.class, false,
-                                                                               
              false, stack, null, false);
+                                                                              
PostConstruct.class, false,
+                                                                              
false, stack, null, false);
                 
webBeansContext.getWebBeansUtil().configureInterceptorMethods(null, clazz,
-                                                                               
              PreDestroy.class, false,
-                                                                               
              false, stack, null, false);
+                                                                              
PreDestroy.class, false,
+                                                                              
false, stack, null, false);
             }
         }
     }

Modified: 
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java?rev=1081727&r1=1081726&r2=1081727&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
 Tue Mar 15 11:12:28 2011
@@ -67,7 +67,6 @@ import org.apache.webbeans.test.sterotyp
 import org.apache.webbeans.util.WebBeansUtil;
 import org.apache.webbeans.xml.WebBeansXMLConfigurator;
 
-
 /**
  * Superclass of all the unit test classes. It defines some methods for
  * subclasses and also do some initializtions for running the tests 
succesfully.
@@ -87,7 +86,7 @@ public abstract class TestContext implem
 
     /**
      * All unit test classes. It is defined for starting the tests from the
-     * {@link ServletContextListener} methods
+     * ServletContextListener methods
      */
     private static Set<ITestContext> testContexts = new 
HashSet<ITestContext>();
 
@@ -100,6 +99,8 @@ public abstract class TestContext implem
     /** Use for XML tests */
     protected WebBeansXMLConfigurator xmlConfigurator = null;
 
+    private WebBeansContext webBeansContext;
+
     /**
      * Creates new test class.
      * 
@@ -111,7 +112,8 @@ public abstract class TestContext implem
         TestContext.testContexts.add(this);
         this.manager = new MockManager();
         this.xmlConfigurator = new WebBeansXMLConfigurator();
-        WebBeansContext.getInstance().getPluginLoader().startUp();
+        this.webBeansContext = WebBeansContext.getInstance();
+        webBeansContext.getPluginLoader().startUp();
     }
     
 
@@ -209,7 +211,7 @@ public abstract class TestContext implem
 
     /**
      * This will be called whenever the test is failed. NOT : This method is
-     * used for running the tests from the {@link ServletContextListener}. It 
is
+     * used for running the tests from the ServletContextListener. It is
      * not used for normal unit tests.
      * 
      * @see TestListener
@@ -223,7 +225,7 @@ public abstract class TestContext implem
 
     /**
      * This will be called whenever the test is passed. NOT : This method is
-     * used for running the tests from the {@link ServletContextListener}. It 
is
+     * used for running the tests from the ServletContextListener. It is
      * not used for normal unit tests.
      * 
      * @see TestListener
@@ -237,7 +239,7 @@ public abstract class TestContext implem
 
     /**
      * Initialize all tests. NOT : This method is used for initializing the all
-     * tests classes from the {@link ServletContextListener}. It is not used 
for
+     * tests classes from the ServletContextListener. It is not used for
      * normal unit tests.
      * 
      * @see TestListener
@@ -255,7 +257,7 @@ public abstract class TestContext implem
 
     /**
      * Start all tests. NOT : This method is used for starting the all tests
-     * classes from the {@link ServletContextListener}. It is not used for
+     * classes from the ServletContextListener. It is not used for
      * normal unit tests.
      * 
      * @see TestListener
@@ -273,7 +275,7 @@ public abstract class TestContext implem
 
     /**
      * Ending all tests. NOT : This method is used for ending the all tests
-     * classes from the {@link ServletContextListener}. It is not used for
+     * classes from the ServletContextListener. It is not used for
      * normal unit tests.
      * 
      * @see TestListener
@@ -441,6 +443,11 @@ public abstract class TestContext implem
         return manager;
     }
 
+    protected WebBeansContext getWebBeansContext()
+    {
+        return webBeansContext;
+    }
+
     /**
      * Return new {@link MockHttpSession}
      * 
@@ -448,6 +455,7 @@ public abstract class TestContext implem
      */
     protected Object getSession()
     {
+        //X TODO huh? WTF...
         return new Object();
     }
 
@@ -499,7 +507,7 @@ public abstract class TestContext implem
 
     /**
      * End tests for sub-class. NOTE : This method is used for ending the all
-     * test methods in sub-class from the {@link ServletContextListener}. It is
+     * test methods in sub-class from the ServletContextListener. It is
      * not used for normal unit tests.
      * 
      * @see TestListener
@@ -512,7 +520,7 @@ public abstract class TestContext implem
 
     /**
      * Start tests for sub-class. NOTE : This method is used for starting the 
all
-     * test methods in sub-class from the {@link ServletContextListener}. It is
+     * test methods in sub-class from the ServletContextListener. It is
      * not used for normal unit tests.
      * 
      * @see TestListener

Modified: 
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java?rev=1081727&r1=1081726&r2=1081727&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java
 Tue Mar 15 11:12:28 2011
@@ -25,7 +25,6 @@ import junit.framework.Assert;
 import org.apache.webbeans.component.AbstractOwbBean;
 import org.apache.webbeans.component.AbstractInjectionTargetBean;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
-import org.apache.webbeans.intercept.ejb.EJBInterceptorConfig;
 import org.apache.webbeans.test.TestContext;
 import 
org.apache.webbeans.test.component.exception.AroundInvokeWithFinalMethodComponent;
 import 
org.apache.webbeans.test.component.exception.AroundInvokeWithSameMethodNameComponent;
@@ -211,7 +210,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             AbstractInjectionTargetBean<MoreThanOnePostConstructComponent> 
component = defineManagedBean(MoreThanOnePostConstructComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {
@@ -228,7 +227,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             
AbstractInjectionTargetBean<PostContructMethodHasParameterComponent> component 
= defineManagedBean(PostContructMethodHasParameterComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {
@@ -245,7 +244,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             AbstractInjectionTargetBean<?> component = 
defineManagedBean(PostContructMethodHasReturnTypeComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {
@@ -262,7 +261,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             AbstractInjectionTargetBean<?> component = 
defineManagedBean(PostContructMethodHasCheckedExceptionComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {
@@ -279,7 +278,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             AbstractInjectionTargetBean<?> component = 
defineManagedBean(PostContructMethodHasStaticComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {
@@ -296,7 +295,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             AbstractInjectionTargetBean<?> component = 
defineManagedBean(MoreThanOneAroundInvokeComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {
@@ -323,7 +322,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             AbstractInjectionTargetBean<?> component = 
defineManagedBean(AroundInvokeWithoutParameterComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {
@@ -340,7 +339,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             AbstractInjectionTargetBean<?> component = 
defineManagedBean(AroundInvokeWithoutReturnTypeComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {
@@ -357,7 +356,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             AbstractInjectionTargetBean<?> component = 
defineManagedBean(AroundInvokeWithWrongReturnTypeComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {
@@ -374,7 +373,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             AbstractInjectionTargetBean<?> component = 
defineManagedBean(AroundInvokeWithoutExceptionComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {
@@ -391,7 +390,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             AbstractInjectionTargetBean<?> component = 
defineManagedBean(AroundInvokeWithStaticMethodComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {
@@ -408,7 +407,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             AbstractInjectionTargetBean<?> component = 
defineManagedBean(AroundInvokeWithFinalMethodComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {
@@ -425,7 +424,7 @@ public class ExceptionComponentTest exte
         {
             clear();
             AbstractInjectionTargetBean<?> component = 
defineManagedBean(NoArgConstructorInterceptorComponent.class);
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {

Modified: 
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java?rev=1081727&r1=1081726&r2=1081727&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java
 Tue Mar 15 11:12:28 2011
@@ -22,7 +22,6 @@ import junit.framework.Assert;
 
 import org.apache.webbeans.component.AbstractInjectionTargetBean;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
-import org.apache.webbeans.intercept.ejb.EJBInterceptorConfig;
 import org.apache.webbeans.test.TestContext;
 import org.apache.webbeans.test.component.intercept.MultpleInterceptor;
 import org.junit.Before;
@@ -49,7 +48,7 @@ public class EJBInterceptorExceptionComp
         {
             AbstractInjectionTargetBean<MultpleInterceptor> component = 
defineManagedBean(MultpleInterceptor.class);
 
-            EJBInterceptorConfig.configure(component.getReturnType(), 
component.getInterceptorStack(), component);
+            
getWebBeansContext().getEJBInterceptorConfig().configure(component.getReturnType(),
 component.getInterceptorStack());
         }
         catch (WebBeansConfigurationException e)
         {


Reply via email to