Author: pete.muir(a)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);
Show replies by date