Github user bowenli86 commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4907#discussion_r147121427
  
    --- 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 --
    
    Make sense. Thanks for the explanation!


---

Reply via email to