mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 12:39:05 +00:00
Fix memory leaks by closing streams
This commit is contained in:
1 parent
39e51bc8c2
commit
540508a2be
18 files changed
+96
-60
No files matched your search
@@ -122,10 +122,14 @@ public class ImageDownloadAlt extends SimpleTexture {
|
||||
BufferedImage bufferedimage;
|
||||
|
||||
if (ImageDownloadAlt.this.cacheFile != null) {
|
||||
FileUtils.copyInputStreamToFile(connection.getInputStream(), ImageDownloadAlt.this.cacheFile);
|
||||
try (InputStream in = connection.getInputStream()) {
|
||||
FileUtils.copyInputStreamToFile(in, ImageDownloadAlt.this.cacheFile);
|
||||
}
|
||||
bufferedimage = ImageIO.read(ImageDownloadAlt.this.cacheFile);
|
||||
} else {
|
||||
bufferedimage = ImageIO.read(connection.getInputStream());
|
||||
try (InputStream in = connection.getInputStream()) {
|
||||
bufferedimage = ImageIO.read(in);
|
||||
}
|
||||
}
|
||||
|
||||
if (ImageDownloadAlt.this.imageBuffer != null) {
|
||||
|
||||
Reference in new issue
Block a user