From: Niki Roo Date: Tue, 28 Nov 2017 12:50:46 +0000 (+0100) Subject: Update nikiroo-utils, remove Instance.syserr/trace X-Git-Tag: fanfix-1.6.3~25 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=62c63b0724f4bc45999cb2e7186b4b3ada479a0a;p=fanfix.git Update nikiroo-utils, remove Instance.syserr/trace --- diff --git a/libs/nikiroo-utils-2.2.3-sources.jar b/libs/nikiroo-utils-3.0.0-sources.jar similarity index 80% rename from libs/nikiroo-utils-2.2.3-sources.jar rename to libs/nikiroo-utils-3.0.0-sources.jar index 55e697f..82feb00 100644 Binary files a/libs/nikiroo-utils-2.2.3-sources.jar and b/libs/nikiroo-utils-3.0.0-sources.jar differ diff --git a/src/be/nikiroo/fanfix/DataLoader.java b/src/be/nikiroo/fanfix/DataLoader.java index e4f40a3..2fd59d8 100644 --- a/src/be/nikiroo/fanfix/DataLoader.java +++ b/src/be/nikiroo/fanfix/DataLoader.java @@ -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 { diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index 97e9868..ef0ba15 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -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}. + *

+ * 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. * diff --git a/src/be/nikiroo/fanfix/Main.java b/src/be/nikiroo/fanfix/Main.java index 813a9b4..70f71ed 100644 --- a/src/be/nikiroo/fanfix/Main.java +++ b/src/be/nikiroo/fanfix/Main.java @@ -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; } } diff --git a/src/be/nikiroo/fanfix/VersionCheck.java b/src/be/nikiroo/fanfix/VersionCheck.java index 9324495..62ee814 100644 --- a/src/be/nikiroo/fanfix/VersionCheck.java +++ b/src/be/nikiroo/fanfix/VersionCheck.java @@ -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)); } } diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index d324008..66fb943 100644 --- a/src/be/nikiroo/fanfix/library/BasicLibrary.java +++ b/src/be/nikiroo/fanfix/library/BasicLibrary.java @@ -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(); diff --git a/src/be/nikiroo/fanfix/library/CacheLibrary.java b/src/be/nikiroo/fanfix/library/CacheLibrary.java index d653332..da6f56d 100644 --- a/src/be/nikiroo/fanfix/library/CacheLibrary.java +++ b/src/be/nikiroo/fanfix/library/CacheLibrary.java @@ -80,7 +80,7 @@ public class CacheLibrary extends BasicLibrary { pgImport.done(); clearCache(); } catch (IOException e) { - Instance.syserr(e); + Instance.getTraceHandler().error(e); } pgImport.done(); diff --git a/src/be/nikiroo/fanfix/library/LocalLibrary.java b/src/be/nikiroo/fanfix/library/LocalLibrary.java index 11c3663..917ce09 100644 --- a/src/be/nikiroo/fanfix/library/LocalLibrary.java +++ b/src/be/nikiroo/fanfix/library/LocalLibrary.java @@ -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); } } diff --git a/src/be/nikiroo/fanfix/library/RemoteLibrary.java b/src/be/nikiroo/fanfix/library/RemoteLibrary.java index 0a747bd..f4e8264 100644 --- a/src/be/nikiroo/fanfix/library/RemoteLibrary.java +++ b/src/be/nikiroo/fanfix/library/RemoteLibrary.java @@ -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 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; } } diff --git a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java index d2d9a6e..5836293 100644 --- a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java +++ b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java @@ -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 = ""; diff --git a/src/be/nikiroo/fanfix/output/InfoCover.java b/src/be/nikiroo/fanfix/output/InfoCover.java index c7c80cc..a1b3791 100644 --- a/src/be/nikiroo/fanfix/output/InfoCover.java +++ b/src/be/nikiroo/fanfix/output/InfoCover.java @@ -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)); } } } diff --git a/src/be/nikiroo/fanfix/reader/BasicReader.java b/src/be/nikiroo/fanfix/reader/BasicReader.java index eef3aef..0ea403c 100644 --- a/src/be/nikiroo/fanfix/reader/BasicReader.java +++ b/src/be/nikiroo/fanfix/reader/BasicReader.java @@ -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)); } diff --git a/src/be/nikiroo/fanfix/reader/GuiReader.java b/src/be/nikiroo/fanfix/reader/GuiReader.java index 9353794..b9d5954 100644 --- a/src/be/nikiroo/fanfix/reader/GuiReader.java +++ b/src/be/nikiroo/fanfix/reader/GuiReader.java @@ -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); } } } diff --git a/src/be/nikiroo/fanfix/reader/GuiReaderBook.java b/src/be/nikiroo/fanfix/reader/GuiReaderBook.java index bf2b5ed..c70f30a 100644 --- a/src/be/nikiroo/fanfix/reader/GuiReaderBook.java +++ b/src/be/nikiroo/fanfix/reader/GuiReaderBook.java @@ -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); } } diff --git a/src/be/nikiroo/fanfix/reader/GuiReaderFrame.java b/src/be/nikiroo/fanfix/reader/GuiReaderFrame.java index 1b4cb66..cd321ab 100644 --- a/src/be/nikiroo/fanfix/reader/GuiReaderFrame.java +++ b/src/be/nikiroo/fanfix/reader/GuiReaderFrame.java @@ -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() { diff --git a/src/be/nikiroo/fanfix/reader/TuiReader.java b/src/be/nikiroo/fanfix/reader/TuiReader.java index c71cf95..30b9dce 100644 --- a/src/be/nikiroo/fanfix/reader/TuiReader.java +++ b/src/be/nikiroo/fanfix/reader/TuiReader.java @@ -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); } } } diff --git a/src/be/nikiroo/fanfix/reader/TuiReaderMainWindow.java b/src/be/nikiroo/fanfix/reader/TuiReaderMainWindow.java index f32070c..10c6466 100644 --- a/src/be/nikiroo/fanfix/reader/TuiReaderMainWindow.java +++ b/src/be/nikiroo/fanfix/reader/TuiReaderMainWindow.java @@ -151,7 +151,7 @@ class TuiReaderMainWindow extends TWindow { reader.setMeta(meta); reader.read(); } catch (IOException e) { - Instance.syserr(e); + Instance.getTraceHandler().error(e); } } diff --git a/src/be/nikiroo/fanfix/supported/BasicSupport.java b/src/be/nikiroo/fanfix/supported/BasicSupport.java index fb261fb..ae7521e 100644 --- a/src/be/nikiroo/fanfix/supported/BasicSupport.java +++ b/src/be/nikiroo/fanfix/supported/BasicSupport.java @@ -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) { diff --git a/src/be/nikiroo/fanfix/supported/Cbz.java b/src/be/nikiroo/fanfix/supported/Cbz.java index b041b6d..02c667c 100644 --- a/src/be/nikiroo/fanfix/supported/Cbz.java +++ b/src/be/nikiroo/fanfix/supported/Cbz.java @@ -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); } } diff --git a/src/be/nikiroo/fanfix/supported/EHentai.java b/src/be/nikiroo/fanfix/supported/EHentai.java index fe993a1..a25a994 100644 --- a/src/be/nikiroo/fanfix/supported/EHentai.java +++ b/src/be/nikiroo/fanfix/supported/EHentai.java @@ -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)); } diff --git a/src/be/nikiroo/fanfix/supported/Epub.java b/src/be/nikiroo/fanfix/supported/Epub.java index b8c4af0..ad4d65f 100644 --- a/src/be/nikiroo/fanfix/supported/Epub.java +++ b/src/be/nikiroo/fanfix/supported/Epub.java @@ -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")) { diff --git a/src/be/nikiroo/fanfix/supported/Fanfiction.java b/src/be/nikiroo/fanfix/supported/Fanfiction.java index fd51493..43f16c8 100644 --- a/src/be/nikiroo/fanfix/supported/Fanfiction.java +++ b/src/be/nikiroo/fanfix/supported/Fanfiction.java @@ -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)); } diff --git a/src/be/nikiroo/fanfix/supported/Fimfiction.java b/src/be/nikiroo/fanfix/supported/Fimfiction.java index cb26ac6..24aca5d 100644 --- a/src/be/nikiroo/fanfix/supported/Fimfiction.java +++ b/src/be/nikiroo/fanfix/supported/Fimfiction.java @@ -251,7 +251,7 @@ class Fimfiction extends BasicSupport { } }); } catch (MalformedURLException e) { - Instance.syserr(e); + Instance.getTraceHandler().error(e); } } } diff --git a/src/be/nikiroo/fanfix/supported/InfoText.java b/src/be/nikiroo/fanfix/supported/InfoText.java index 771d510..9ede844 100644 --- a/src/be/nikiroo/fanfix/supported/InfoText.java +++ b/src/be/nikiroo/fanfix/supported/InfoText.java @@ -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; } diff --git a/src/be/nikiroo/fanfix/supported/MangaFox.java b/src/be/nikiroo/fanfix/supported/MangaFox.java index d6f1464..502cb10 100644 --- a/src/be/nikiroo/fanfix/supported/MangaFox.java +++ b/src/be/nikiroo/fanfix/supported/MangaFox.java @@ -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)); } diff --git a/src/be/nikiroo/fanfix/supported/Text.java b/src/be/nikiroo/fanfix/supported/Text.java index c9ebd18..ff9d264 100644 --- a/src/be/nikiroo/fanfix/supported/Text.java +++ b/src/be/nikiroo/fanfix/supported/Text.java @@ -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; }