robotframework / JavalibCore

Base for implementing Java test libraries to be used with Robot Framework
Other
42 stars 25 forks source link

Passing ${None} to a Java keyword fails with a NPE #17

Open ntdaley opened 9 years ago

ntdaley commented 9 years ago

In an older version of Robotframework that my company was previously using, we were able to pass ${None} in to Java keywords, and the keyword would get null. After upgrading to the current version, this fails with a NullPointerException. (Stacktrace shown below)

It looks like my build environment is using JavalibCore 1.2

There appears to be a pull-request already containing a fix for this: https://github.com/robotframework/JavalibCore/pull/15

java.lang.RuntimeException: 
    at org.robotframework.javalib.reflection.KeywordInvoker.invoke(KeywordInvoker.java:52)
    at org.robotframework.javalib.beans.annotation.AnnotationKeywordExtractor$1.execute(AnnotationKeywordExtractor.java:62)
    at org.robotframework.javalib.library.KeywordFactoryBasedLibrary.runKeyword(KeywordFactoryBasedLibrary.java:37)
    at org.robotframework.javalib.library.AnnotationLibrary.runKeyword(AnnotationLibrary.java:128)
    at robot.model.testcase$py.visit$7(/Users/jmalinen/Documents/workspace/robotframework/tmp-jar-dir/Lib/robot/model/testcase.py:64)
    at robot.model.testcase$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/tmp-jar-dir/Lib/robot/model/testcase.py)
    at robot.model.itemlist$py.visit$10(/Users/jmalinen/Documents/workspace/robotframework/tmp-jar-dir/Lib/robot/model/itemlist.py:58)
    at robot.model.itemlist$py.call_function(/Users/jmalinen/Documents/workspace/robotframework/tmp-jar-dir/Lib/robot/model/itemlist.py)
    ...
Caused by: java.lang.NullPointerException
    at org.robotframework.javalib.reflection.ArgumentConverter.isArrayArgument(ArgumentConverter.java:44)
    at org.robotframework.javalib.reflection.ArgumentConverter.internalConvert(ArgumentConverter.java:26)
    at org.robotframework.javalib.reflection.ArgumentConverter.convertArguments(ArgumentConverter.java:16)
    at org.robotframework.javalib.reflection.KeywordInvoker.invoke(KeywordInvoker.java:49)
    ... 310 more
pekkaklarck commented 9 years ago

Thanks for submitting an issue. It seems we have somehow missed PR #15. @jussimalinen is currently on holiday, but I hope he has time to look at this when he's back.

ntdaley commented 8 years ago

Any news on this?

Soothsilver commented 6 years ago

I don't think PR #15 is going to be enough to solve this.

I'm getting a null pointer exception also at ArgumentGrouper.java at line 48 (where ungroupedArguments[i] is a null).

Hi-Fi commented 4 years ago

ArgumentConverter is removed at #24, but has to check that new ArgumentCollector handles $(None)/null as should.