screenshot plugin: fix okhttp resource leak on imgur upload

This commit is contained in:
UniquePassive
2018-01-30 18:45:57 +01:00
parent c157c0df75
commit ad90e932c6

View File

@@ -422,7 +422,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);
@@ -440,6 +441,7 @@ public class ScreenshotPlugin extends Plugin
} }
} }
} }
}
}); });
} }