[
https://issues.apache.org/jira/browse/LANG-1544?focusedWorklogId=461191&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-461191
]
ASF GitHub Bot logged work on LANG-1544:
----------------------------------------
Author: ASF GitHub Bot
Created on: 20/Jul/20 17:54
Start Date: 20/Jul/20 17:54
Worklog Time Spent: 10m
Work Description: garydgregory commented on pull request #583:
URL: https://github.com/apache/commons-lang/pull/583#issuecomment-661241475
Hi @pixelr
After looking again, I'm not sure this PR makes sense. The test you patched
calls a private method, and this private method is not going to be called with
just any value. In this case, the private method `distance` is only called from
`MethodUtils.getMatchingMethod(Class<?>, String, Class<?>...)` where our
`getMatchingMethod` calls `java.lang.reflect.Method.getParameterTypes()`.
Do you have a case where
`java.lang.reflect.Method.getParameterTypes()`returns an array containing a
null? Can you show this by calling a public method like
`org.apache.commons.lang3.reflect.MethodUtils.getMatchingMethod(Class<?>,
String, Class<?>...)`?
Otherwise, this PR just make the `distance` method more complicated than it
has to be, granted not by much, but there would then be no sense if making the
whole code base more NPE proof where it does not need to be.
Let us know your findings.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 461191)
Time Spent: 1h 10m (was: 1h)
> MethodUtils.invokeMethod NullPointerException in case of null in args list
> --------------------------------------------------------------------------
>
> Key: LANG-1544
> URL: https://issues.apache.org/jira/browse/LANG-1544
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.reflect.*
> Affects Versions: 3.10
> Reporter: Peter Nagy
> Priority: Critical
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> MethodUtils:774
>
> if (classArray[offset].equals(toClassArray[offset])) {
> continue;
> } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset],
> true)
>
> cause NPE if classArray[offset] is null. Can you please extend the if
> condition with a null check, like this?
>
> if (classArray[offset] != null &&
> classArray[offset].equals(toClassArray[offset]))
--
This message was sent by Atlassian Jira
(v8.3.4#803005)