fix downloader spent input
authorNiki Roo <niki@nikiroo.be>
Mon, 15 Apr 2019 21:18:20 +0000 (23:18 +0200)
committerNiki Roo <niki@nikiroo.be>
Mon, 15 Apr 2019 21:18:20 +0000 (23:18 +0200)
src/be/nikiroo/utils/Downloader.java

index efc6a98df54f11a91c271646daf427d7cfca6fdf..1ec4379a92b355cc1261e0d80d2c057dee0ff8ee 100644 (file)
@@ -334,9 +334,11 @@ public class Downloader {
                }
 
                if (in != null && cache != null) {
-                       tracer.trace("Save to cache: " + url);
+                       tracer.trace("Save to cache: " + originalUrl);
                        try {
-                               cache.save(in, url);
+                               cache.save(in, originalUrl);
+                               in.close();
+                               in = cache.load(originalUrl, true, false);
                        } catch (IOException e) {
                                tracer.error(new IOException(
                                                "Cannot save URL to cache, will ignore cache: " + url,