[webbeans-commits] Webbeans SVN: r2777 - in ri/trunk: tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Mon Jun 8 07:54:12 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-06-08 07:54:12 -0400 (Mon, 08 Jun 2009)
New Revision: 2777

Added:
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Car.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/CarFactory.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Government.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/NullProducerTest.java
Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
Log:
WBRI-276

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java	2009-06-08 11:25:31 UTC (rev 2776)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java	2009-06-08 11:54:12 UTC (rev 2777)
@@ -221,7 +221,7 @@
       {
          if (injectionPoint.getMember() instanceof Field)
          {
-            if (!Reflections.isTransient(injectionPoint.getMember()) && !Reflections.isSerializable(instance.getClass()))
+            if (!Reflections.isTransient(injectionPoint.getMember()) && instance != null && !Reflections.isSerializable(instance.getClass()))
             {
                throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into non-transient fields of passivating beans\n\nProducer: " + this.toString() + "\nInjection Point: " + injectionPoint.toString());
             }

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Car.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Car.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Car.java	2009-06-08 11:54:12 UTC (rev 2777)
@@ -0,0 +1,8 @@
+package org.jboss.webbeans.test.unit.implementation.producer.method;
+
+import java.io.Serializable;
+
+public class Car implements Serializable
+{
+
+}


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Car.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/CarFactory.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/CarFactory.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/CarFactory.java	2009-06-08 11:54:12 UTC (rev 2777)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.unit.implementation.producer.method;
+
+import javax.enterprise.inject.Produces;
+
+public class CarFactory
+{
+
+   @Produces @Important
+   public Car produceGovernmentCar()
+   {
+      return null;
+   }
+   
+}


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/CarFactory.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Government.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Government.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Government.java	2009-06-08 11:54:12 UTC (rev 2777)
@@ -0,0 +1,19 @@
+package org.jboss.webbeans.test.unit.implementation.producer.method;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+ at SessionScoped
+public class Government implements Serializable
+{
+
+   @Important Car governmentCar;
+   
+   public void destabilize()
+   {
+      
+   }
+   
+   
+}


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Government.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/NullProducerTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/NullProducerTest.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/NullProducerTest.java	2009-06-08 11:54:12 UTC (rev 2777)
@@ -0,0 +1,17 @@
+package org.jboss.webbeans.test.unit.implementation.producer.method;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+ at Artifact
+public class NullProducerTest extends AbstractWebBeansTest
+{
+   
+   @Test(description="WBRI-276")
+   public void testProduerMethodReturnsNull()
+   {
+      getCurrentManager().getInstanceByType(Government.class).destabilize();
+   }
+
+}


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/NullProducerTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain




More information about the weld-commits mailing list