Don't check against NULL on NotNull
[nikiroo-utils.git] / src / be / nikiroo / fanfix / supported / BasicSupport.java
index e6089eb046aff22654778d60678c235ea75745ea..66ba64d621ac82e1498d009367da08cb044f0f19 100644 (file)
@@ -202,7 +202,7 @@ public abstract class BasicSupport {
         * @param in
         *            the input (the main resource)
         * 
-        * @return the associated {@link MetaData}
+        * @return the associated {@link MetaData}, never NULL
         * 
         * @throws IOException
         *             in case of I/O error
@@ -342,7 +342,7 @@ public abstract class BasicSupport {
         * @param pg
         *            the optional progress reporter
         * 
-        * @return the {@link Story}
+        * @return the {@link Story}, never NULL
         * 
         * @throws IOException
         *             in case of I/O error
@@ -398,7 +398,7 @@ public abstract class BasicSupport {
                                try {
                                        close();
                                } catch (IOException e) {
-                                       Instance.syserr(e);
+                                       Instance.getTraceHandler().error(e);
                                }
 
                                if (in != null) {
@@ -419,7 +419,7 @@ public abstract class BasicSupport {
         * @param pg
         *            the optional progress reporter
         * 
-        * @return the {@link Story}
+        * @return the {@link Story}, never NULL
         * 
         * @throws IOException
         *             in case of I/O error
@@ -441,11 +441,6 @@ public abstract class BasicSupport {
                                pgMeta.setProgress(pgMeta.getMax()); // 10%
                        }
 
-                       if (story == null) {
-                               pg.setProgress(90);
-                               return null;
-                       }
-
                        pg.setName("Retrieving " + story.getMeta().getTitle());
 
                        setCurrentReferer(url);
@@ -496,9 +491,7 @@ public abstract class BasicSupport {
 
                                                words += cc.getWords();
                                                story.getChapters().add(cc);
-                                               if (story.getMeta() != null) {
-                                                       story.getMeta().setWords(words);
-                                               }
+                                               story.getMeta().setWords(words);
                                        } finally {
                                                if (chapIn != null) {
                                                        chapIn.close();
@@ -519,7 +512,7 @@ public abstract class BasicSupport {
                        try {
                                close();
                        } catch (IOException e) {
-                               Instance.syserr(e);
+                               Instance.getTraceHandler().error(e);
                        }
 
                        if (in != null) {
@@ -757,10 +750,10 @@ public abstract class BasicSupport {
         * @return the {@link Paragraph}
         */
        private Paragraph makeParagraph(URL source, String line) {
-               URL image = null;
+               BufferedImage image = null;
                if (line.startsWith("[") && line.endsWith("]")) {
-                       image = getImageUrl(this, source,
-                                       line.substring(1, line.length() - 1).trim());
+                       image = getImage(this, source, line.substring(1, line.length() - 1)
+                                       .trim());
                }
 
                if (image != null) {
@@ -941,7 +934,8 @@ public abstract class BasicSupport {
                                // try for URLs
                                try {
                                        for (String ext : getImageExt(true)) {
-                                               if (Instance.getCache().check(new URL(line + ext))) {
+                                               if (Instance.getCache()
+                                                               .check(new URL(line + ext), true)) {
                                                        url = new URL(line + ext);
                                                        break;
                                                }