You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2016/03/26 06:02:25 UTC

[jira] [Comment Edited] (GROOVY-7800) GroovyMBean does not extract target exception from RuntimeMBeanException

    [ https://issues.apache.org/jira/browse/GROOVY-7800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15211659#comment-15211659 ] 

Paul King edited comment on GROOVY-7800 at 3/26/16 5:02 AM:
------------------------------------------------------------

Without looking further into the details, your thinking sounds reasonable to me. Do you feel in a position to create a PR?


was (Author: paulk):
Without looking further into the details, your thinking sounds reasonable to me.

> GroovyMBean does not extract target exception from RuntimeMBeanException
> ------------------------------------------------------------------------
>
>                 Key: GROOVY-7800
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7800
>             Project: Groovy
>          Issue Type: Wish
>          Components: JMX
>    Affects Versions: 2.4.6
>            Reporter: Crazy Gambler
>            Priority: Minor
>
> Hello!
> I would like to get your thoughts on the behavior of {{GroovyMBean}} when handling exceptions.
> I am using Groovy to connect to MBeans written in Java. 
> MBeans may throw checked exceptions or unchecked exceptions. According to Java spec, checked exceptions are wrapped in {{[javax.management.MBeanException|http://docs.oracle.com/javase/7/docs/api/javax/management/MBeanException.html]}} whereas unchecked exceptions are wrapped in {{[javax.management.RuntimeMBeanException|https://docs.oracle.com/javase/7/docs/api/javax/management/RuntimeMBeanException.html]}}. Both the {{RuntimeMBeanException}} and {{MBeanException}} implement a {{getTargetException()}} method that allows you to access the original exception that was thrown in the MBean. 
> When I call an operation on my {{GroovyMBean}} which throws an {{MBeanException}}, the original exception is thrown. This is because the {{GroovyMBean}} implementation extracts the target exception from the {{MBeanException}} (https://github.com/groovy/groovy-core/blob/master/subprojects/groovy-jmx/src/main/java/groovy/util/GroovyMBean.java#L111)
> However, when I call an operation on my {{GroovyMBean}} which throws a {{RuntimeMBeanException}}, the wrapper {{RuntimeMBeanException}} is thrown. This is because the {{GroovyMBean}} implementation does not handle extracting the target exception from the {{RuntimeMBeanException}}. 
> This behavior seems inconsistent to me. I think the {{GroovyMBean}} should extract target exception from {{RuntimeMBeanException}} as well. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)