mirror of
https://github.com/HexedHero/CitizensCMD.git
synced 2025-11-18 06:24:57 +01:00
Close reader objects
This commit is contained in:
parent
ffc4014e58
commit
6d78a37805
@ -39,7 +39,9 @@ public class SpigotUpdater {
|
||||
*/
|
||||
public String getLatestVersion() throws Exception {
|
||||
final URLConnection con = checkURL.openConnection();
|
||||
this.newVersion = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
|
||||
this.newVersion = reader.readLine();
|
||||
}
|
||||
return newVersion;
|
||||
}
|
||||
|
||||
@ -60,7 +62,9 @@ public class SpigotUpdater {
|
||||
*/
|
||||
public boolean checkForUpdates() throws Exception {
|
||||
final URLConnection con = checkURL.openConnection();
|
||||
this.newVersion = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
|
||||
this.newVersion = reader.readLine();
|
||||
}
|
||||
return !plugin.getDescription().getVersion().equals(newVersion);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user