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

jfisher pushed a commit to branch tomee-9.x
in repository https://gitbox.apache.org/repos/asf/tomee.git


The following commit(s) were added to refs/heads/tomee-9.x by this push:
     new 881db31a78 Close Tomee-4031 - attempt to use parameter names from 
reflection, which should fall back to arg0 syntax if information was not 
compiled in
     new 00a43122fc Merge pull request #1057 from 
exabrial/tomee-9/TOMEE-4031_improve-jmx-parameter-names
881db31a78 is described below

commit 881db31a78f25e6f4bc90fcd1a1a113f68b43e83
Author: Jonathan S. Fisher <exabr...@gmail.com>
AuthorDate: Fri Jun 9 09:23:04 2023 -0500

    Close Tomee-4031 - attempt to use parameter names from reflection, which 
should fall back to arg0 syntax if information was not compiled in
    
    (cherry picked from commit ea068b4e633e81ef730493521fe610ac7e801004)
    (cherry picked from commit 2f97531fdf950503bee08e9431ee10eb9d57d93e)
---
 .../java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java
index e52ce320dd..eb696d5d8e 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java
@@ -33,6 +33,7 @@ import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.lang.reflect.Parameter;
 import java.lang.reflect.Proxy;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -243,12 +244,12 @@ public class DynamicMBeanWrapper implements DynamicMBean, 
MBeanRegistration {
     private static MBeanParameterInfo[] methodSignature(final 
MBeanOperationInfo jvmInfo, final Method method) {
         final Class<?>[] classes = method.getParameterTypes();
         final Annotation[][] annots = method.getParameterAnnotations();
-        return parameters(jvmInfo, classes, annots);
+        return parameters(jvmInfo, classes, annots, method.getParameters());
     }
 
     static MBeanParameterInfo[] parameters(final MBeanOperationInfo jvmInfo,
                                            final Class<?>[] classes,
-                                           final Annotation[][] annots) {
+                                           final Annotation[][] annots, 
Parameter[] parameters) {
         final MBeanParameterInfo[] params =
             new MBeanParameterInfo[classes.length];
         assert classes.length == annots.length;
@@ -256,7 +257,7 @@ public class DynamicMBeanWrapper implements DynamicMBean, 
MBeanRegistration {
         String desc = "";
         for (int i = 0; i < classes.length; i++) {
             final Descriptor d = jvmInfo.getSignature()[i].getDescriptor();
-            final String pn = "arg" + i;
+            final String pn =  parameters[i].getName();
             for (final Annotation a : annots[i]) {
                 final Class<? extends Annotation> type = a.annotationType();
                 if (type.equals(Description.class) || 
type.equals(OPENEJB_API_TO_JAVAX.get(Description.class))) {

Reply via email to