Skip to content

Commit

Permalink
Updated IllegalArgumentException to NullPointerException for Null Val…
Browse files Browse the repository at this point in the history
…ues in Require Class (#11162)

* Update Require.java

Update IllegealStateException to NullPointerException as the exception misleads in debugging.

* Update Require.java

* Update Require.java

* Update Require.java

Co-authored-by: Diego Molina <[email protected]>
  • Loading branch information
vinoth959 and diemol committed Oct 26, 2022
1 parent 851cb0d commit baba6d1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions java/src/org/openqa/selenium/internal/Require.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ public static int positive(String argName, Integer number, String message) {
}

public static double positive(String argName, Double number, String message) {
if (number == null) {
throw new IllegalArgumentException(String.format(MUST_BE_SET, argName));
}
if (number <= 0) {
if (message == null) {
throw new IllegalArgumentException(String.format(MUST_BE_POSITIVE, argName));
Expand Down

0 comments on commit baba6d1

Please sign in to comment.