[
https://issues.apache.org/jira/browse/DELTASPIKE-1207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15580487#comment-15580487
]
Falko Modler commented on DELTASPIKE-1207:
------------------------------------------
I committed the change in my fork:
https://github.com/famod/deltaspike/commit/0bd61f2fa4d2c08b7554d5f2826b9c99cad8e7a6
I will create a pull request after my tests on JBoss EAP 6.4.10.
> 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)