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: Adding null check for listFiles Created Sept. 30, 2016, 3:02 p.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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 this.lock(); 247 this.lock();
248 try 248 try
249 { 249 {
250 Log.d(TAG, "Writing filters..."); 250 Log.d(TAG, "Writing filters...");
251 final File filterFile = this.subscriptions.createAndWriteFile(); 251 final File filterFile = this.subscriptions.createAndWriteFile();
252 252
253 final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferen ces(this.serviceContext); 253 final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferen ces(this.serviceContext);
254 final String key = this.serviceContext.getString(R.string.key_cached_filte r_path); 254 final String key = this.serviceContext.getString(R.string.key_cached_filte r_path);
255 prefs.edit().putString(key, filterFile.getAbsolutePath()).commit(); 255 prefs.edit().putString(key, filterFile.getAbsolutePath()).commit();
256 256
257 Log.d(TAG, "Cleaning up cache...");
258 final File dummyFile = getDummyFilterFile(this.serviceContext);
259 final File[] cacheDirFiles = getFilterCacheDir(this.serviceContext).listFi les();
260 if (cacheDirFiles != null)
261 {
262 for (final File file : cacheDirFiles)
263 {
264 if (!file.equals(dummyFile) && !file.equals(filterFile))
265 {
266 Log.d(TAG, "Deleting file:" + file);
267 file.delete();
268 }
269 }
270 }
257 } 271 }
258 catch (IOException e) 272 catch (IOException e)
259 { 273 {
260 Log.e(TAG, "Failed to write filters", e); 274 Log.e(TAG, "Failed to write filters", e);
261 } 275 }
262 finally 276 finally
263 { 277 {
264 this.unlock(); 278 this.unlock();
265 } 279 }
266 } 280 }
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 Log.d(TAG, headers.toString()); 724 Log.d(TAG, headers.toString());
711 this.downloader.enqueueDownload(this.createDownloadURL(sub), sub.getId(), headers); 725 this.downloader.enqueueDownload(this.createDownloadURL(sub), sub.getId(), headers);
712 } 726 }
713 } 727 }
714 728
715 public void connectivityChanged() 729 public void connectivityChanged()
716 { 730 {
717 this.downloader.connectivityChanged(); 731 this.downloader.connectivityChanged();
718 } 732 }
719 } 733 }
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