Skip to content

Commit

Permalink
fix: Close opened input stream. (#20772) (#20775)
Browse files Browse the repository at this point in the history
ImageIO.read does not close
the input stream.
Close it after use.

Fixes #9364

Co-authored-by: caalador <[email protected]>
  • Loading branch information
vaadin-bot and caalador authored Dec 23, 2024
1 parent 5b821af commit cbd2033
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,9 @@ private BufferedImage getBaseImage(URL logo) throws IOException {
URLConnection logoResource = logo != null ? logo.openConnection()
: BootstrapHandler.class.getResource("default-logo.png")
.openConnection();
return ImageIO.read(logoResource.getInputStream());
try (InputStream inputStream = logoResource.getInputStream()) {
return ImageIO.read(inputStream);
}
}

/**
Expand Down

0 comments on commit cbd2033

Please sign in to comment.