This is an automated email from the ASF dual-hosted git repository.

ggrzybek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/main by this push:
     new 488d676f79 [KARAF-7550] Throw the actual target exception of 
InvocationTargetException in MBean invocation
     new 527e0e7778 Merge pull request #1620 from grgrzybek/KARAF-7550
488d676f79 is described below

commit 488d676f796ad3e3bb60818cc7d25edddf2b8576
Author: Grzegorz Grzybek <ggrzy...@redhat.com>
AuthorDate: Thu Sep 15 14:18:46 2022 +0200

    [KARAF-7550] Throw the actual target exception of InvocationTargetException 
in MBean invocation
---
 .../org/apache/karaf/management/internal/MBeanInvocationHandler.java  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git 
a/management/server/src/main/java/org/apache/karaf/management/internal/MBeanInvocationHandler.java
 
b/management/server/src/main/java/org/apache/karaf/management/internal/MBeanInvocationHandler.java
index 160720427c..a779a45902 100644
--- 
a/management/server/src/main/java/org/apache/karaf/management/internal/MBeanInvocationHandler.java
+++ 
b/management/server/src/main/java/org/apache/karaf/management/internal/MBeanInvocationHandler.java
@@ -73,6 +73,10 @@ public class MBeanInvocationHandler implements 
InvocationHandler {
             });
         } catch (Exception pae) {
             Throwable cause = pae.getCause();
+            if (cause instanceof InvocationTargetException
+                    && ((InvocationTargetException) 
cause).getTargetException() != null) {
+                cause = ((InvocationTargetException) 
cause).getTargetException();
+            }
             throw cause == null ? pae:cause;
         }
         

Reply via email to