Github user StephanEwen commented on a diff in the pull request: https://github.com/apache/flink/pull/4907#discussion_r147092074 --- Diff: flink-core/src/main/java/org/apache/flink/util/FileUtils.java --- @@ -243,11 +245,19 @@ else if (directory.exists()) { * @throws IOException if the delete operation fails */ public static boolean deletePathIfEmpty(FileSystem fileSystem, Path path) throws IOException { - FileStatus[] fileStatuses = null; + final FileStatus[] fileStatuses; try { fileStatuses = fileSystem.listStatus(path); - } catch (Exception ignored) {} + } + catch (FileNotFoundException e) { + // path already deleted + return true; + } + catch (Exception e) { + // could not access directory, cannot delete --- End diff -- I have heard often that logging in utility functions is usually not advised, because the utility cannot decide whether it is actually a problem or not. Logging in utilities often leads to hard to log pollution. Logging should happen in the caller of the utility, which can interpret the context and whether it is actually a problem. If the caller calls a utility that does not report problems properly (a silent utility function), then its the wrong utility for the caller.
---