[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Bug in Microcontainer - Errors from DependencyInfo/Item

adrian@jboss.org do-not-reply at jboss.com
Mon Jul 14 07:36:25 EDT 2008


"alesj" wrote : 
  | 3) Currently not testing this:
  | 
  |   |          for (Method method : methods)
  |   |          {
  |   |             // Should we suppress this?
  |   |             if ("getLifecycleCallbacks".equals(method.getName()))
  |   |                continue;
  |   | 
  | If handleInstallLifecycleCallbacks throws exception ((in initial incrementState)) on DependencyInfo::getLifecycleCallbacks(), it gets caught, but re-thrown:
  | 
  |   |          boolean ok = incrementState(context, trace);
  |   |          if (ok)
  |   |          {
  |   |             try
  |   |             {
  |   |                registerControllerContext(context);
  |   |             }
  |   |             catch (Throwable t)
  |   |             {
  |   |                // This is probably unreachable? But let's be paranoid
  |   |                ok = false;
  |   |                throw t;
  |   |             }
  |   |          }
  |   |          if (ok)
  |   |          {
  |   |             resolveContexts(trace);
  |   |          }
  |   |          else
  |   |          {
  |   |             errorContexts.remove(context);
  |   |             throw context.getError();
  |   |          }
  |   | 
  | Should we add context-2-error-handling code to this method?

You need to write that test, but it looks to me that currently the case
is already handled since the handleInstallLifecycleCallbacks is in a try/catch block
that moves the context to the error state and then the code you show
removes it altogether and rethrows the error.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4164195#4164195

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4164195



More information about the jboss-dev-forums mailing list