openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1512821 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
Date Sat, 10 Aug 2013 20:53:00 GMT
Author: struberg
Date: Sat Aug 10 20:53:00 2013
New Revision: 1512821

URL: http://svn.apache.org/r1512821
Log:
OWB-890 fix NPE if getBean() returns null

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=1512821&r1=1512820&r2=1512821&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
Sat Aug 10 20:53:00 2013
@@ -162,7 +162,19 @@ public class InjectionResolver
         Annotation[] qualifiers = new Annotation[injectionPoint.getQualifiers().size()];
         qualifiers = injectionPoint.getQualifiers().toArray(qualifiers);
 
-        Set<Bean<?>> beanSet = implResolveByType(type, injectionPoint.getBean().getBeanClass(),
qualifiers);
+        // OWB-890 some 3rd party InjectionPoints return null in getBean();
+        Class<?> injectionPointClass = Object.class; // the fallback
+        Bean injectionPointBean = injectionPoint.getBean();
+        if (injectionPointBean != null)
+        {
+            injectionPointClass = injectionPointBean.getBeanClass();
+        }
+        if (injectionPointClass == null && type instanceof Class)
+        {
+            injectionPointClass = (Class) type;
+        }
+
+        Set<Bean<?>> beanSet = implResolveByType(type, injectionPointClass, qualifiers);
 
         if (beanSet.isEmpty())
         {



Mime
View raw message