Index: src/org/adblockplus/sbrowser/contentblocker/engine/Subscription.java |
=================================================================== |
--- a/src/org/adblockplus/sbrowser/contentblocker/engine/Subscription.java |
+++ b/src/org/adblockplus/sbrowser/contentblocker/engine/Subscription.java |
@@ -431,17 +431,19 @@ final class Subscription |
filtersOut.writeInt(0); |
} |
else |
{ |
filtersOut.writeInt(this.filters.size()); |
filtersOut.writeUTF(createFilterHash(new ArrayList<String>(this.filters))); |
for (final String s : this.filters) |
{ |
- filtersOut.writeUTF(s); |
+ final byte[] b = s.getBytes("UTF-8"); |
anton
2017/02/16 06:17:24
wouldn't it be better to have static final String
diegocarloslima
2017/02/22 22:43:53
Acknowledged.
|
+ filtersOut.writeInt(b.length); |
+ filtersOut.write(b); |
} |
} |
} |
finally |
{ |
filtersOut.close(); |
} |
} |
@@ -488,17 +490,20 @@ final class Subscription |
this.filters = null; |
} |
else |
{ |
this.filters = new HashSet<String>(); |
final String filtersHash = in.readUTF(); |
for (int i = 0; i < numFilters; i++) |
{ |
- this.filters.add(in.readUTF()); |
+ final int length = in.readInt(); |
+ final byte[] b = new byte[length]; |
+ in.readFully(b); |
+ this.filters.add(new String(b, "UTF-8")); |
} |
this.filtersValid = createFilterHash(new ArrayList<String>(this.filters)).equals( |
filtersHash); |
Log.d(TAG, "Filters valid: " + this.filtersValid); |
} |
} |
finally |
{ |