deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject [3/3] deltaspike git commit: DELTASPIKE-823 improved error message
Date Wed, 18 Feb 2015 10:09:23 GMT
DELTASPIKE-823 improved error message


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/2bc579c5
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/2bc579c5
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/2bc579c5

Branch: refs/heads/master
Commit: 2bc579c589963fa53483e00b8049f274c5d01fbc
Parents: 703d94b
Author: gpetracek <gpetracek@apache.org>
Authored: Wed Feb 18 10:32:05 2015 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Wed Feb 18 10:32:05 2015 +0100

----------------------------------------------------------------------
 .../partialbean/impl/PartialBeanLifecycle.java  | 26 +++++++++++++++++---
 1 file changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2bc579c5/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java
b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java
index 3429081..9d2a229 100644
--- a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java
+++ b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java
@@ -22,13 +22,15 @@ import org.apache.deltaspike.core.util.ExceptionUtils;
 import org.apache.deltaspike.core.util.metadata.builder.ContextualLifecycle;
 
 import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionTarget;
 import java.lang.reflect.InvocationHandler;
 import java.util.Set;
 import javax.enterprise.context.Dependent;
 import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.PassivationCapable;
+
 import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
 
@@ -103,7 +105,23 @@ class PartialBeanLifecycle<T, H extends InvocationHandler> implements
Contextual
         
         if (handlerBeans.size() != 1)
         {
-            throw new IllegalStateException(handlerBeans.size() + " beans found for " + this.handlerClass);
+            StringBuilder beanInfo = new StringBuilder();
+            for (Bean<H> bean : handlerBeans)
+            {
+                if (beanInfo.length() != 0)
+                {
+                    beanInfo.append(", ");
+                }
+                beanInfo.append(bean);
+
+                if (bean instanceof PassivationCapable)
+                {
+                    beanInfo.append(" bean-id: ").append(((PassivationCapable)bean).getId());
+                }
+            }
+
+            throw new IllegalStateException(handlerBeans.size() + " beans found for " + this.handlerClass
+
+                " found beans: " + beanInfo.toString());
         }
 
         Bean<H> handlerBean = handlerBeans.iterator().next();


Mime
View raw message