aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java26
1 files changed, 13 insertions, 13 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 c1fbe65de8..6df09fbb32 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
@@ -967,19 +967,19 @@ public class GC {
private void deleteTempPacksIdx() {
Path packDir = repo.getObjectDatabase().getPackDirectory().toPath();
Instant threshold = Instant.now().minus(1, ChronoUnit.DAYS);
- try {
- Files.newDirectoryStream(packDir, "gc_*_tmp") //$NON-NLS-1$
- .forEach(t -> {
- try {
- Instant lastModified = Files.getLastModifiedTime(t)
- .toInstant();
- if (lastModified.isBefore(threshold)) {
- Files.deleteIfExists(t);
- }
- } catch (IOException e) {
- LOG.error(e.getMessage(), e);
- }
- });
+ try (DirectoryStream<Path> stream =
+ Files.newDirectoryStream(packDir, "gc_*_tmp")) { //$NON-NLS-1$
+ stream.forEach(t -> {
+ try {
+ Instant lastModified = Files.getLastModifiedTime(t)
+ .toInstant();
+ if (lastModified.isBefore(threshold)) {
+ Files.deleteIfExists(t);
+ }
+ } catch (IOException e) {
+ LOG.error(e.getMessage(), e);
+ }
+ });
} catch (IOException e) {
LOG.error(e.getMessage(), e);
}