From: Adrian B. <ej...@us...> - 2004-04-19 23:17:26
|
User: ejort Date: 04/04/19 16:17:19 Modified: src/main/org/jboss/mx/server MBeanServerImpl.java Log: Correctly decode the MBeanExceptions thrown on registry invocations Revision Changes Path 1.61 +17 -8 jmx/src/main/org/jboss/mx/server/MBeanServerImpl.java Index: MBeanServerImpl.java =================================================================== RCS file: /cvsroot/jboss/jmx/src/main/org/jboss/mx/server/MBeanServerImpl.java,v retrieving revision 1.60 retrieving revision 1.61 diff -u -r1.60 -r1.61 --- MBeanServerImpl.java 17 Apr 2004 17:34:50 -0000 1.60 +++ MBeanServerImpl.java 19 Apr 2004 23:17:18 -0000 1.61 @@ -65,6 +65,7 @@ import org.jboss.mx.server.registry.MBeanEntry; import org.jboss.mx.server.registry.MBeanRegistry; import org.jboss.mx.service.ServiceConstants; +import org.jboss.mx.util.JMXExceptionDecoder; import org.jboss.mx.util.MBeanProxy; import org.jboss.mx.util.MBeanProxyCreationException; @@ -102,7 +103,7 @@ * @author <a href="mailto:tr...@pr...">Trevor Squires</a>. * @author <a href="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>. * @author <a href="mailto:tho...@jb...">Thomas Diesler</a>. - * @version $Revision: 1.60 $ + * @version $Revision: 1.61 $ */ public class MBeanServerImpl implements MBeanServer, ServerConstants, ServiceConstants, ModelMBeanConstants @@ -359,18 +360,22 @@ new Object[]{name}, new String[]{ObjectName.class.getName()}); } - catch (Exception e) + catch (Throwable t) { - JMException result = ExceptionHandler.handleException(e); + Throwable result = JMXExceptionDecoder.decode(t); if (result instanceof InstanceNotFoundException) throw (InstanceNotFoundException) result; if (result instanceof MBeanRegistrationException) throw (MBeanRegistrationException) result; + if (result instanceof RuntimeException) + throw (RuntimeException) result; + if (result instanceof Error) + throw (Error) result; // for some other reason, unregistration failed - throw new MBeanRegistrationException(e, "Cannot unregister MBean"); + throw new MBeanRegistrationException(new InvocationTargetException(t), "Cannot unregister MBean"); } - + // Unregistration worked, remove any proxies for a broadcaster if (mbean instanceof NotificationBroadcaster) listeners.remove(name); @@ -1139,18 +1144,22 @@ ObjectName.class.getName(), Map.class.getName()}); } - catch (Exception e) + catch (Throwable t) { - JMException result = ExceptionHandler.handleException(e); + Throwable result = JMXExceptionDecoder.decode(t); if (result instanceof InstanceAlreadyExistsException) throw (InstanceAlreadyExistsException) result; if (result instanceof MBeanRegistrationException) throw (MBeanRegistrationException) result; if (result instanceof NotCompliantMBeanException) throw (NotCompliantMBeanException) result; + if (result instanceof RuntimeException) + throw (RuntimeException) result; + if (result instanceof Error) + throw (Error) result; // for some other reason, registration failed - throw new MBeanRegistrationException(e, "Cannot register MBean"); + throw new MBeanRegistrationException(new InvocationTargetException(t), "Cannot register MBean"); } } |