8156226: DiagnosticCommandImpl::invoke throws not very comprehensive message in case if method exists but signature or parameters are wrong
Reviewed-by: mchung, dholmes, dfuchs
--- a/jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java Wed Jun 15 11:24:12 2016 +0300
+++ b/jdk/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) {