mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-11-19 10:29:23 +01:00
refactor: Use try block for auto closeable
This commit is contained in:
parent
7b524efdbd
commit
4a242c7a91
@ -1,14 +1,13 @@
|
||||
package app.revanced.twitch.adblock;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import app.revanced.twitch.api.RetrofitClient;
|
||||
import app.revanced.twitch.utils.LogHelper;
|
||||
import app.revanced.twitch.utils.ReVancedUtils;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class PurpleAdblockService implements IAdblockService {
|
||||
private final Map<String, Boolean> tunnels = new HashMap<>() {{
|
||||
@ -36,9 +35,13 @@ public class PurpleAdblockService implements IAdblockService {
|
||||
if (!response.isSuccessful()) {
|
||||
LogHelper.error("PurpleAdBlock tunnel $tunnel returned an error: HTTP code %d", response.code());
|
||||
LogHelper.debug(response.message());
|
||||
if (response.errorBody() != null) {
|
||||
LogHelper.debug(((ResponseBody) response.errorBody()).string());
|
||||
|
||||
try (var errorBody = response.errorBody()) {
|
||||
if (errorBody != null) {
|
||||
LogHelper.debug(errorBody.string());
|
||||
}
|
||||
}
|
||||
|
||||
success = false;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
Loading…
Reference in New Issue
Block a user