[webbeans-commits] Webbeans SVN: r3083 - ri/trunk/impl/src/main/java/org/jboss/webbeans.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Fri Jul 17 18:11:53 EDT 2009
Author: dan.j.allen
Date: 2009-07-17 18:11:53 -0400 (Fri, 17 Jul 2009)
New Revision: 3083
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
Log:
throw IllegalProduceException for producer method returning non-serializable bean for injection in passivation capable bean
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-07-17 22:10:55 UTC (rev 3082)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-07-17 22:11:53 UTC (rev 3083)
@@ -9,7 +9,7 @@
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
+ * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
@@ -17,7 +17,6 @@
package org.jboss.webbeans;
import java.lang.annotation.Annotation;
-import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
@@ -28,8 +27,10 @@
import java.util.List;
import java.util.Set;
+import javax.enterprise.context.Dependent;
import javax.enterprise.event.Event;
import javax.enterprise.inject.AmbiguousResolutionException;
+import javax.enterprise.inject.IllegalProductException;
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.New;
import javax.enterprise.inject.UnproxyableResolutionException;
@@ -39,6 +40,7 @@
import javax.enterprise.inject.spi.InjectionPoint;
import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.bean.AbstractProducerBean;
import org.jboss.webbeans.bean.DecoratorBean;
import org.jboss.webbeans.bean.DisposalMethodBean;
import org.jboss.webbeans.bean.NewEnterpriseBean;
@@ -46,7 +48,6 @@
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.injection.FieldInjectionPoint;
import org.jboss.webbeans.introspector.WBAnnotated;
import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
import org.jboss.webbeans.resolution.ResolvableWBClass;
@@ -114,7 +115,7 @@
{
if (!Reflections.isSerializable(decorator.getBeanClass()))
{
- throw new UnserializableDependencyException("The bean " + bean + " declares a passivating scope but has non-serializable decorator: " + decorator);
+ throw new UnserializableDependencyException("The bean " + bean + " declares a passivating scope but has non-serializable decorator: " + decorator);
}
}
}
@@ -169,6 +170,10 @@
}
if (Beans.isPassivatingScope(ij.getBean(), beanManager) && (!ij.isTransient()) && !Beans.isPassivationCapableBean(resolvedBean))
{
+ if (resolvedBean.getScopeType().equals(Dependent.class) && resolvedBean instanceof AbstractProducerBean)
+ {
+ throw new IllegalProductException("The bean " + ij.getBean() + " declares a passivating scope but the producer returned a non-serializable bean for injection: " + resolvedBean);
+ }
throw new UnserializableDependencyException("The bean " + ij.getBean() + " declares a passivating scope but has non-serializable dependency: " + resolvedBean);
}
}
@@ -224,7 +229,7 @@
}
throw new UnsatisfiedResolutionException(buff.toString());
}
- }
+ }
private static boolean hasHigherPrecedence(Class<? extends Annotation> deploymentType, Class<? extends Annotation> otherDeploymentType, BeanManagerImpl manager)
{
More information about the weld-commits
mailing list