Ver Fonte

Use finally to close the update checker stream

Kane York há 12 anos atrás
pai
commit
f81a763d6c
1 ficheiros alterados com 3 adições e 3 exclusões
  1. 3 3
      src/main/java/com/gmail/nossr50/util/UpdateChecker.java

+ 3 - 3
src/main/java/com/gmail/nossr50/util/UpdateChecker.java

@@ -35,7 +35,6 @@ public class UpdateChecker {
             Object o = jp.parse(isr);
 
             if (!(o instanceof JSONObject)) {
-                isr.close();
                 return false;
             }
 
@@ -56,15 +55,16 @@ public class UpdateChecker {
                     oldVer = 0;
                 }
                 if (oldVer < newVer) {
-                    isr.close();
                     return true;
                 }
             }
             return false;
         }
         catch (ParseException e) {
-            isr.close();
             return false;
         }
+        finally {
+            isr.close();
+        }
     }
 }