Index: libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java |
diff --git a/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java b/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java |
index 6796cd076d45eb8da866a989f02d6362df3756aa..d7d78039a2d804d9955917467628bdff6ed0bc6a 100644 |
--- a/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java |
+++ b/libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java |
@@ -92,35 +92,21 @@ public class AndroidWebRequest extends WebRequest |
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8")); |
final StringBuilder sb = new StringBuilder(); |
- if (!this.elemhideEnabled && isListedSubscriptionUrl(url)) |
+ String line; |
+ while ((line = reader.readLine()) != null) |
{ |
- Log.d(TAG, "Removing element hiding rules from: '" + url + "'"); |
- |
- String line; |
- 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 (line.indexOf('#') == -1) |
- { |
- sb.append(line); |
- sb.append('\n'); |
- } |
- } |
- } |
- else |
- { |
- int character; |
- |
- while ((character = reader.read()) != -1) |
+ // 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) |
anton
2016/09/08 13:00:12
it was extremely bad idea to read bytes one-by-one
|
{ |
- sb.append((char) character); |
+ sb.append(line); |
+ sb.append('\n'); |
} |
} |
@@ -133,10 +119,12 @@ public class AndroidWebRequest extends WebRequest |
{ |
response.setStatus(NsStatus.ERROR_FAILURE); |
} |
+ Log.d(TAG, "Downloading finished"); |
return response; |
} |
catch (final Throwable t) |
{ |
+ Log.e(TAG, "WebRequest failed", t); |
throw new AdblockPlusException("WebRequest failed", t); |
} |
} |