Skip to content

Commit 078a196

Browse files
committed
Remove redundant try-with-resources block
1 parent 6ee3ba4 commit 078a196

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

lib/src/main/java/xyz/gianlu/librespot/core/ApResolver.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,18 @@ private void request(@NotNull String... types) throws IOException {
8585
try (Response response = client.newCall(request).execute()) {
8686
ResponseBody body = response.body();
8787
if (body == null) throw new IOException("No body");
88-
try (Reader reader = body.charStream()) {
89-
JsonObject obj = JsonParser.parseReader(reader).getAsJsonObject();
90-
HashMap<String, List<String>> map = new HashMap<>();
91-
for (String type : types)
92-
map.put(type, getUrls(obj, type));
93-
94-
synchronized (pool) {
95-
pool.putAll(map);
96-
poolReady = true;
97-
pool.notifyAll();
98-
}
88+
JsonObject obj = JsonParser.parseReader(body.charStream()).getAsJsonObject();
89+
HashMap<String, List<String>> map = new HashMap<>();
90+
for (String type : types)
91+
map.put(type, getUrls(obj, type));
9992

100-
LOGGER.info("Loaded aps into pool: " + pool);
93+
synchronized (pool) {
94+
pool.putAll(map);
95+
poolReady = true;
96+
pool.notifyAll();
10197
}
98+
99+
LOGGER.info("Loaded aps into pool: " + pool);
102100
}
103101
}
104102

0 commit comments

Comments
 (0)