Remove or move java.awt dependencies
[fanfix.git] / src / be / nikiroo / fanfix / supported / EHentai.java
index 363635488e35a514f0b5bbb0929b85b5ef605bae..c082b9144cae7bc7d76f781e7d57b97d64ea7186 100644 (file)
@@ -1,6 +1,5 @@
 package be.nikiroo.fanfix.supported;
 
-import java.awt.image.BufferedImage;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
@@ -14,6 +13,7 @@ import be.nikiroo.fanfix.Instance;
 import be.nikiroo.fanfix.data.Chapter;
 import be.nikiroo.fanfix.data.MetaData;
 import be.nikiroo.fanfix.data.Story;
+import be.nikiroo.utils.Image;
 import be.nikiroo.utils.Progress;
 import be.nikiroo.utils.StringUtils;
 
@@ -78,9 +78,8 @@ class EHentai extends BasicSupport {
                return true;
        }
 
-       private BufferedImage getCover(URL source, InputStream in)
-                       throws IOException {
-               BufferedImage author = null;
+       private Image getCover(URL source, InputStream in) {
+               Image author = null;
                String coverLine = getKeyLine(in, "<div id=\"gd1\"", " url(", ")");
                if (coverLine != null) {
                        coverLine = StringUtils.unhtml(coverLine).trim();
@@ -167,7 +166,7 @@ class EHentai extends BasicSupport {
                return tags;
        }
 
-       private String getTitle(InputStream in) throws IOException {
+       private String getTitle(InputStream in) {
                String siteName = " - E-Hentai Galleries";
 
                String title = getLine(in, "<title>", 0);
@@ -233,14 +232,17 @@ class EHentai extends BasicSupport {
                        final String key = Integer.toString(i + 1);
                        final URL value = new URL(source.toString() + "?p=" + i);
                        urls.add(new Entry<String, URL>() {
+                               @Override
                                public URL setValue(URL value) {
                                        return null;
                                }
 
+                               @Override
                                public URL getValue() {
                                        return value;
                                }
 
+                               @Override
                                public String getKey() {
                                        return key;
                                }
@@ -265,9 +267,10 @@ class EHentai extends BasicSupport {
                                try {
                                        pages.add(new URL(line));
                                } catch (MalformedURLException e) {
-                                       Instance.syserr(new IOException(
-                                                       "Parsing error, a link is not correctly parsed: "
-                                                                       + line, e));
+                                       Instance.getTraceHandler().error(
+                                                       new IOException(
+                                                                       "Parsing error, a link is not correctly parsed: "
+                                                                                       + line, e));
                                }
                        }
                }