Repository: curator Updated Branches: refs/heads/CURATOR-411 a0ab8772c -> d4f15297d
changed exceptions to logging. This is test code Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/9403703a Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/9403703a Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/9403703a Branch: refs/heads/CURATOR-411 Commit: 9403703ad94d6d2e54d4cf393a24affab130f2d1 Parents: a0ab877 Author: randgalt <[email protected]> Authored: Sun May 28 09:10:16 2017 -0500 Committer: randgalt <[email protected]> Committed: Sun May 28 09:10:16 2017 -0500 ---------------------------------------------------------------------- .../main/java/org/apache/curator/test/DirectoryUtils.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/9403703a/curator-test/src/main/java/org/apache/curator/test/DirectoryUtils.java ---------------------------------------------------------------------- diff --git a/curator-test/src/main/java/org/apache/curator/test/DirectoryUtils.java b/curator-test/src/main/java/org/apache/curator/test/DirectoryUtils.java index 9f00dd1..134aa5f 100644 --- a/curator-test/src/main/java/org/apache/curator/test/DirectoryUtils.java +++ b/curator-test/src/main/java/org/apache/curator/test/DirectoryUtils.java @@ -19,20 +19,25 @@ package org.apache.curator.test; import com.google.common.base.Preconditions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; // copied from Google Guava as these methods are now deprecated // NOTE: removed the line of code documented: Symbolic links will have different canonical and absolute paths +// Update May 28, 2017 - change exception into logs public class DirectoryUtils { + private static final Logger log = LoggerFactory.getLogger(DirectoryUtils.class); + public static void deleteRecursively(File file) throws IOException { if (file.isDirectory()) { deleteDirectoryContents(file); } if (!file.delete()) { - throw new IOException("Failed to delete " + file); + log.error("Failed to delete " + file); } } @@ -42,7 +47,8 @@ public class DirectoryUtils "Not a directory: %s", directory); File[] files = directory.listFiles(); if (files == null) { - throw new IOException("Error listing files for " + directory); + log.warn("directory.listFiles() returned null for: " + directory); + return; } for (File file : files) { deleteRecursively(file);
