Author: struberg
Date: Sat Apr 14 20:12:22 2018
New Revision: 1829166

URL: http://svn.apache.org/viewvc?rev=1829166&view=rev
Log:
OWB-1213 fix NPE when scanning for self-intercepting bean

Did happen on producermethods which return a class with a private ct.

ported back from OWB-2.0.x

Modified:
    openwebbeans/branches/owb_1.7.x/   (props changed)
    
openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
    
openwebbeans/branches/owb_1.7.x/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java

Propchange: openwebbeans/branches/owb_1.7.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Apr 14 20:12:22 2018
@@ -1,2 +1,2 @@
 /openwebbeans/branches/owb_1.2.x:1640945,1641609,1641684
-/openwebbeans/trunk:1803385
+/openwebbeans/trunk:1803385,1805243

Modified: 
openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java?rev=1829166&r1=1829165&r2=1829166&view=diff
==============================================================================
--- 
openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
 (original)
+++ 
openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
 Sat Apr 14 20:12:22 2018
@@ -326,7 +326,13 @@ public class InterceptorResolutionServic
     private <T> SelfInterceptorBean<T> 
resolveSelfInterceptorBean(AnnotatedType<T> annotatedType)
     {
         BeanAttributesImpl<T> beanAttributes = 
BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(annotatedType).build();
-        SelfInterceptorBeanBuilder<T>sibb = new 
SelfInterceptorBeanBuilder<T>(webBeansContext, annotatedType, beanAttributes);
+        if (beanAttributes == null)
+        {
+            // might happen if a proxying rule defines that this is not a 
valid bean type.
+            return null;
+        }
+
+        SelfInterceptorBeanBuilder<T> sibb = new 
SelfInterceptorBeanBuilder<>(webBeansContext, annotatedType, beanAttributes);
         sibb.defineSelfInterceptorRules();
         if (!sibb.isInterceptorEnabled())
         {

Modified: 
openwebbeans/branches/owb_1.7.x/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.7.x/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java?rev=1829166&r1=1829165&r2=1829166&view=diff
==============================================================================
--- 
openwebbeans/branches/owb_1.7.x/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java
 (original)
+++ 
openwebbeans/branches/owb_1.7.x/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java
 Sat Apr 14 20:12:22 2018
@@ -20,6 +20,7 @@ package org.apache.webbeans.test.produce
 
 import javax.enterprise.inject.Produces;
 import javax.inject.Named;
+import java.net.URI;
 
 public class ProducerBean {
 
@@ -58,4 +59,10 @@ public class ProducerBean {
     public boolean isName6() {
         return true;
     }
+
+    @Produces
+    public URI createUri()
+    {
+        return URI.create("http://invalid.invalid";);
+    }
 }


Reply via email to