tests: fix NPE, add BasicSupportUtilities tests
[nikiroo-utils.git] / src / be / nikiroo / fanfix / DataLoader.java
index 51855c418d6ea8b7f5973a3dd1c16b6684515e8f..d342580614c4a8441efcd967ad4ce37ed9c9879c 100644 (file)
@@ -95,7 +95,7 @@ public class DataLoader {
         * @param url
         *            the resource to open
         * @param support
-        *            the support to use to download the resource
+        *            the support to use to download the resource (can be NULL)
         * @param stable
         *            TRUE for more stable resources, FALSE when they often change
         * 
@@ -149,7 +149,7 @@ public class DataLoader {
         *            is also used for the cache ID if needed (so we can retrieve
         *            the content with this URL if needed)
         * @param support
-        *            the support to use to download the resource
+        *            the support to use to download the resource (can be NULL)
         * @param stable
         *            TRUE for more stable resources, FALSE when they often change
         * @param postParams
@@ -229,7 +229,7 @@ public class DataLoader {
         * @param url
         *            the resource to open
         * @param support
-        *            the support to use to download the resource
+        *            the support to use to download the resource (can be NULL)
         * @param stable
         *            TRUE for more stable resources, FALSE when they often change
         * 
@@ -238,7 +238,7 @@ public class DataLoader {
         */
        public void refresh(URL url, BasicSupport support, boolean stable)
                        throws IOException {
-               if (check(url, stable)) {
+               if (!check(url, stable)) {
                        open(url, url, support, stable, null, null, null).close();
                }
        }
@@ -278,11 +278,11 @@ public class DataLoader {
                        throws IOException {
                String format;
                if (cover) {
-                       format = Instance.getConfig().getString(Config.IMAGE_FORMAT_COVER)
+                       format = Instance.getConfig().getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER)
                                        .toLowerCase();
                } else {
                        format = Instance.getConfig()
-                                       .getString(Config.IMAGE_FORMAT_CONTENT).toLowerCase();
+                                       .getString(Config.FILE_FORMAT_IMAGE_FORMAT_CONTENT).toLowerCase();
                }
                saveAsImage(img, new File(target.toString() + "." + format), format);
        }