Added message about redirection

This commit is contained in:
Xavi Aracil 2022-12-15 13:33:41 +01:00
parent 682c9d9d4d
commit e7de6c6ebc

View File

@ -135,6 +135,7 @@ public class CachingDocumentLoader extends ConfigurableDocumentLoader {
.initialCapacity(32).maximumSize(64).expireAfterAccess(Duration.ofHours(24)) .initialCapacity(32).maximumSize(64).expireAfterAccess(Duration.ofHours(24))
.build(new CacheLoader<Tuple<String, DocumentLoaderOptions>, Document>() { .build(new CacheLoader<Tuple<String, DocumentLoaderOptions>, Document>() {
public Document load(final Tuple<String, DocumentLoaderOptions> id) throws Exception { public Document load(final Tuple<String, DocumentLoaderOptions> id) throws Exception {
// TODO: this loading will fail if the document is redirected (HTTP 301)
try (InputStream is = bundled.containsKey(id.t1) try (InputStream is = bundled.containsKey(id.t1)
? bundled.get(id.t1).openStream() ? bundled.get(id.t1).openStream()
: new URI(id.t1).toURL().openStream();) { : new URI(id.t1).toURL().openStream();) {