Index: libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java |
diff --git a/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java b/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java |
index dc0b6477c6b85d191d82e6de3358f52945324156..b6329cea7871472ac4d581d624d19e7a712a10af 100644 |
--- a/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java |
+++ b/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java |
@@ -18,6 +18,7 @@ |
package org.adblockplus.libadblockplus.android; |
import java.io.BufferedReader; |
+import java.io.IOException; |
import java.io.InputStream; |
import java.io.InputStreamReader; |
import java.net.HttpURLConnection; |
@@ -139,20 +140,34 @@ public class AndroidWebRequest implements WebRequest |
final StringBuilder sb = new StringBuilder(); |
String line; |
- while ((line = reader.readLine()) != null) |
+ try |
+ { |
+ while ((line = reader.readLine()) != null) |
+ { |
+ // We're only appending non-element-hiding filters here. |
+ // |
+ // See: |
+ // https://issues.adblockplus.org/ticket/303 |
+ // |
+ // Follow-up issue for removing this hack: |
+ // https://issues.adblockplus.org/ticket/1541 |
+ // |
+ if (this.elemhideEnabled || !isListedSubscriptionUrl(url) || line.indexOf('#') == -1) |
+ { |
+ sb.append(line); |
+ sb.append('\n'); |
+ } |
+ } |
+ } |
+ finally |
{ |
- // We're only appending non-element-hiding filters here. |
- // |
- // See: |
- // https://issues.adblockplus.org/ticket/303 |
- // |
- // Follow-up issue for removing this hack: |
- // https://issues.adblockplus.org/ticket/1541 |
- // |
- if (this.elemhideEnabled || !isListedSubscriptionUrl(url) || line.indexOf('#') == -1) |
+ try |
+ { |
+ reader.close(); |
+ } |
+ catch (IOException e) |
{ |
- sb.append(line); |
- sb.append('\n'); |
+ // ignored |
} |
} |