changeset 14948:886791e5b3a8

8156226: DiagnosticCommandImpl::invoke throws not very comprehensive message in case if method exists but signature or parameters are wrong Reviewed-by: mchung, dholmes, dfuchs
author kzhaldyb
date Wed, 15 Jun 2016 20:43:53 +0300
parents a32018537986
children 28f7ea8a0f01 33a7d3b3bc64
files src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java	Wed Jun 15 11:24:12 2016 +0300
+++ b/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java	Wed Jun 15 20:43:53 2016 +0300
@@ -259,9 +259,20 @@
                     && signature[0] != null
                     && signature[0].compareTo(strArrayClassName) == 0)) {
                 return w.execute((String[]) params[0]);
+            } else {
+                throw new ReflectionException(
+                    new NoSuchMethodException(actionName
+                    + ": mismatched signature "
+                    + (signature != null ? Arrays.toString(signature) : "[]")
+                    + " or parameters"));
             }
+        } else {
+            throw new ReflectionException(
+                new NoSuchMethodException("Method " + actionName
+                + " with signature "
+                + (signature != null ? Arrays.toString(signature) : "[]")
+                + " not found"));
         }
-        throw new ReflectionException(new NoSuchMethodException(actionName));
     }
 
     private static String transform(String name) {