git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new: NextableInputStream, step 1
[fanfix.git]
/
src
/
be
/
nikiroo
/
utils
/
Downloader.java
diff --git
a/src/be/nikiroo/utils/Downloader.java
b/src/be/nikiroo/utils/Downloader.java
index 5c847fa623902e92704b5d986a8b3cb8fc1ecc37..30ce4e798aff5300b30e14f200546b1e4d09ef16 100644
(file)
--- a/
src/be/nikiroo/utils/Downloader.java
+++ b/
src/be/nikiroo/utils/Downloader.java
@@
-249,8
+249,8
@@
public class Downloader {
if (cache != null) {
InputStream in = cache.load(originalUrl, false, stable);
if (in != null) {
if (cache != null) {
InputStream in = cache.load(originalUrl, false, stable);
if (in != null) {
- tracer.trace("
Take from
cache: " + url);
- tracer.trace("Original URL
from cache
: " + originalUrl);
+ tracer.trace("
Use the
cache: " + url);
+ tracer.trace("Original URL : " + originalUrl);
return in;
}
}
return in;
}
}
@@
-334,9
+334,14
@@
public class Downloader {
}
if (in != null && cache != null) {
}
if (in != null && cache != null) {
- tracer.trace("Save to cache: " +
u
rl);
+ tracer.trace("Save to cache: " +
originalU
rl);
try {
try {
- cache.save(in, url);
+ try {
+ cache.save(in, originalUrl);
+ } finally {
+ in.close();
+ }
+ in = cache.load(originalUrl, true, false);
} catch (IOException e) {
tracer.error(new IOException(
"Cannot save URL to cache, will ignore cache: " + url,
} catch (IOException e) {
tracer.error(new IOException(
"Cannot save URL to cache, will ignore cache: " + url,
@@
-388,7
+393,6
@@
public class Downloader {
builder.append(';');
}
builder.append(';');
}
- // TODO: check if format is ok
builder.append(cookie.toString());
}
builder.append(cookie.toString());
}