Skip to content

Commit 3e547a3

Browse files
fix: close image input stream (#271)
* fix: close image input stream * Remove extra whitespace in ResourceUtils.java --------- Co-authored-by: Andrew Robinson Hodges <andrew.robinsonhodges@snyk.io>
1 parent 0b45439 commit 3e547a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 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 {
45+
try (final var openStream = imageUrl.openStream()) {
4646
ByteArrayOutputStream output = new ByteArrayOutputStream();
47-
imageUrl.openStream().transferTo(output);
47+
openStream.transferTo(output);
4848
return output.toByteArray();
4949
} catch (Exception e) {
5050
SnykLogger.logError(e);

0 commit comments

Comments
 (0)