Update nikiroo-utils, remove Instance.syserr/trace
authorNiki Roo <niki@nikiroo.be>
Tue, 28 Nov 2017 12:50:46 +0000 (13:50 +0100)
committerNiki Roo <niki@nikiroo.be>
Tue, 28 Nov 2017 12:50:46 +0000 (13:50 +0100)
26 files changed:
libs/nikiroo-utils-3.0.0-sources.jar [moved from libs/nikiroo-utils-2.2.3-sources.jar with 80% similarity]
src/be/nikiroo/fanfix/DataLoader.java
src/be/nikiroo/fanfix/Instance.java
src/be/nikiroo/fanfix/Main.java
src/be/nikiroo/fanfix/VersionCheck.java
src/be/nikiroo/fanfix/library/BasicLibrary.java
src/be/nikiroo/fanfix/library/CacheLibrary.java
src/be/nikiroo/fanfix/library/LocalLibrary.java
src/be/nikiroo/fanfix/library/RemoteLibrary.java
src/be/nikiroo/fanfix/library/RemoteLibraryServer.java
src/be/nikiroo/fanfix/output/InfoCover.java
src/be/nikiroo/fanfix/reader/BasicReader.java
src/be/nikiroo/fanfix/reader/GuiReader.java
src/be/nikiroo/fanfix/reader/GuiReaderBook.java
src/be/nikiroo/fanfix/reader/GuiReaderFrame.java
src/be/nikiroo/fanfix/reader/TuiReader.java
src/be/nikiroo/fanfix/reader/TuiReaderMainWindow.java
src/be/nikiroo/fanfix/supported/BasicSupport.java
src/be/nikiroo/fanfix/supported/Cbz.java
src/be/nikiroo/fanfix/supported/EHentai.java
src/be/nikiroo/fanfix/supported/Epub.java
src/be/nikiroo/fanfix/supported/Fanfiction.java
src/be/nikiroo/fanfix/supported/Fimfiction.java
src/be/nikiroo/fanfix/supported/InfoText.java
src/be/nikiroo/fanfix/supported/MangaFox.java
src/be/nikiroo/fanfix/supported/Text.java

