openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1805243 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java test/java/org/apache/webbeans/test/producer/ProducerBean.java
Date Wed, 16 Aug 2017 21:22:05 GMT
Author: struberg
Date: Wed Aug 16 21:22:05 2017
New Revision: 1805243

URL: http://svn.apache.org/viewvc?rev=1805243&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.

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java?rev=1805243&r1=1805242&r2=1805243&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
Wed Aug 16 21:22:05 2017
@@ -336,7 +336,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<>(webBeansContext,
annotatedType, beanAttributes);
+        if (beanAttributes == null)
+        {
+            // might happen if a proxying rule eefines 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/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java?rev=1805243&r1=1805242&r2=1805243&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java
Wed Aug 16 21:22:05 2017
@@ -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");
+    }
 }



Mime
View raw message