Archiviert
13
0

Use try-with-resources (#158)

Replace try statements that close a resource in the finally block with a
try-with-resources statement [1].

This commit was created automatically by Diffblue refactorings (https://www.diffblue.com/).

[1] https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
Dieser Commit ist enthalten in:
diffblue-assistant 2018-08-23 17:51:21 +01:00 committet von Dan Mulloy
Ursprung 39e0c974ee
Commit 1373911ca2

Datei anzeigen

@ -97,9 +97,7 @@ public final class SpigotUpdater extends Updater {
private static final byte[] API_KEY = ("key=98BE0FE67F88AB82B4C197FAF1DC3B69206EFDCC4D3B80FC83A00037510B99B4&resource=" + ID).getBytes(Charsets.UTF_8);
public String getSpigotVersion() throws IOException {
Closer closer = Closer.create();
try {
try (Closer closer = Closer.create()) {
HttpURLConnection con = (HttpURLConnection) new URL(API_URL).openConnection();
con.setDoOutput(true);
con.setRequestMethod(ACTION);
@ -108,8 +106,6 @@ public final class SpigotUpdater extends Updater {
InputStreamReader isr = closer.register(new InputStreamReader(con.getInputStream()));
BufferedReader br = closer.register(new BufferedReader(isr));
return br.readLine();
} finally {
closer.close();
}
}