[jira] [Commented] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253559#comment-17253559 ] Gary D. Gregory commented on LANG-1544: --- The description needs a stack trace to make it easier for everyone to match up with exceptions in the wild. > 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: 2.5h > 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)
[jira] [Commented] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253134#comment-17253134 ] Michael Buck commented on LANG-1544: The issue seems to manifest itself when MethodUtils#getMatchingMethod() is called with one or more of the incoming parameterTypes as null and the target class to find the method has more than one method that is a possible candidate. This causes the private distance method to be invoked which causes the NPE. Please see PR [here|[http://example.com|https://github.com/apache/commons-lang/pull/680]]. > 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: 2h 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)
[jira] [Commented] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17228450#comment-17228450 ] Arturo Bernal commented on LANG-1544: - Hi [~RobertBudda] I have tried to reproduce the error but I can't. {code:java} @Test public void testMethodABG() throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException, ClassNotFoundException { Class c = Class.forName("org.apache.commons.lang3.builderClass1"); Object o = c.newInstance(); System.out.println(o); String value = (String) MethodUtils.invokeMethod(o, "testMethod"); System.out.println("Results from getValue: " + value); } class Class1 { public String testMethod() { return "ABG"; } }{code} > 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 40m > 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)
[jira] [Commented] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17208481#comment-17208481 ] Prabhakar Kumar Shah commented on LANG-1544: [~nagy_peter] Hi, could you provide a real code example which reproduces this issue? Though, I created a PR as a first good issue to fix, I am unable to reproduce this. So, I think this issue is invalid. > 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)
[jira] [Commented] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17160545#comment-17160545 ] Prabhakar Kumar Shah commented on LANG-1544: I have some knowledge to mend this issue. have created a PR, Please have a look. [~ggregory] [https://github.com/apache/commons-lang/pull/583|http://example.com] > 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: 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)
[jira] [Commented] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17125648#comment-17125648 ] Robert Konior commented on LANG-1544: - I'm a newbie also but Gary told to feel free with providing PR, so I do suppose you can do it without Jira assignment, jest done this according to these instructions [https://github.com/apache/commons-lang/blob/master/CONTRIBUTING.md] > 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 > > 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)
[jira] [Commented] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17125265#comment-17125265 ] Peter Nagy commented on LANG-1544: -- Hi Robert, Sorry, I am new here. I am afraid I have no rights to assign you this issue. I do not know either how to submit a fix, otherwise I would have been done it. I can only hope that somebody who is in charge will pick up this issue and extend the code with this tiny yet important modification. Best regards, Peter > 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 > > 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)
[jira] [Commented] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17125222#comment-17125222 ] Robert Konior commented on LANG-1544: - Nice, but can you assign this task? :) > 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 > > 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)
[jira] [Commented] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17124880#comment-17124880 ] Peter Nagy commented on LANG-1544: -- Dear Robert, if you ask me, you are welcome! :-) Best regards, Peter > 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 > > 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)
[jira] [Commented] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17121314#comment-17121314 ] Robert Konior commented on LANG-1544: - Can I do this ? :) > 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 > > 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)
[jira] [Commented] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=1733#comment-1733 ] Gary D. Gregory commented on LANG-1544: --- Hi [~nagy_peter] Please feel free to provide a PR on GitHub (with a test case.) > 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 > > 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)