Skip to content

Commit

Permalink
Merge pull request #104 from upserve/file_descriptor_leak
Browse files Browse the repository at this point in the history
Fix file descriptor leak in Files.list method. Stream must be closed.
  • Loading branch information
dstuebe authored Aug 26, 2019
2 parents 8515f69 + 6289f63 commit 7d8e6fa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/com/upserve/uppend/FileStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ T getOrCreate(String partitionEntropy) {
}

Stream<T> streamPartitions() {
try {
Files
.list(partitionsDir)
try (Stream<Path> stream = Files.list(partitionsDir)){
stream
.map(path -> path.toFile().getName())
.forEach(partition -> partitionMap.computeIfAbsent(
partition,
Expand Down

0 comments on commit 7d8e6fa

Please sign in to comment.