Update nikiroo-utils, remove Instance.syserr/trace
[fanfix.git] / src / be / nikiroo / fanfix / supported / MangaFox.java
index a379e877ecb5c5d296b85708b0b48ac89e856716..502cb10188a30a0104bf1343e04021a2428ae496 100644 (file)
@@ -13,7 +13,7 @@ import java.util.Scanner;
 
 import be.nikiroo.fanfix.Instance;
 import be.nikiroo.fanfix.data.MetaData;
-import be.nikiroo.utils.IOUtils;
+import be.nikiroo.utils.ImageUtils;
 import be.nikiroo.utils.Progress;
 import be.nikiroo.utils.StringUtils;
 
@@ -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);
@@ -118,18 +118,18 @@ class MangaFox extends BasicSupport {
 
                if (authors.isEmpty()) {
                        return null;
-               } else {
-                       StringBuilder builder = new StringBuilder();
-                       for (String author : authors) {
-                               if (builder.length() > 0) {
-                                       builder.append(", ");
-                               }
+               }
 
-                               builder.append(author);
+               StringBuilder builder = new StringBuilder();
+               for (String author : authors) {
+                       if (builder.length() > 0) {
+                               builder.append(", ");
                        }
 
-                       return builder.toString();
+                       builder.append(author);
                }
+
+               return builder.toString();
        }
 
        private String getDate(InputStream in) {
@@ -186,7 +186,7 @@ class MangaFox extends BasicSupport {
                        try {
                                coverIn = openEx(cover);
                                try {
-                                       return IOUtils.toImage(coverIn);
+                                       return ImageUtils.fromStream(coverIn);
                                } finally {
                                        coverIn.close();
                                }
@@ -246,20 +246,23 @@ class MangaFox extends BasicSupport {
                                        final String key = name;
                                        final URL value = new URL(url);
                                        urls.add(new Entry<String, URL>() {
+                                               @Override
                                                public URL setValue(URL value) {
                                                        return null;
                                                }
 
+                                               @Override
                                                public String getKey() {
                                                        return key;
                                                }
 
+                                               @Override
                                                public URL getValue() {
                                                        return value;
                                                }
                                        });
                                } catch (MalformedURLException e) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
                        }
                }
@@ -306,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);
@@ -345,7 +348,7 @@ class MangaFox extends BasicSupport {
                                try {
                                        in.close();
                                } catch (IOException e) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
                        }
 
@@ -358,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));
                                }