summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Milanesio <luca.milanesio@gmail.com>2018-07-07 23:09:36 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2018-07-26 01:02:42 +0200
commiteea9a7a0ba1e0e065c9a0fd01f0210bc2cc74068 (patch)
treee35c1c8f1350efd2b42ae0238295032b96fd092a
parent4eea4ea508900c35b2f200d36e3342b8198a8026 (diff)
downloadjgit-eea9a7a0ba1e0e065c9a0fd01f0210bc2cc74068.tar.gz
jgit-eea9a7a0ba1e0e065c9a0fd01f0210bc2cc74068.zip
Use java.nio to delete path to get detailed errors
Get the full IOException of the reason why a directory cannot be removed during GC. Change-Id: Ia555bce009fa48087a73d677f1ce3b9c0b685b57 Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java10
1 files changed, 5 insertions, 5 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 55d0751247..eb5c1db50e 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
@@ -884,7 +884,7 @@ public class GC {
}
private void deleteEmptyRefsFolders() throws IOException {
- Path refs = repo.getDirectory().toPath().resolve("refs"); //$NON-NLS-1$
+ Path refs = repo.getDirectory().toPath().resolve(Constants.R_REFS);
try (Stream<Path> entries = Files.list(refs)) {
Iterator<Path> iterator = entries.iterator();
while (iterator.hasNext()) {
@@ -908,7 +908,7 @@ public class GC {
return p.toFile().isDirectory();
}
- private boolean delete(Path d) {
+ private void delete(Path d) {
try {
// Avoid deleting a folder that was just created so that concurrent
// operations trying to create a reference are not impacted
@@ -918,12 +918,12 @@ public class GC {
// If the folder is not empty, the delete operation will fail
// silently. This is a cheaper alternative to filtering the
// stream in the calling method.
- return d.toFile().delete();
+ Files.delete(d);
}
} catch (IOException e) {
- LOG.error(e.getMessage(), e);
+ LOG.error(MessageFormat.format(JGitText.get().cannotDeleteFile, d),
+ e);
}
- return false;
}
/**