Update nikiroo-utils, remove Instance.syserr/trace
[fanfix.git] / src / be / nikiroo / fanfix / library / CacheLibrary.java
index 38fb7b3193e1b13da59e2abc285d2a6bd0461dfa..da6f56d3fa8fac1a097ad6df9ee47ac3f0dc5b42 100644 (file)
@@ -80,7 +80,7 @@ public class CacheLibrary extends BasicLibrary {
                                pgImport.done();
                                clearCache();
                        } catch (IOException e) {
-                               Instance.syserr(e);
+                               Instance.getTraceHandler().error(e);
                        }
 
                        pgImport.done();
@@ -153,7 +153,9 @@ public class CacheLibrary extends BasicLibrary {
                pg.addProgress(pgCache, 1);
                pg.addProgress(pgOrig, 1);
 
-               cacheLib.changeSource(luid, newSource, pgCache);
+               if (isCached(luid)) {
+                       cacheLib.changeSource(luid, newSource, pgCache);
+               }
                pgCache.done();
                lib.changeSource(luid, newSource, pgOrig);
                pgOrig.done();
@@ -184,8 +186,10 @@ public class CacheLibrary extends BasicLibrary {
         *             in case of I/O error
         */
        public void clearFromCache(String luid) throws IOException {
-               cacheLib.delete(luid);
-               clearCache();
+               if (isCached(luid)) {
+                       cacheLib.delete(luid);
+                       clearCache();
+               }
        }
 
        // All the following methods are only used by Save and Delete in