You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/04/06 13:04:53 UTC

[GitHub] [commons-lang] garydgregory commented on a diff in pull request #874: Add early null check MethodUtils.

garydgregory commented on code in PR #874:
URL: https://github.com/apache/commons-lang/pull/874#discussion_r843925331


##########
src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java:
##########
@@ -327,6 +327,7 @@ public static Object invokeExactMethod(final Object object, final String methodN
     public static Object invokeExactMethod(final Object object, final String methodName, Object[] args, Class<?>[] parameterTypes)
         throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
         Objects.requireNonNull(object, "object");
+        Objects.requireNonNull(object, "methodName");

Review Comment:
   -1 You lose the better exception message below, specifically, you lose the class name. Follow the code path and you'll see that `getAccessibleMethod()` returns null if the `methodName` is null.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org