Author: pete.muir(a)jboss.org
Date: 2009-10-28 12:42:55 -0400 (Wed, 28 Oct 2009)
New Revision: 4356
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletHelper.java
Log:
Better error messages
Modified: core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletHelper.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletHelper.java 2009-10-27
18:59:53 UTC (rev 4355)
+++ core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletHelper.java 2009-10-28
16:42:55 UTC (rev 4356)
@@ -34,10 +34,16 @@
{
if (ctx == null)
{
- throw new IllegalArgumentException("Must provide the Servlet
Context");
+ throw new IllegalArgumentException("ServletContext is null");
}
BeanDeploymentArchive beanDeploymentArchive =
Container.instance().deploymentServices().get(ServletServices.class).getBeanDeploymentArchive(ctx);
- return
Container.instance().beanDeploymentArchives().get(beanDeploymentArchive).getCurrent();
+ BeanManagerImpl beanManagerImpl =
Container.instance().beanDeploymentArchives().get(beanDeploymentArchive);
+ if (beanManagerImpl == null)
+ {
+ throw new IllegalArgumentException("Unable to find BeanManager.
BeanDeploymentArchive: " + beanDeploymentArchive + "; ServletContext: " +
ctx);
+ }
+ // Actually we need the manager for the current activity
+ return beanManagerImpl.getCurrent();
}
}
Show replies by date