From eb6dcdbff86d9f55acae34af6f7d828ff0056aed Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Mon, 22 Apr 2019 12:34:04 +0200 Subject: [PATCH] Download: make sure to close in when caching --- src/be/nikiroo/utils/Downloader.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/be/nikiroo/utils/Downloader.java b/src/be/nikiroo/utils/Downloader.java index 1ec4379a..30ce4e79 100644 --- a/src/be/nikiroo/utils/Downloader.java +++ b/src/be/nikiroo/utils/Downloader.java @@ -336,8 +336,11 @@ public class Downloader { if (in != null && cache != null) { tracer.trace("Save to cache: " + originalUrl); try { - cache.save(in, originalUrl); - in.close(); + try { + cache.save(in, originalUrl); + } finally { + in.close(); + } in = cache.load(originalUrl, true, false); } catch (IOException e) { tracer.error(new IOException( -- 2.27.0