[RFC][Icedtea-Web]: Enforce cache size limit.
Deepak Bhole
dbhole at redhat.com
Tue Apr 19 15:29:01 PDT 2011
* Andrew Su <asu at redhat.com> [2011-04-19 17:30]:
>
>
> ----- Original Message -----
<snip>
> + } catch (IOException e1) {
> + e1.printStackTrace();
Why e1 and not e?
Rest looks fine to me. Okay from me after above e1 -> e change.
Cheers,
Deepak
> + }
> + }
> + }
> }
> } else {
> lruHandler.removeEntry(key);
> @@ -560,20 +600,26 @@
> }
> lruHandler.store();
>
> - removeUntrackedDirectories(keep);
> + /*
> + * FIXME: if cacheDir is for example $USER_HOME and they have a folder called http
> + * and/or https. These would get removed.
> + */
> + remove.add(cacheDir + File.separator + "http");
> + remove.add(cacheDir + File.separator + "https");
> +
> + remove.removeAll(keep);
> +
> + removeSetOfDirectories(remove);
> +
> }
> }
>
> - private static void removeUntrackedDirectories(Set<String> keep) {
> - File temp = new File(cacheDir);
> - // Remove all folder not listed in keep.
> - for (File f : temp.listFiles()) {
> - if (f.isDirectory() && !keep.contains(f.getPath())) {
> - try {
> - FileUtils.recursiveDelete(f, f);
> - } catch (IOException e) {
> - e.printStackTrace();
> - }
> + private static void removeSetOfDirectories(Set<String> remove) {
> + for (String s : remove) {
> + File f = new File(s);
> + try {
> + FileUtils.recursiveDelete(f, f);
> + } catch (IOException e) {
> }
> }
> }
More information about the distro-pkg-dev
mailing list