Falko Modler created DELTASPIKE-1207: ----------------------------------------
Summary: Incorrect exception handling in DynamicMBeanWrapper.invoke() Key: DELTASPIKE-1207 URL: https://issues.apache.org/jira/browse/DELTASPIKE-1207 Project: DeltaSpike Issue Type: Bug Components: Core Affects Versions: 1.7.1 Reporter: Falko Modler {{DynamicMBeanWrapper.invoke(String, Object[], String[])}} just re-throws any exception as a {{RuntimeException}}. This makes it impossible for a client to determine the specific exception which might have been thrown on purpose by the MBean method. See also: {code:java|title=JavaDoc of javax.management.DynamicMBean.invoke(String, Object[], String[])} ... * @exception MBeanException Wraps a <CODE>java.lang.Exception</CODE> thrown by the MBean's invoked method. * @exception ReflectionException Wraps a <CODE>java.lang.Exception</CODE> thrown while trying to invoke the method */ public Object invoke(String actionName, Object params[], String signature[]) throws MBeanException, ReflectionException ; {code} So the correct approach is to handle {{InvocationTargetException}} specifically by wrapping it's *cause* in a {{MBeanException}} and throwing that {{MBeanException}}. All other exceptions should be wrapped in a {{ReflectionException}}. PS: I filed DELTASPIKE-984 some time ago which led to a slight improvement of the very same {{invoke}} method but obviously my suggestions regarding {{MBeanException}} haven't been considered (I don't know why). -- This message was sent by Atlassian JIRA (v6.3.4#6332)