Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java

Issue 29574567: Issue 5858 - WebRequest Reader is not closed (Closed)
Patch Set: Created Oct. 12, 2017, 9:29 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld