summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorHector Caballero <hector.caballero@ericsson.com>2018-09-04 11:15:44 -0400
committerHector Caballero <hector.caballero@ericsson.com>2018-09-05 06:59:51 -0400
commitb7351facd51aa8e14d4bd2e74e3f4f0b57c55f6f (patch)
tree442939fcb109f069537b09307f6635855176fbb6 /org.eclipse.jgit
parentaf547cf00d79f1233464aadb76ad381be7f8887f (diff)
downloadjgit-b7351facd51aa8e14d4bd2e74e3f4f0b57c55f6f.tar.gz
jgit-b7351facd51aa8e14d4bd2e74e3f4f0b57c55f6f.zip
GC: Avoid logging errors when deleting non-empty folders
I88304d34c and Ia555bce00 modified the way errors are handled when trying to delete non-empty reference folders. Before, this error was silently ignored as it was considered an expected output. Now, every failed folder delete is logged which can be noisy. Ignore the DirectoryNotEmptyException but log any other error avoiding deletion of an eligible folder. Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com> Change-Id: I194512f67885231d62c03976ae683e5cc450ec7c
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
index e4b0a46a30..a4a2baa55b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
@@ -54,6 +54,7 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
+import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -909,6 +910,8 @@ public class GC {
private void delete(Path d) {
try {
Files.delete(d);
+ } catch (DirectoryNotEmptyException e) {
+ // Don't log
} catch (IOException e) {
LOG.error(MessageFormat.format(JGitText.get().cannotDeleteFile, d),
e);