[webbeans-commits] Webbeans SVN: r2345 - ri/trunk/impl/src/main/java/org/jboss/webbeans/context.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Wed Apr 8 09:22:03 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-04-08 09:22:02 -0400 (Wed, 08 Apr 2009)
New Revision: 2345

Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java
Log:
better exception

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java	2009-04-08 13:15:36 UTC (rev 2344)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java	2009-04-08 13:22:02 UTC (rev 2345)
@@ -72,6 +72,10 @@
       {
          throw new ContextNotActiveException();
       }
+      if (getBeanStore() == null)
+      {
+         throw new IllegalStateException("No bean store available");
+      }
       T instance = getBeanStore().get(contextual);
       if (instance != null)
       {
@@ -126,6 +130,10 @@
    private <T> void destroy(Contextual<T> bean)
    {
       log.trace("Destroying " + bean);
+      if (getBeanStore() == null)
+      {
+         throw new IllegalStateException("No bean store available");
+      }
       bean.destroy(getBeanStore().get(bean));
    }
 
@@ -135,6 +143,10 @@
    public void destroy()
    {
       log.trace("Destroying context");
+      if (getBeanStore() == null)
+      {
+         throw new IllegalStateException("No bean store available");
+      }
       for (Contextual<? extends Object> bean : getBeanStore().getBeans())
       {
          destroy(bean);




More information about the weld-commits mailing list