Merge branch 'subtree'
[fanfix.git] / src / be / nikiroo / utils / Downloader.java
index b1ac56c0508300e6fee02eada0affd499117b7a8..0487933295ec8c4902665d2bffcd81e57debda2c 100644 (file)
@@ -281,7 +281,9 @@ public class Downloader {
                        }
                }
 
-               if (offline) {
+               String protocol = originalUrl == null ? null : originalUrl
+                               .getProtocol();
+               if (isOffline() && !"file".equalsIgnoreCase(protocol)) {
                        tracer.error("Downloader OFFLINE, cannot proceed to URL: " + url);
                        throw new IOException("Downloader is currently OFFLINE, cannot download: " + url);
                }
@@ -397,6 +399,11 @@ public class Downloader {
                                }
                        }
 
+                       if (in == null) {
+                               throw new IOException(
+                                               "Cannot retrieve the file after storing it in the cache (??)");
+                       }
+                       
                        return in;
                } catch (IOException e) {
                        throw new IOException(String.format(