You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/06/15 11:50:15 UTC

[commons-io] branch master updated: Use Objects.requireNonNull()

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


The following commit(s) were added to refs/heads/master by this push:
     new e2ddf45a Use Objects.requireNonNull()
e2ddf45a is described below

commit e2ddf45aa76ddfc05a6b54bb50714dcb98dc8fba
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jun 15 07:49:55 2022 -0400

    Use Objects.requireNonNull()
---
 .../org/apache/commons/io/monitor/FileAlterationObserver.java    | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java b/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
index fe711b21..3c87435d 100644
--- a/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
+++ b/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
@@ -22,6 +22,7 @@ import java.io.Serializable;
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Objects;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.apache.commons.io.FileUtils;
@@ -166,12 +167,8 @@ public class FileAlterationObserver implements Serializable {
      * @param ioCase what case sensitivity to use comparing file names, null means system sensitive
      */
     protected FileAlterationObserver(final FileEntry rootEntry, final FileFilter fileFilter, final IOCase ioCase) {
-        if (rootEntry == null) {
-            throw new IllegalArgumentException("Root entry is missing");
-        }
-        if (rootEntry.getFile() == null) {
-            throw new IllegalArgumentException("Root directory is missing");
-        }
+        Objects.requireNonNull(rootEntry, "rootEntry");
+        Objects.requireNonNull(rootEntry.getFile(), "rootEntry.getFile()");
         this.rootEntry = rootEntry;
         this.fileFilter = fileFilter;
         switch (IOCase.value(ioCase, IOCase.SYSTEM)) {