Skip to content

Commit

Permalink
Merge pull request #707 from bbpennel/fix-cache-purge-leak-develop
Browse files Browse the repository at this point in the history
Prevent file handle leak during individual purge
  • Loading branch information
DiegoPino authored Nov 6, 2024
2 parents b9d6bae + 43c461d commit 0dccf29
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ Set<Path> getDerivativeImageFiles(Identifier identifier)
hashedPathFragment(identifier.toString()));
final String expectedNamePrefix =
StringUtils.md5(identifier.toString());
try {
return Files.list(cachePath)
try (final var fileStream = Files.list(cachePath)) {
return fileStream
.filter(p -> p.getFileName().toString().startsWith(expectedNamePrefix))
.collect(Collectors.toUnmodifiableSet());
} catch (NoSuchFileException e) {
Expand Down

0 comments on commit 0dccf29

Please sign in to comment.