Use Objects.requireNonNull()
diff --git a/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java b/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java
index 2cfb561..754d3b7 100644
--- a/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java
+++ b/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java
@@ -18,6 +18,8 @@
package org.apache.commons.exec;
+import java.util.Objects;
+
import org.apache.commons.exec.util.DebugUtils;
/**
@@ -104,9 +106,7 @@
* if a process is still being monitored.
*/
public synchronized void start(final Process processToMonitor) {
- if (processToMonitor == null) {
- throw new NullPointerException("process is null.");
- }
+ Objects.requireNonNull(processToMonitor, "processToMonitor");
if (this.process != null) {
throw new IllegalStateException("Already running.");
}