Suppress exceptions, if the http cache cannot be deleted

This commit is contained in:
0xb00bface 2023-12-31 15:06:03 +01:00
parent de282d24a6
commit d5f453a7a1
1 changed files with 10 additions and 6 deletions

View File

@ -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() {