Added disconnects to the version check

This commit is contained in:
CovertJaguar 2013-07-29 20:35:42 -07:00
parent 422f9855a4
commit cf87c4229d

View file

@ -68,6 +68,10 @@ public class Version implements Runnable {
HttpURLConnection conn = null;
while (location != null && !location.isEmpty()) {
URL url = new URL(location);
if(conn != null)
conn.disconnect();
conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("User-Agent",
"Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)");
@ -75,7 +79,11 @@ public class Version implements Runnable {
location = conn.getHeaderField("Location");
}
if(conn == null)
throw new NullPointerException();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
conn.disconnect();
String line = null;
String mcVersion = CoreProxy.proxy.getMinecraftVersion();
@ -122,6 +130,10 @@ public class Version implements Runnable {
HttpURLConnection conn = null;
while (location != null && !location.isEmpty()) {
URL url = new URL(location);
if(conn != null)
conn.disconnect();
conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("User-Agent",
"Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)");
@ -129,9 +141,13 @@ public class Version implements Runnable {
location = conn.getHeaderField("Location");
}
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
if(conn == null)
throw new NullPointerException();
String line = null;
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
conn.disconnect();
String line;
ArrayList<String> changelog = new ArrayList<String>();
while ((line = reader.readLine()) != null) {
if (line.startsWith("#")) {