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

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

Issue 29355392: Issue 4485 - Clear cache directory (Closed)
Patch Set: Created Sept. 30, 2016, 2:48 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 | « no previous file | src/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java » ('j') | 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 this.lock(); 249 this.lock();
250 try 250 try
251 { 251 {
252 Log.d(TAG, "Writing filters..."); 252 Log.d(TAG, "Writing filters...");
253 final File filterFile = this.subscriptions.createAndWriteFile(); 253 final File filterFile = this.subscriptions.createAndWriteFile();
254 254
255 final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferen ces(this.serviceContext); 255 final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferen ces(this.serviceContext);
256 final String key = this.serviceContext.getString(R.string.key_cached_filte r_path); 256 final String key = this.serviceContext.getString(R.string.key_cached_filte r_path);
257 prefs.edit().putString(key, filterFile.getAbsolutePath()).commit(); 257 prefs.edit().putString(key, filterFile.getAbsolutePath()).commit();
258 258
259 Log.d(TAG, "Cleaning up cache...");
260 final File dummyFile = getDummyFilterFile(this.serviceContext);
261 for (final File file : getFilterCacheDir(this.serviceContext).listFiles())
anton 2016/09/30 06:17:15 listFiles() can return `null` is getFilterCacheDir
diegocarloslima 2016/09/30 14:35:47 The directory should exists in order for the previ
262 {
263 if (!file.equals(dummyFile) && !file.equals(filterFile))
264 {
265 Log.d(TAG, "Deleting file:" + file);
266 file.delete();
267 }
268 }
259 } 269 }
260 catch (IOException e) 270 catch (IOException e)
261 { 271 {
262 Log.e(TAG, "Failed to write filters", e); 272 Log.e(TAG, "Failed to write filters", e);
263 } 273 }
264 finally 274 finally
265 { 275 {
266 this.unlock(); 276 this.unlock();
267 } 277 }
268 } 278 }
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 Log.d(TAG, headers.toString()); 722 Log.d(TAG, headers.toString());
713 this.downloader.enqueueDownload(this.createDownloadURL(sub), sub.getId(), headers); 723 this.downloader.enqueueDownload(this.createDownloadURL(sub), sub.getId(), headers);
714 } 724 }
715 } 725 }
716 726
717 public void connectivityChanged() 727 public void connectivityChanged()
718 { 728 {
719 this.downloader.connectivityChanged(); 729 this.downloader.connectivityChanged();
720 } 730 }
721 } 731 }
OLDNEW
« no previous file with comments | « no previous file | src/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld