From a6ca4f10e1a4ea4d350105a681cae3b3fb67d316 Mon Sep 17 00:00:00 2001 From: Xiaomin Date: Tue, 11 Apr 2017 15:45:57 +0800 Subject: [PATCH] KITE-1155 Deleting an already deleted empty path should not fail the job --- .../org/kitesdk/data/spi/filesystem/FileSystemUtil.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemUtil.java b/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemUtil.java index ac8ce8fe55..251f329a24 100644 --- a/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemUtil.java +++ b/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemUtil.java @@ -21,6 +21,7 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import java.io.IOException; +import java.io.FileNotFoundException; import java.net.URI; import java.util.Collection; import java.util.List; @@ -239,7 +240,12 @@ private static boolean cleanlyDelete(FileSystem fs, Path root, Path path, boolea if (stats == null || stats.length == 0) { // dir is empty and should be removed LOG.debug("Deleting empty path {}", current); - deleted = fs.delete(current, true) || deleted; + try{ + deleted = fs.delete(current, true) || deleted; + } + catch(FileNotFoundException ex){ + // safely ignored, since anther job just deleted this directory + } } else { // all parent directories will be non-empty break;