question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

passing null value as parameter throws "java.lang.IllegalArgumentException"

See original GitHub issue

I’ve requirement to check null value for a parameter and this is how I’m passing it

given().
               contentType("application/json").
               pathParam("NI", 3000).
               pathParam("DP", null).

but this code throws error

java.lang.IllegalArgumentException: parameterValue cannot be null

related issue https://github.com/rest-assured/rest-assured/issues/631

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
johanhalebycommented, Nov 28, 2017

So use queryParam instead

Like you just did, don’t use pathParam when you mean queryParam. Also "null" is a string, you probably want to use an empty string (“”) or no value at all (e.g. queryParam("downPayment"))

1reaction
johanhalebycommented, Nov 23, 2017

What do you mean by “check null value”? You cannot pass “null” as a path parameter. It doesn’t make sense, perhaps you mean an empty string?

Read more comments on GitHub >

github_iconTop Results From Across the Web

IllegalArgumentException or NullPointerException for a null ...
If a caller passes null in some parameter for which null values are prohibited, convention dictates that NullPointerException be thrown rather than ...
Read more >
IllegalArgumentException or NullPointerException ... - Baeldung
When we read the Javadoc for IllegalArgumentException, it says it's for use when an illegal or inappropriate value is passed to a method....
Read more >
[Solved] java.lang.IllegalArgumentException in Java
For example, if the method requires a non-empty String as a parameter but we pass the input string as null then the java.lang.IllegalArgumentException...
Read more >
Can not pass null value to the argument when us... - JBoss.org
We have EJB functions where some values passed in can be null but when we ... IllegalArgumentException: null 'value' arg in method call....
Read more >
ArgumentNullException - Agi
The exception that is thrown when a null reference is passed to a method that does not accept it as a valid argument....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found