openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1631174 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/container/OwbCDI.java main/java/org/apache/webbeans/inject/instance/InstanceImpl.java test/java/org/apache/webbeans/container/OwbCDIProviderTest.java
Date Sun, 12 Oct 2014 13:24:38 GMT
Author: rmannibucau
Date: Sun Oct 12 13:24:37 2014
New Revision: 1631174

URL: http://svn.apache.org/r1631174
Log:
avoid NPE in InstanceImpl

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/OwbCDI.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/container/OwbCDIProviderTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/OwbCDI.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/OwbCDI.java?rev=1631174&r1=1631173&r2=1631174&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/OwbCDI.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/OwbCDI.java
Sun Oct 12 13:24:37 2014
@@ -26,17 +26,12 @@ import org.apache.webbeans.inject.instan
 import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.CDI;
-import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.util.TypeLiteral;
-import javax.inject.Inject;
 import java.lang.annotation.Annotation;
 import java.util.Iterator;
 
 public class OwbCDI extends CDI<Object>
 {
-    @Inject
-    private Instance<Object> injectionPoint;
-
     private WebBeansContext getWebBeansContext()
     {
         return WebBeansContext.currentInstance();
@@ -47,8 +42,6 @@ public class OwbCDI extends CDI<Object>
         final WebBeansContext webBeansContext = getWebBeansContext();
         final BeanManagerImpl bm = webBeansContext.getBeanManagerImpl();
         final CreationalContextImpl<Instance<Object>> creationalContext = bm.createCreationalContext(null);
-        final InjectionPoint injectionPoint1 = bm.createInjectionTarget(bm.createAnnotatedType(OwbCDI.class)).getInjectionPoints().iterator().next();
-        creationalContext.putInjectionPoint(injectionPoint1);
         return new InstanceBean<Object>(webBeansContext).create(creationalContext);
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java?rev=1631174&r1=1631173&r2=1631174&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
Sun Oct 12 13:24:37 2014
@@ -163,7 +163,7 @@ public class InstanceImpl<T> implements 
 
         InjectionResolver injectionResolver = webBeansContext.getBeanManagerImpl().getInjectionResolver();
 
-        Bean<?> injectionPointBean = injectionPoint.getBean();
+        Bean<?> injectionPointBean = injectionPoint != null ? injectionPoint.getBean()
: null;
         Class<?> injectionPointClass = null;
         if (injectionPointBean != null)
         {

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/container/OwbCDIProviderTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/container/OwbCDIProviderTest.java?rev=1631174&r1=1631173&r2=1631174&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/container/OwbCDIProviderTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/container/OwbCDIProviderTest.java
Sun Oct 12 13:24:37 2014
@@ -36,6 +36,7 @@ public class OwbCDIProviderTest extends 
         assertNotNull(CDI.current());
         assertNotNull(CDI.current().getBeanManager());
         assertFalse(CDI.current().isUnsatisfied());
-        assertTrue(CDI.current().isAmbiguous());
+        assertFalse(CDI.current().isAmbiguous());
+        assertNotNull(CDI.current().get());
     }
 }



Mime
View raw message