ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [2/2] ant git commit: Java8 refactoring removed not-null guard
Date Wed, 14 Feb 2018 13:31:48 GMT
Java8 refactoring removed not-null guard


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/9873bf6c
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/9873bf6c
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/9873bf6c

Branch: refs/heads/master
Commit: 9873bf6c8ae3fdd2cebe5c6083b6265827142b1c
Parents: 3721095
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Wed Feb 14 14:31:03 2018 +0100
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Wed Feb 14 14:31:03 2018 +0100

----------------------------------------------------------------------
 src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java    | 5 ++++-
 .../tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java      | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/9873bf6c/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index 9aa1b49..3e36a2f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -34,6 +34,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.Vector;
@@ -1009,7 +1010,9 @@ public class FTP extends Task implements FTPTaskConfig {
                 Predicate<String> test =
                     isCaseSensitive() ? lastpathelement::equals
                         : lastpathelement::equalsIgnoreCase;
-                return Stream.of(theFiles).filter(f -> test.test(f.getName()))
+                return Stream.of(theFiles)
+                    .filter(Objects::nonNull)
+                    .filter(f -> test.test(f.getName()))
                     .findFirst().orElse(null);
             }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/9873bf6c/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
index 2ad81db..3bff2d9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
@@ -33,6 +33,7 @@ import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.Vector;
@@ -913,7 +914,9 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror {
                 Predicate<String> test =
                     isCaseSensitive() ? lastpathelement::equals
                         : lastpathelement::equalsIgnoreCase;
-                return Stream.of(theFiles).filter(f -> test.test(f.getName()))
+                return Stream.of(theFiles)
+                    .filter(Objects::nonNull)
+                    .filter(f -> test.test(f.getName()))
                     .findFirst().orElse(null);
             }
 


Mime
View raw message