|
26 | 26 | import java.net.HttpURLConnection; |
27 | 27 | import java.net.URL; |
28 | 28 | import java.net.URLConnection; |
| 29 | +import java.nio.charset.StandardCharsets; |
29 | 30 | import java.util.ArrayList; |
30 | 31 | import java.util.Collections; |
31 | 32 | import java.util.HashMap; |
@@ -216,9 +217,8 @@ private InputStream openUrlStream(URL url) throws IOException |
216 | 217 | for (int redirects = 0; redirects < MAX_HTTP_REDIRECTS; redirects++) |
217 | 218 | { |
218 | 219 | URLConnection c = currentUrl.openConnection(); |
219 | | - if (c instanceof HttpURLConnection) |
| 220 | + if (c instanceof HttpURLConnection huc) |
220 | 221 | { |
221 | | - HttpURLConnection huc = (HttpURLConnection) c; |
222 | 222 | huc.setInstanceFollowRedirects(false); |
223 | 223 | int responseCode = huc.getResponseCode(); |
224 | 224 | if (responseCode >= 300 && responseCode <= 399) |
@@ -250,7 +250,7 @@ private void process(ModContainer mod, URL url) |
250 | 250 | ComparableVersion target = null; |
251 | 251 |
|
252 | 252 | InputStream con = openUrlStream(url); |
253 | | - String data = new String(ByteStreams.toByteArray(con), "UTF-8"); |
| 253 | + String data = new String(ByteStreams.toByteArray(con), StandardCharsets.UTF_8); |
254 | 254 | con.close(); |
255 | 255 |
|
256 | 256 | log.debug("[{}] Received version check data:\n{}", mod.getModId(), data); |
@@ -375,7 +375,7 @@ public static Map<ModContainer, URL> gatherMods() |
375 | 375 | return ret; |
376 | 376 | } |
377 | 377 |
|
378 | | - private static Map<ModContainer, CheckResult> results = new ConcurrentHashMap<ModContainer, CheckResult>(); |
| 378 | + private static final Map<ModContainer, CheckResult> results = new ConcurrentHashMap<>(); |
379 | 379 | private static final CheckResult PENDING_CHECK = new CheckResult(PENDING, null, null, null, null, null); |
380 | 380 |
|
381 | 381 | public static CheckResult getResult(ModContainer mod) |
|
0 commit comments