Skip to content

Commit 1c80349

Browse files
fix: close image input stream
1 parent 0b45439 commit 1c80349

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plugin/src/main/java/io/snyk/eclipse/plugin/utils/ResourceUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public static String getBase64Image(Bundle bundle, String icon) {
4242
}
4343

4444
private static byte[] getImageDataFromUrl(URL imageUrl) {
45-
try {
46-
ByteArrayOutputStream output = new ByteArrayOutputStream();
47-
imageUrl.openStream().transferTo(output);
45+
try (final var openStream = imageUrl.openStream()) {
46+
ByteArrayOutputStream output = new ByteArrayOutputStream();
47+
openStream.transferTo(output);
4848
return output.toByteArray();
4949
} catch (Exception e) {
5050
SnykLogger.logError(e);

0 commit comments

Comments
 (0)