Github user mswit-databricks commented on a diff in the pull request: https://github.com/apache/spark/pull/21390#discussion_r189857237 --- Diff: common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java --- @@ -157,10 +172,10 @@ private static void deleteRecursivelyUsingUnixNative(File file) throws IOExcepti } } - private static File[] listFilesSafely(File file) throws IOException { + private static File[] listFilesSafely(File file, FilenameFilter filter) throws IOException { if (file.exists()) { - File[] files = file.listFiles(); - if (files == null) { + File[] files = file.listFiles(filter); + if (files == null && filter == null) { --- End diff -- Are you sure that `lisFiles(FileFilter filter)` (with a non-null filter) returns a null when there are no hits? The documentation isn't clear, but if it was to be consistent with the zero-parameter `listFiles()`, it would return an empty array. null should be reserved for errors.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org