Skip to content

Commit

Permalink
Merge pull request #441 from dbmdz/turbojegreader-close
Browse files Browse the repository at this point in the history
ImageServiceImpl: Close ImageInputStream once we're done
  • Loading branch information
schmika authored Jun 21, 2024
2 parents 3c27aaa + aaed1f5 commit 85ee4a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### Fixed
- Fixed bug in `ImageServiceImpl` where `ImageInputStreams` were not properly closed after processing

## [5.1.12] - 2024-05-08
### Fixed
- Updates ImageIO version to fix JPEG decoding from TIFFs with newer turbojpeg versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ public void readImageInfo(
} finally {
metrics.clearTimer(metricKey);
if (r != null) {
if (r.getInput() instanceof ImageInputStream) {
((ImageInputStream) r.getInput()).close();
}
r.dispose();
}
}
Expand Down Expand Up @@ -343,6 +346,9 @@ private DecodedImage readImage(
} finally {
metrics.clearTimer(metricKey);
if (reader != null) {
if (reader.getInput() instanceof ImageInputStream) {
((ImageInputStream) reader.getInput()).close();
}
reader.dispose();
}
}
Expand Down

0 comments on commit 85ee4a4

Please sign in to comment.