From d5f453a7a101cc89b9b692f66cca3baf3c82a99b Mon Sep 17 00:00:00 2001 From: 0xb00bface <0xboobface@gmail.com> Date: Sun, 31 Dec 2023 15:06:03 +0100 Subject: [PATCH] Suppress exceptions, if the http cache cannot be deleted --- .../main/java/ctbrec/ui/CamrecApplication.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/client/src/main/java/ctbrec/ui/CamrecApplication.java b/client/src/main/java/ctbrec/ui/CamrecApplication.java index 87c9a5f2..a10e5d4e 100644 --- a/client/src/main/java/ctbrec/ui/CamrecApplication.java +++ b/client/src/main/java/ctbrec/ui/CamrecApplication.java @@ -441,12 +441,16 @@ public class CamrecApplication extends Application { } private void clearHttpCache() throws IOException { - File httpCacheDir = new File(config.getConfigDir(), "cache"); - LOG.debug("Deleting http cache {}", httpCacheDir); - HttpClientCacheProvider.getCache(config).evictAll(); - HttpClientCacheProvider.getCache(config).close(); - IoUtils.deleteDirectory(httpCacheDir); - LOG.debug("Cache has been deleted"); + try { + File httpCacheDir = new File(config.getConfigDir(), "cache"); + LOG.debug("Deleting http cache {}", httpCacheDir); + HttpClientCacheProvider.getCache(config).evictAll(); + HttpClientCacheProvider.getCache(config).close(); + IoUtils.deleteDirectory(httpCacheDir); + LOG.debug("Cache has been deleted"); + } catch (Exception e) { + LOG.info("The HTTP cache was not completely deleted: {}", e.getLocalizedMessage()); + } } private void registerAlertSystem() {