diff --git a/src/main/java/de/thm/arsnova/ImageUtils.java b/src/main/java/de/thm/arsnova/ImageUtils.java index 111e6c1f09df79cf9809ab8707c8a7f87e7caf5f..51af7e112f02efd2b46077d799bfa8560f54b194 100644 --- a/src/main/java/de/thm/arsnova/ImageUtils.java +++ b/src/main/java/de/thm/arsnova/ImageUtils.java @@ -230,11 +230,9 @@ public class ImageUtils { * @return The <code>byte[]</code> of the image on success, otherwise <code>null</code>. */ byte[] convertFileToByteArray(final String imageUrl) { - try { - final URL url = new URL(imageUrl); + try (InputStream is = new URL(imageUrl).openStream()) { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - final InputStream is = url.openStream(); final byte[] byteChunk = new byte[CHUNK_SIZE]; int n;