similarity index 80%
rename from libs/nikiroo-utils-2.2.3-sources.jar
rename to libs/nikiroo-utils-3.0.0-sources.jar
index 55e697f78d6e10fd86287141f04ed0be09b162da..82feb00ed344bcc6ad54ea0ec897f03e8f454406 100644 (file)
Binary files a/libs/nikiroo-utils-2.2.3-sources.jar and b/libs/nikiroo-utils-3.0.0-sources.jar differ
index e4f40a30289548069c9fb6a4c3b4c17d6136bdc2..2fd59d89764783cd9622fcc0249039dc012f1043 100644 (file)
@@ -99,8 +99,8 @@ public class DataLoader {
                // MUST NOT return null
                try {
                        InputStream in = cache.load(originalUrl, false, stable);
-                       Instance.trace("Cache " + (in != null ? "hit" : "miss") + ": "
-                                       + url);
+                       Instance.getTraceHandler().trace(
+                                       "Cache " + (in != null ? "hit" : "miss") + ": " + url);
 
                        if (in == null) {
                                try {
index 97e9868b8858ad2475b96cb7f51df3ae50d04683..ef0ba15ec6ac4d1766e82a4265567f10a231253f 100644 (file)
@@ -35,6 +35,9 @@ public class Instance {
        private static TraceHandler tracer;
 
        static {
+               // Before we can configure it:
+               tracer = new TraceHandler(true, checkEnv("DEBUG"), false);
+
                // Most of the rest is dependent upon this:
                config = new ConfigBundle();
 
@@ -58,13 +61,13 @@ public class Instance {
                        config = new ConfigBundle();
                        config.updateFile(configDir);
                } catch (IOException e) {
-                       syserr(e);
+                       tracer.error(e);
                }
                try {
                        uiconfig = new UiConfigBundle();
                        uiconfig.updateFile(configDir);
                } catch (IOException e) {
-                       syserr(e);
+                       tracer.error(e);
                }
 
                // No updateFile for this one! (we do not want the user to have custom
@@ -100,15 +103,14 @@ public class Instance {
                        debug = true;
                }
 
-               tracer = new TraceHandler();
-               tracer.setShowErrorDetails(debug);
-               tracer.setShowTraces(trace);
+               tracer = new TraceHandler(true, debug, trace);
 
                try {
                        lib = new LocalLibrary(getFile(Config.LIBRARY_DIR));
                } catch (Exception e) {
-                       syserr(new IOException("Cannot create library for directory: "
-                                       + getFile(Config.LIBRARY_DIR), e));
+                       tracer.error(new IOException(
+                                       "Cannot create library for directory: "
+                                                       + getFile(Config.LIBRARY_DIR), e));
                }
 
                // Could have used: System.getProperty("java.io.tmpdir")
@@ -121,7 +123,7 @@ public class Instance {
                //
 
                if (coverDir != null && !coverDir.exists()) {
-                       syserr(new IOException(
+                       tracer.error(new IOException(
                                        "The 'default covers' directory does not exists: "
                                                        + coverDir));
                        coverDir = null;
@@ -135,15 +137,17 @@ public class Instance {
 
                        cache = new DataLoader(tmp, ua, hours, hoursLarge);
                } catch (IOException e) {
-                       syserr(new IOException(
+                       tracer.error(new IOException(
                                        "Cannot create cache (will continue without cache)", e));
                }
        }
 
        /**
         * The traces handler for this {@link Cache}.
+        * <p>
+        * It is never NULL.
         * 
-        * @return the traces handler or NULL
+        * @return the traces handler (never NULL)
         */
        public static TraceHandler getTraceHandler() {
                return tracer;
@@ -156,6 +160,10 @@ public class Instance {
         *            the new traces handler or NULL
         */
        public static void setTraceHandler(TraceHandler tracer) {
+               if (tracer == null) {
+                       tracer = new TraceHandler(false, false, false);
+               }
+
                Instance.tracer = tracer;
        }
 
@@ -281,34 +289,10 @@ public class Instance {
                        IOUtils.writeSmallFile(new File(configDir), "LAST_UPDATE",
                                        Long.toString(new Date().getTime()));
                } catch (IOException e) {
-                       syserr(e);
-               }
-       }
-
-       /**
-        * Report an error to the user
-        * 
-        * @param e
-        *            the {@link Exception} to report
-        */
-       public static void syserr(Exception e) {
-               if (tracer != null) {
                        tracer.error(e);
                }
        }
 
-       /**
-        * Notify of a debug message.
-        * 
-        * @param message
-        *            the message
-        */
-       public static void trace(String message) {
-               if (tracer != null) {
-                       tracer.trace(message);
-               }
-       }
-
        /**
         * Return a path, but support the special $HOME variable.
         * 
index 813a9b40320758e42a4244778b5c86971cc95137..70f71ed58a17be21ba36cb5505adcc52056e8596 100644 (file)
@@ -23,9 +23,10 @@ import be.nikiroo.fanfix.reader.Reader.ReaderType;
 import be.nikiroo.fanfix.supported.BasicSupport;
 import be.nikiroo.fanfix.supported.BasicSupport.SupportType;
 import be.nikiroo.utils.Progress;
+import be.nikiroo.utils.TraceHandler;
 import be.nikiroo.utils.Version;
-import be.nikiroo.utils.serial.ConnectActionClient;
-import be.nikiroo.utils.serial.Server;
+import be.nikiroo.utils.serial.server.ConnectActionClientObject;
+import be.nikiroo.utils.serial.server.ServerObject;
 
 /**
  * Main program entry point.
@@ -98,8 +99,9 @@ public class Main {
                                                action = MainAction.valueOf(args[i].substring(2)
                                                                .toUpperCase().replace("-", "_"));
                                        } catch (Exception e) {
-                                               Instance.syserr(new IllegalArgumentException(
-                                                               "Unknown action: " + args[i], e));
+                                               Instance.getTraceHandler().error(
+                                                               new IllegalArgumentException("Unknown action: "
+                                                                               + args[i], e));
                                                exitCode = 255;
                                        }
                                }
@@ -272,8 +274,9 @@ public class Main {
                                break;
                        case LIST:
                                if (BasicReader.getReader() == null) {
-                                       Instance.syserr(new Exception(
-                                                       "No reader type has been configured"));
+                                       Instance.getTraceHandler()
+                                                       .error(new Exception(
+                                                                       "No reader type has been configured"));
                                        exitCode = 10;
                                        break;
                                }
@@ -281,8 +284,9 @@ public class Main {
                                break;
                        case READ:
                                if (BasicReader.getReader() == null) {
-                                       Instance.syserr(new Exception(
-                                                       "No reader type has been configured"));
+                                       Instance.getTraceHandler()
+                                                       .error(new Exception(
+                                                                       "No reader type has been configured"));
                                        exitCode = 10;
                                        break;
                                }
@@ -290,8 +294,9 @@ public class Main {
                                break;
                        case READ_URL:
                                if (BasicReader.getReader() == null) {
-                                       Instance.syserr(new Exception(
-                                                       "No reader type has been configured"));
+                                       Instance.getTraceHandler()
+                                                       .error(new Exception(
+                                                                       "No reader type has been configured"));
                                        exitCode = 10;
                                        break;
                                }
@@ -314,8 +319,9 @@ public class Main {
                                break;
                        case START:
                                if (BasicReader.getReader() == null) {
-                                       Instance.syserr(new Exception(
-                                                       "No reader type has been configured"));
+                                       Instance.getTraceHandler()
+                                                       .error(new Exception(
+                                                                       "No reader type has been configured"));
                                        exitCode = 10;
                                        break;
                                }
@@ -327,11 +333,11 @@ public class Main {
                                        break;
                                }
                                try {
-                                       Server server = new RemoteLibraryServer(key, port);
+                                       ServerObject server = new RemoteLibraryServer(key, port);
+                                       server.setTraceHandler(new TraceHandler(true, true, true));
                                        server.start();
-                                       System.out.println("Remote server started on: " + port);
                                } catch (IOException e) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
                                return;
                        case STOP_SERVER:
@@ -342,19 +348,19 @@ public class Main {
 
                                try {
                                        final String fkey = key;
-                                       new ConnectActionClient(host, port, true) {
+                                       new ConnectActionClientObject(host, port, true) {
                                                @Override
                                                public void action(Version serverVersion)
                                                                throws Exception {
                                                        try {
                                                                send(new Object[] { fkey, "EXIT" });
                                                        } catch (Exception e) {
-                                                               Instance.syserr(e);
+                                                               Instance.getTraceHandler().error(e);
                                                        }
                                                }
                                        }.connect();
                                } catch (IOException e) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
                                break;
                        case REMOTE:
@@ -389,7 +395,7 @@ public class Main {
                        System.out.println(story.getMeta().getLuid() + ": \""
                                        + story.getMeta().getTitle() + "\" imported.");
                } catch (IOException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                        return 1;
                }
 
@@ -415,15 +421,15 @@ public class Main {
                        Progress pg) {
                OutputType type = OutputType.valueOfNullOkUC(typeString, null);
                if (type == null) {
-                       Instance.syserr(new Exception(trans(StringId.OUTPUT_DESC,
-                                       typeString)));
+                       Instance.getTraceHandler().error(
+                                       new Exception(trans(StringId.OUTPUT_DESC, typeString)));
                        return 1;
                }
 
                try {
                        Instance.getLibrary().export(luid, type, target, pg);
                } catch (IOException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                        return 4;
                }
 
@@ -485,15 +491,16 @@ public class Main {
                                        reader.setChapter(Integer.parseInt(chapString));
                                        reader.read();
                                } catch (NumberFormatException e) {
-                                       Instance.syserr(new IOException(
-                                                       "Chapter number cannot be parsed: " + chapString, e));
+                                       Instance.getTraceHandler().error(
+                                                       new IOException("Chapter number cannot be parsed: "
+                                                                       + chapString, e));
                                        return 2;
                                }
                        } else {
                                reader.read();
                        }
                } catch (IOException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                        return 1;
                }
 
@@ -531,8 +538,9 @@ public class Main {
 
                        OutputType type = OutputType.valueOfAllOkUC(typeString, null);
                        if (type == null) {
-                               Instance.syserr(new IOException(trans(
-                                               StringId.ERR_BAD_OUTPUT_TYPE, typeString)));
+                               Instance.getTraceHandler().error(
+                                               new IOException(trans(StringId.ERR_BAD_OUTPUT_TYPE,
+                                                               typeString)));
 
                                exitCode = 2;
                        } else {
@@ -554,25 +562,29 @@ public class Main {
                                                        BasicOutput.getOutput(type, infoCover).process(
                                                                        story, target, pgOut);
                                                } catch (IOException e) {
-                                                       Instance.syserr(new IOException(trans(
-                                                                       StringId.ERR_SAVING, target), e));
+                                                       Instance.getTraceHandler().error(
+                                                                       new IOException(trans(StringId.ERR_SAVING,
+                                                                                       target), e));
                                                        exitCode = 5;
                                                }
                                        } else {
-                                               Instance.syserr(new IOException(trans(
-                                                               StringId.ERR_NOT_SUPPORTED, source)));
+                                               Instance.getTraceHandler().error(
+                                                               new IOException(trans(
+                                                                               StringId.ERR_NOT_SUPPORTED, source)));
 
                                                exitCode = 4;
                                        }
                                } catch (IOException e) {
-                                       Instance.syserr(new IOException(trans(StringId.ERR_LOADING,
-                                                       sourceName), e));
+                                       Instance.getTraceHandler().error(
+                                                       new IOException(trans(StringId.ERR_LOADING,
+                                                                       sourceName), e));
                                        exitCode = 3;
                                }
                        }
                } catch (MalformedURLException e) {
-                       Instance.syserr(new IOException(trans(StringId.ERR_BAD_URL,
-                                       sourceName), e));
+                       Instance.getTraceHandler()
+                                       .error(new IOException(trans(StringId.ERR_BAD_URL,
+                                                       sourceName), e));
                        exitCode = 1;
                }
 
@@ -638,8 +650,9 @@ public class Main {
                        BasicReader.setDefaultReaderType(readerType);
                        return 0;
                } catch (IllegalArgumentException e) {
-                       Instance.syserr(new IOException("Unknown reader type: "
-                                       + readerTypeString, e));
+                       Instance.getTraceHandler().error(
+                                       new IOException("Unknown reader type: " + readerTypeString,
+                                                       e));
                        return 1;
                }
        }
index 932449585f6e7e93a55cf1856b5b067965b4282d..62ee814071b734b1fadff3f90d5b5b746b6dae1e 100644 (file)
@@ -140,7 +140,7 @@ public class VersionCheck {
                                        reader.close();
                                }
                        } catch (IOException e) {
-                               Instance.syserr(new IOException(
+                               Instance.getTraceHandler().error(new IOException(
                                                "Cannot download latest changelist on github.com", e));
                        }
                }
index d324008f0b4c2294e503d907a25b0edc226ed944..66fb94355b538a94c900279bf0278675e6e5d9e3 100644 (file)
@@ -326,7 +326,7 @@ abstract public class BasicLibrary {
                                } catch (IOException e) {
                                        // We should not have not-supported files in the
                                        // library
-                                       Instance.syserr(new IOException(
+                                       Instance.getTraceHandler().error(new IOException(
                                                        "Cannot load file from library: " + file, e));
                                } finally {
                                        pgProcess.done();
index d653332a73673aaff0bbce6b0128cb901c15b94b..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();
index 11c36630adcef96ea73d17c8712d84495260299a..917ce093b20ebd8b58cad71a37a75d263c173490 100644 (file)
@@ -122,7 +122,7 @@ public class LocalLibrary extends BasicLibrary {
                                        meta = InfoReader.readMeta(infoFile, true);
                                        return meta.getCover();
                                } catch (IOException e) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
                        }
                }
@@ -183,7 +183,7 @@ public class LocalLibrary extends BasicLibrary {
                                        InfoCover.writeInfo(newDir, name, meta);
                                        relatedFile.delete();
                                } catch (IOException e) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
                        } else {
                                relatedFile.renameTo(new File(newDir, relatedFile.getName()));
@@ -209,7 +209,7 @@ public class LocalLibrary extends BasicLibrary {
                try {
                        ImageIO.write(sourceCovers.get(source), "png", cover);
                } catch (IOException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                        sourceCovers.remove(source);
                }
        }
@@ -472,7 +472,7 @@ public class LocalLibrary extends BasicLibrary {
                                        } catch (IOException e) {
                                                // We should not have not-supported files in the
                                                // library
-                                               Instance.syserr(new IOException(
+                                               Instance.getTraceHandler().error(new IOException(
                                                                "Cannot load file from library: " + infoFile, e));
                                        }
                                        pgFiles.add(1);
@@ -489,7 +489,7 @@ public class LocalLibrary extends BasicLibrary {
                                                        in.close();
                                                }
                                        } catch (IOException e) {
-                                               Instance.syserr(e);
+                                               Instance.getTraceHandler().error(e);
                                        }
                                }
 
@@ -516,7 +516,7 @@ public class LocalLibrary extends BasicLibrary {
                try {
                        ImageIO.write(sourceCovers.get(source), "png", cover);
                } catch (IOException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                        sourceCovers.remove(source);
                }
        }
index 0a747bdc11adc3d208f4011c74f4deff6be25f16..f4e8264eca29a536c77f26646bc2cab243a4cccf 100644 (file)
@@ -11,7 +11,7 @@ import be.nikiroo.fanfix.data.MetaData;
 import be.nikiroo.fanfix.data.Story;
 import be.nikiroo.utils.Progress;
 import be.nikiroo.utils.Version;
-import be.nikiroo.utils.serial.ConnectActionClient;
+import be.nikiroo.utils.serial.server.ConnectActionClientObject;
 
 /**
  * This {@link BasicLibrary} will access a remote server to list the available
@@ -145,25 +145,25 @@ public class RemoteLibrary extends BasicLibrary {
        private <T> T getRemoteObject(final Object[] command) {
                final Object[] result = new Object[1];
                try {
-                       new ConnectActionClient(host, port, true) {
+                       new ConnectActionClientObject(host, port, true) {
                                @Override
                                public void action(Version serverVersion) throws Exception {
                                        try {
                                                Object rep = send(command);
                                                result[0] = rep;
                                        } catch (Exception e) {
-                                               Instance.syserr(e);
+                                               Instance.getTraceHandler().error(e);
                                        }
                                }
                        }.connect();
                } catch (IOException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                }
 
                try {
                        return (T) result[0];
                } catch (Exception e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                        return null;
                }
        }
index d2d9a6e6fa870fd007d0617b18b540e49124bab8..583629382662294b9e6fb7e1279cd6001c35dc02 100644 (file)
@@ -8,8 +8,8 @@ import be.nikiroo.fanfix.Instance;
 import be.nikiroo.fanfix.data.MetaData;
 import be.nikiroo.fanfix.data.Story;
 import be.nikiroo.utils.Version;
-import be.nikiroo.utils.serial.ConnectActionServer;
-import be.nikiroo.utils.serial.Server;
+import be.nikiroo.utils.serial.server.ConnectActionServerObject;
+import be.nikiroo.utils.serial.server.ServerObject;
 
 /**
  * Create a new remote server that will listen for order on the given port.
@@ -32,7 +32,7 @@ import be.nikiroo.utils.serial.Server;
  * 
  * @author niki
  */
-public class RemoteLibraryServer extends Server {
+public class RemoteLibraryServer extends ServerObject {
        private final String key;
 
        /**
@@ -53,7 +53,7 @@ public class RemoteLibraryServer extends Server {
        }
 
        @Override
-       protected Object onRequest(ConnectActionServer action,
+       protected Object onRequest(ConnectActionServerObject action,
                        Version clientVersion, Object data) throws Exception {
                String key = "";
                String command = "";
index c7c80cc0a30f791540df9a675afcf1d8d8d204b5..a1b37913bc9e44789eb3d29801b88bc94362a0ad 100644 (file)
@@ -75,8 +75,8 @@ public class InfoCover {
                                                targetName + "." + format));
                        } catch (IOException e) {
                                // Allow to continue without cover
-                               Instance.syserr(new IOException(
-                                               "Failed to save the cover image", e));
+                               Instance.getTraceHandler().error(
+                                               new IOException("Failed to save the cover image", e));
                        }
                }
        }
index eef3aef55762930203e412ce8f776cd13481e9a6..0ea403c40f4fdf5af11da2d1345cf5184069b6fb 100644 (file)
@@ -133,7 +133,7 @@ public abstract class BasicReader implements Reader {
                                                .getTypeName());
                        }
                } catch (Exception e) {
-                       Instance.syserr(new Exception("Cannot create a reader of type: "
+                       Instance.getTraceHandler().error(new Exception("Cannot create a reader of type: "
                                        + defaultType + " (Not compiled in?)", e));
                }
 
index 9353794bf2d970884bf5ac2caec62d023bf285d6..b9d5954888333c57456d75f7027759ffcc55c2b8 100644 (file)
@@ -117,9 +117,9 @@ class GuiReader extends BasicReader {
                                                try {
                                                        Desktop.getDesktop().browse(e.getURL().toURI());
                                                } catch (IOException ee) {
-                                                       Instance.syserr(ee);
+                                                       Instance.getTraceHandler().error(ee);
                                                } catch (URISyntaxException ee) {
-                                                       Instance.syserr(ee);
+                                                       Instance.getTraceHandler().error(ee);
                                                }
                                }
                        });
@@ -152,7 +152,7 @@ class GuiReader extends BasicReader {
                try {
                        cacheLib.clearFromCache(luid);
                } catch (IOException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                }
        }
 
@@ -161,7 +161,7 @@ class GuiReader extends BasicReader {
                try {
                        cacheLib.delete(luid);
                } catch (IOException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                }
        }
 
@@ -177,7 +177,7 @@ class GuiReader extends BasicReader {
                try {
                        cacheLib.changeSource(luid, newSource, null);
                } catch (IOException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                }
        }
 }
index bf2b5ed96f233cd60a59228f5ac91f10080dd7cb..c70f30a8db69f11976c8b7345d322d8b21c8d074 100644 (file)
@@ -384,7 +384,7 @@ class GuiReaderBook extends JPanel {
                                in.close();
                                in = null;
                        } catch (IOException e) {
-                               Instance.syserr(e);
+                               Instance.getTraceHandler().error(e);
                        }
                }
 
@@ -424,9 +424,9 @@ class GuiReaderBook extends JPanel {
                                        in = null;
                                }
                        } catch (MalformedURLException e) {
-                               Instance.syserr(e);
+                               Instance.getTraceHandler().error(e);
                        } catch (IOException e) {
-                               Instance.syserr(e);
+                               Instance.getTraceHandler().error(e);
                        }
                }
 
index 1b4cb66ebac26d1cd0cc6483de2f657dd9d535cc..cd321ab49ad15ee7ebe5e6262074f9040bd10d25 100644 (file)
@@ -556,7 +556,7 @@ class GuiReaderFrame extends JFrame {
                                                                                        selectedBook.getMeta().getLuid(),
                                                                                        type, path, pg);
                                                                } catch (IOException e) {
-                                                                       Instance.syserr(e);
+                                                                       Instance.getTraceHandler().error(e);
                                                                }
                                                        }
                                                });
@@ -817,7 +817,7 @@ class GuiReaderFrame extends JFrame {
                                        });
                                } catch (IOException e) {
                                        // TODO: error message?
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
                        }
                });
@@ -940,7 +940,7 @@ class GuiReaderFrame extends JFrame {
 
                                pgOnSuccess.setProgress(0);
                                if (!ok) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                        SwingUtilities.invokeLater(new Runnable() {
                                                @Override
                                                public void run() {
index c71cf95f5be244914eda25cd46e4d69493452852..30b9dce5962972b86eaf27aadb5f31e0b81d0aa8 100644 (file)
@@ -54,7 +54,7 @@ class TuiReader extends BasicReader {
                                        guessBackendType());
                        new Thread(app).start();
                } catch (Exception e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                }
        }
 
@@ -65,7 +65,7 @@ class TuiReader extends BasicReader {
                                        guessBackendType());
                        new Thread(app).start();
                } catch (Exception e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                }
        }
 }
index f32070cd79128da30f069ee6738f13140e9eba73..10c6466ca887dd39b32b956dad0e9fc0ace89ffb 100644 (file)
@@ -151,7 +151,7 @@ class TuiReaderMainWindow extends TWindow {
                        reader.setMeta(meta);
                        reader.read();
                } catch (IOException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                }
        }
 
index fb261fb3a27fccc04ca40f98ffc56a596ac41427..ae7521ef279dc0dc025cc9eb399260fdc59825a1 100644 (file)
@@ -398,7 +398,7 @@ public abstract class BasicSupport {
                                try {
                                        close();
                                } catch (IOException e) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
 
                                if (in != null) {
@@ -519,7 +519,7 @@ public abstract class BasicSupport {
                        try {
                                close();
                        } catch (IOException e) {
-                               Instance.syserr(e);
+                               Instance.getTraceHandler().error(e);
                        }
 
                        if (in != null) {
index b041b6d468a30a81683465bef8968dd35c9c56e0..02c667c1032be681186b4e786907243c046eafd9 100644 (file)
@@ -97,7 +97,7 @@ class Cbz extends Epub {
                                                File tmp = Instance.getCache().addToCache(zipIn, uuid);
                                                images.add(tmp.toURI().toURL().toString());
                                        } catch (Exception e) {
-                                               Instance.syserr(e);
+                                               Instance.getTraceHandler().error(e);
                                        }
                                }
                        }
@@ -113,7 +113,7 @@ class Cbz extends Epub {
                        try {
                                chap.getParagraphs().add(new Paragraph(new URL(uuid)));
                        } catch (Exception e) {
-                               Instance.syserr(e);
+                               Instance.getTraceHandler().error(e);
                        }
                }
 
index fe993a1d8b53be0503e6f374132f12dfbc69acf1..a25a99493ffb2fe18db1e0dfb12ffe1f1583a81e 100644 (file)
@@ -267,7 +267,7 @@ class EHentai extends BasicSupport {
                                try {
                                        pages.add(new URL(line));
                                } catch (MalformedURLException e) {
-                                       Instance.syserr(new IOException(
+                                       Instance.getTraceHandler().error(new IOException(
                                                        "Parsing error, a link is not correctly parsed: "
                                                                        + line, e));
                                }
index b8c4af073805e5be8866213d4036936696bb334d..ad4d65f5a4c180b8d68db15e4d0d0a860e72cfdd 100644 (file)
@@ -128,7 +128,7 @@ class Epub extends InfoText {
                                                try {
                                                        cover = ImageUtils.fromStream(zipIn);
                                                } catch (Exception e) {
-                                                       Instance.syserr(e);
+                                                       Instance.getTraceHandler().error(e);
                                                }
                                        }
                                } else if (entry.getName().equals(getDataPrefix() + "URL")) {
index fd514931848e72baca337054d0d3333f558e52a7..43f16c89b0c2526289721db103bac3308acb5c5b 100644 (file)
@@ -161,7 +161,7 @@ class Fanfiction extends BasicSupport {
                                                return sdf
                                                                .format(new Date(1000 * Long.parseLong(line)));
                                        } catch (NumberFormatException e) {
-                                               Instance.syserr(new IOException(
+                                               Instance.getTraceHandler().error(new IOException(
                                                                "Cannot convert publication date: " + line, e));
                                        }
                                }
@@ -261,7 +261,7 @@ class Fanfiction extends BasicSupport {
                                                                }
                                                        });
                                                } catch (MalformedURLException e) {
-                                                       Instance.syserr(new IOException(
+                                                       Instance.getTraceHandler().error(new IOException(
                                                                        "Cannot parse chapter " + i + " url: "
                                                                                        + (base + i + suffix), e));
                                                }
index cb26ac6fc42939682ff716d987e305f4aa720ef6..24aca5d4169353268d5d4ca1df0e1ae0d712f243 100644 (file)
@@ -251,7 +251,7 @@ class Fimfiction extends BasicSupport {
                                                        }
                                                });
                                        } catch (MalformedURLException e) {
-                                               Instance.syserr(e);
+                                               Instance.getTraceHandler().error(e);
                                        }
                                }
                        }
index 771d5102e8a10fb416747eaa18cb2339a75fc321..9ede84483aadbae697d2c04b19980fa682fbc945 100644 (file)
@@ -67,7 +67,7 @@ class InfoText extends Text {
                                file = new File(url.toURI());
                                file = new File(file.getPath() + ".info");
                        } catch (URISyntaxException e) {
-                               Instance.syserr(e);
+                               Instance.getTraceHandler().error(e);
                                file = null;
                        }
 
index d6f146429bf19a4c67d4b7305c89a9c96f8d7229..502cb10188a30a0104bf1343e04021a2428ae496 100644 (file)
@@ -103,7 +103,7 @@ class MangaFox extends BasicSupport {
                try {
                        in.reset();
                } catch (IOException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                }
 
                line = getLine(in, "/artist/", 0, false);
@@ -262,7 +262,7 @@ class MangaFox extends BasicSupport {
                                                }
                                        });
                                } catch (MalformedURLException e) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
                        }
                }
@@ -309,7 +309,7 @@ class MangaFox extends BasicSupport {
                        try {
                                in.reset();
                        } catch (IOException e) {
-                               Instance.syserr(e);
+                               Instance.getTraceHandler().error(e);
                        }
 
                        String linkImageLine = getLine(in, "return enlarge()", 1);
@@ -348,7 +348,7 @@ class MangaFox extends BasicSupport {
                                try {
                                        in.close();
                                } catch (IOException e) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
                        }
 
@@ -361,7 +361,7 @@ class MangaFox extends BasicSupport {
                                        setCurrentReferer(url);
                                        pg.setProgress((i++) % pg.getMax());
                                } catch (IOException e) {
-                                       Instance.syserr(new IOException(
+                                       Instance.getTraceHandler().error(new IOException(
                                                        "Cannot get the next manga page which is: "
                                                                        + linkNext, e));
                                }
index c9ebd18d108ddac863b5182c9554033fe2e78f6e..ff9d264f8494b9d68ddf73fc557acc539b59044b 100644 (file)
@@ -156,7 +156,7 @@ class Text extends BasicSupport {
                try {
                        path = new File(source.toURI()).getPath();
                } catch (URISyntaxException e) {
-                       Instance.syserr(e);
+                       Instance.getTraceHandler().error(e);
                        path = null;
                }
 
@@ -242,7 +242,7 @@ class Text extends BasicSupport {
                                file = new File(url.toURI());
                                file = new File(file.getPath() + ".info");
                        } catch (URISyntaxException e) {
-                               Instance.syserr(e);
+                               Instance.getTraceHandler().error(e);
                                file = null;
                        }