openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1467875 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component: InterceptorBean.java creation/InterceptorBeanBuilder.java
Date Mon, 15 Apr 2013 07:12:04 GMT
Author: rmannibucau
Date: Mon Apr 15 07:12:04 2013
New Revision: 1467875

URL: http://svn.apache.org/r1467875
Log:
seems our interceptor index was never hitting the 0 index + hierarchic interceptors was forbidden

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java?rev=1467875&r1=1467874&r2=1467875&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
Mon Apr 15 07:12:04 2013
@@ -199,7 +199,9 @@ public abstract class InterceptorBean<T>
 
         public int getCurrentInterceptorIdx()
         {
-            return currentInterceptorIdx;
+            // in proceed we +1 to handle index properly whatever the stack is but we need
to -1 here to not skip
+            // index 0 when we have multiple interceptors
+            return currentInterceptorIdx - 1;
         }
 
         public InvocationContext getWrapped()

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java?rev=1467875&r1=1467874&r2=1467875&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
Mon Apr 15 07:12:04 2013
@@ -33,6 +33,7 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -129,7 +130,7 @@ public abstract class InterceptorBeanBui
     {
         List<Class> classHierarchy = webBeansContext.getInterceptorUtil().getReverseClassHierarchy(annotatedType.getJavaClass());
 
-        AnnotatedMethod aroundInvokeMethod = null;
+        Collection<Method> aroundInvokeMethod = null;
         List<AnnotatedMethod> postConstructMethods = new ArrayList<AnnotatedMethod>();
         List<AnnotatedMethod> preDestroyMethods = new ArrayList<AnnotatedMethod>();
         List<AnnotatedMethod> aroundTimeoutMethods = new ArrayList<AnnotatedMethod>();
@@ -155,10 +156,20 @@ public abstract class InterceptorBeanBui
                     {
                         if (aroundInvokeMethod != null)
                         {
-                            throw new WebBeansConfigurationException("only one AroundInvoke
allowed per Interceptor");
+                            for (final Method ai : aroundInvokeMethod)
+                            {
+                                if (ai.getDeclaringClass() == m.getJavaMember().getDeclaringClass())
+                                {
+                                    throw new WebBeansConfigurationException("only one AroundInvoke
allowed per Interceptor");
+                                }
+                            }
                         }
                         checkAroundInvokeConditions(m);
-                        aroundInvokeMethod = m;
+                        if (aroundInvokeMethod == null)
+                        {
+                            aroundInvokeMethod = new ArrayList<Method>();
+                        }
+                        aroundInvokeMethod.add(m.getJavaMember());
                     }
 
                     // PostConstruct
@@ -216,7 +227,7 @@ public abstract class InterceptorBeanBui
         if (aroundInvokeMethod != null)
         {
             interceptorFound = true;
-            interceptionMethods.put(InterceptionType.AROUND_INVOKE, new Method[]{aroundInvokeMethod.getJavaMember()});
+            interceptionMethods.put(InterceptionType.AROUND_INVOKE, aroundInvokeMethod.toArray(new
Method[aroundInvokeMethod.size()]));
         }
 
         if (postConstructMethods.size() > 0)



Mime
View raw message