Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions java/src/org/openqa/selenium/internal/Require.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,8 @@ public static int positive(String argName, Integer number, String message) {
throw new IllegalArgumentException(String.format(MUST_BE_SET, argName));
}
if (number <= 0) {
if (message == null) {
throw new IllegalArgumentException(String.format(MUST_BE_POSITIVE, argName));
} else {
throw new IllegalArgumentException(message);
}
throw new IllegalArgumentException(
Objects.requireNonNullElseGet(message, () -> String.format(MUST_BE_POSITIVE, argName)));
}
return number;
}
Expand All @@ -143,11 +140,8 @@ public static double positive(String argName, Double number, String message) {
throw new IllegalArgumentException(String.format(MUST_BE_SET, argName));
}
if (number <= 0) {
if (message == null) {
throw new IllegalArgumentException(String.format(MUST_BE_POSITIVE, argName));
} else {
throw new IllegalArgumentException(message);
}
throw new IllegalArgumentException(
Objects.requireNonNullElseGet(message, () -> String.format(MUST_BE_POSITIVE, argName)));
}
return number;
}
Expand Down
Loading