Merge pull request #502 from UniquePassive/screenshot-resleak

screenshot plugin: fix okhttp resource leak on imgur upload
This commit is contained in:
Adam
2018-01-31 18:08:22 -05:00
committed by GitHub

View File

@@ -430,7 +430,8 @@ public class ScreenshotPlugin extends Plugin
@Override @Override
public void onResponse(Call call, Response response) throws IOException public void onResponse(Call call, Response response) throws IOException
{ {
InputStream in = response.body().byteStream(); try (InputStream in = response.body().byteStream())
{
ImageUploadResponse imageUploadResponse = RuneLiteAPI.GSON ImageUploadResponse imageUploadResponse = RuneLiteAPI.GSON
.fromJson(new InputStreamReader(in), ImageUploadResponse.class); .fromJson(new InputStreamReader(in), ImageUploadResponse.class);
@@ -448,6 +449,7 @@ public class ScreenshotPlugin extends Plugin
} }
} }
} }
}
}); });
} }