aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/apache/commons/lang3/Functions.java
diff options
context:
space:
mode:
authorGary Gregory <garydgregory@gmail.com>2019-12-25 23:00:43 -0500
committerGary Gregory <garydgregory@gmail.com>2019-12-25 23:00:43 -0500
commit37442639705892348d2cd6d7717fff4d9841ca09 (patch)
tree25091c20987b6b7c79dc8c15d33c398236192c42 /src/main/java/org/apache/commons/lang3/Functions.java
parentff05749cdc68fae72f12fcb6e06d41a4528ea4b6 (diff)
downloadapache-commons-lang-37442639705892348d2cd6d7717fff4d9841ca09.tar.gz
Use Objects.requireNonNull() instead of custom check. Minor formatting.
Diffstat (limited to 'src/main/java/org/apache/commons/lang3/Functions.java')
-rw-r--r--src/main/java/org/apache/commons/lang3/Functions.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/org/apache/commons/lang3/Functions.java b/src/main/java/org/apache/commons/lang3/Functions.java
index db422ad16..2d0ca06b7 100644
--- a/src/main/java/org/apache/commons/lang3/Functions.java
+++ b/src/main/java/org/apache/commons/lang3/Functions.java
@@ -19,6 +19,7 @@ package org.apache.commons.lang3;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Objects;
import java.util.concurrent.Callable;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
@@ -433,10 +434,8 @@ public class Functions {
errorHandler = pErrorHandler;
}
if (pResources != null) {
- for (FailableRunnable<? extends Throwable> runnable : pResources) {
- if (runnable == null) {
- throw new NullPointerException("A resource action must not be null.");
- }
+ for (FailableRunnable<? extends Throwable> failableRunnable : pResources) {
+ Objects.requireNonNull(failableRunnable, "runnable");
}
}
Throwable th = null;
@@ -514,9 +513,8 @@ public class Functions {
* @return Never returns anything, this method never terminates normally.
*/
public static RuntimeException rethrow(Throwable pThrowable) {
- if (pThrowable == null) {
- throw new NullPointerException("The Throwable must not be null.");
- } else if (pThrowable instanceof RuntimeException) {
+ Objects.requireNonNull(pThrowable, "pThrowable");
+ if (pThrowable instanceof RuntimeException) {
throw (RuntimeException) pThrowable;
} else if (pThrowable instanceof Error) {
throw (Error) pThrowable;