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

Side by Side Diff: src/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java

Issue 29355386: Issue 4463 - Content blocker unavailable error message (Closed)
Patch Set: Adjusting indentation Created Oct. 7, 2016, 2:38 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/org/adblockplus/sbrowser/contentblocker/engine/Engine.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 private final HashMap<String, Subscription> subscriptions = new HashMap<String , Subscription>(); 44 private final HashMap<String, Subscription> subscriptions = new HashMap<String , Subscription>();
45 45
46 private final Engine engine; 46 private final Engine engine;
47 private final File subscriptionFolder; 47 private final File subscriptionFolder;
48 private final File cacheFolder; 48 private final File cacheFolder;
49 private final boolean wasUnitialized; 49 private final boolean wasUnitialized;
50 50
51 private Subscriptions(final Engine engine, final File appFolder, final File ca cheFolder) 51 private Subscriptions(final Engine engine, final File appFolder, final File ca cheFolder)
52 { 52 {
53 this.engine = engine; 53 this.engine = engine;
54 this.subscriptionFolder = new File(appFolder, "subscriptions"); 54 this.subscriptionFolder = appFolder;
55 this.wasUnitialized = !this.subscriptionFolder.exists(); 55 this.wasUnitialized = !this.subscriptionFolder.exists();
56 this.cacheFolder = new File(cacheFolder, "subscriptions"); 56 this.cacheFolder = cacheFolder;
57 } 57 }
58 58
59 public boolean wasUnitialized() 59 public boolean wasUnitialized()
60 { 60 {
61 return this.wasUnitialized; 61 return this.wasUnitialized;
62 } 62 }
63 63
64 public File createAndWriteFile() throws IOException 64 public File createAndWriteFile() throws IOException
65 { 65 {
66 // TODO cache cleanups 66 // TODO cache cleanups
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 s.getFilters(filters); 177 s.getFilters(filters);
178 s.clearFilters(); 178 s.clearFilters();
179 } 179 }
180 } 180 }
181 181
182 final BufferedWriter w = new BufferedWriter( 182 final BufferedWriter w = new BufferedWriter(
183 new OutputStreamWriter(new FileOutputStream(output), "UTF-8")); 183 new OutputStreamWriter(new FileOutputStream(output), "UTF-8"));
184 try 184 try
185 { 185 {
186 Log.d(TAG, "Writing " + filters.size() + " filters"); 186 Log.d(TAG, "Writing " + filters.size() + " filters");
187 w.write("[Adblock Plus 2.0]\n"); 187 Engine.writeFilterHeaders(w);
188 w.write("! This file was automatically created.\n");
189 for (final String filter : filters) 188 for (final String filter : filters)
190 { 189 {
191 w.write(filter); 190 w.write(filter);
192 w.write('\n'); 191 w.write('\n');
193 } 192 }
194 } 193 }
195 finally 194 finally
196 { 195 {
197 w.close(); 196 w.close();
198 } 197 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 if (sub != null) 270 if (sub != null)
272 { 271 {
273 if (sub.updateSubscription(responseCode, text, httpHeaders, this.getMetaFi le(sub), 272 if (sub.updateSubscription(responseCode, text, httpHeaders, this.getMetaFi le(sub),
274 this.getFiltersFile(sub))) 273 this.getFiltersFile(sub)))
275 { 274 {
276 this.engine.requestUpdateBroadcast(); 275 this.engine.requestUpdateBroadcast();
277 } 276 }
278 } 277 }
279 } 278 }
280 } 279 }
OLDNEW
« no previous file with comments | « src/org/adblockplus/sbrowser/contentblocker/engine/Engine.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld