Lesson learnt. Will take care next time to run the TCK as well. --cheers, Rohit
On Fri, Feb 24, 2012 at 5:48 PM, Mark Struberg <[email protected]> wrote: > Hi Rohit, > > also thanks to you for fixing the underlying bug :) > > For now I just applied the fix to trunk. Do you need it as well on any other > branch? > > > Btw, if you do such intense changes, then it's always a good idea to run both > TCKs > > $> mvn clean install -Ptck -Pjsr330-tck > > This will run both the CDI (standalone part) and the atinject TCK. > > LieGrue, > strub > > > > ----- Original Message ----- >> From: Rohit Kelapure <[email protected]> >> To: [email protected] >> Cc: [email protected] >> Sent: Friday, February 24, 2012 11:33 PM >> Subject: Re: svn commit: r1293457 - in >> /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: >> component/InjectionPointBean.java container/BeanManagerImpl.java >> >>T hank you Mark and Romain for investigating and fixing!! >> - Rohit >> >> On Fri, Feb 24, 2012 at 5:31 PM, <[email protected]> wrote: >>> Author: struberg >>> Date: Fri Feb 24 22:31:49 2012 >>> New Revision: 1293457 >>> >>> URL: http://svn.apache.org/viewvc?rev=1293457&view=rev >>> Log: >>> OWB-648 fix TCK >>> >>> txs to Romain Manni-Bucau for the patch! >>> >>> Modified: >>> >> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java >>> >> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java >>> >>> Modified: >> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java >>> URL: >> http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java?rev=1293457&r1=1293456&r2=1293457&view=diff >>> >> ============================================================================== >>> --- >> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java >> (original) >>> +++ >> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java >> Fri Feb 24 22:31:49 2012 >>> @@ -31,7 +31,6 @@ public class InjectionPointBean extends >>> { >>> private static final WebBeansLogger logger = >> WebBeansLogger.getLogger(InjectionPointBean.class); >>> >>> - //X TODO refactor. public static variables are utterly ugly >>> private static ThreadLocal<Stack<InjectionPoint>> >> localThreadlocalStack = new ThreadLocal<Stack<InjectionPoint>>(); >>> >>> private static Stack<InjectionPoint> getStackOfInjectionPoints() >>> @@ -80,6 +79,11 @@ public class InjectionPointBean extends >>> addApiType(Object.class); >>> } >>> >>> + public static boolean isStackEmpty() >>> + { >>> + return getStackOfInjectionPoints().isEmpty(); >>> + } >>> + >>> @Override >>> protected InjectionPoint >> createInstance(CreationalContext<InjectionPoint> creationalContext) >>> { >>> >>> Modified: >> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java >>> URL: >> http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1293457&r1=1293456&r2=1293457&view=diff >>> >> ============================================================================== >>> --- >> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java >> (original) >>> +++ >> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java >> Fri Feb 24 22:31:49 2012 >>> @@ -62,6 +62,7 @@ import javax.naming.Referenceable; >>> import javax.naming.StringRefAddr; >>> import org.apache.webbeans.component.AbstractOwbBean; >>> import org.apache.webbeans.component.EnterpriseBeanMarker; >>> +import org.apache.webbeans.component.InjectionPointBean; >>> import org.apache.webbeans.component.InjectionTargetBean; >>> import org.apache.webbeans.component.InjectionTargetWrapper; >>> import org.apache.webbeans.component.JmsBeanMarker; >>> @@ -827,17 +828,34 @@ public class BeanManagerImpl implements >>> InjectionResolver.injectionPoints.set(injectionPoint); >>> } >>> >>> - if(WebBeansUtil.isDependent(injectedBean)) >>> - { >>> - //Using owner creational context >>> - //Dependents use parent creational context >>> - instance = getReference(injectedBean, >> injectionPoint.getType(), ownerCreationalContext); >>> + boolean ijbSet = false; >>> + if (InjectionPointBean.isStackEmpty()) >>> + { >>> + ijbSet = true; >>> + InjectionPointBean.setThreadLocal(injectionPoint); >>> } >>> - else >>> - { >>> - //New creational context for normal scoped beans >>> - CreationalContextImpl<Object> injectedCreational = >> (CreationalContextImpl<Object>)createCreationalContext(injectedBean); >>> - instance = getReference(injectedBean, >> injectionPoint.getType(), injectedCreational); >>> + >>> + try >>> + { >>> + if(WebBeansUtil.isDependent(injectedBean)) >>> + { >>> + //Using owner creational context >>> + //Dependents use parent creational context >>> + instance = getReference(injectedBean, >> injectionPoint.getType(), ownerCreationalContext); >>> + } >>> + else >>> + { >>> + //New creational context for normal scoped beans >>> + CreationalContextImpl<Object> injectedCreational = >> (CreationalContextImpl<Object>)createCreationalContext(injectedBean); >>> + instance = getReference(injectedBean, >> injectionPoint.getType(), injectedCreational); >>> + } >>> + } >>> + finally >>> + { >>> + if (ijbSet) >>> + { >>> + InjectionPointBean.unsetThreadLocal(); >>> + } >>> } >>> >>> if(isSetIPForProducers) >>> >>> >>
