Add more warnings source to 1.6) and fix warnings
authorNiki Roo <niki@nikiroo.be>
Sat, 8 Jul 2017 04:23:51 +0000 (06:23 +0200)
committerNiki Roo <niki@nikiroo.be>
Sat, 8 Jul 2017 04:23:51 +0000 (06:23 +0200)
31 files changed:
src/be/nikiroo/fanfix/Cache.java
src/be/nikiroo/fanfix/Main.java
src/be/nikiroo/fanfix/bundles/StringId.java
src/be/nikiroo/fanfix/data/Chapter.java
src/be/nikiroo/fanfix/data/MetaData.java
src/be/nikiroo/fanfix/data/Paragraph.java
src/be/nikiroo/fanfix/data/Story.java
src/be/nikiroo/fanfix/library/LocalLibrary.java
src/be/nikiroo/fanfix/library/RemoteLibrary.java
src/be/nikiroo/fanfix/output/BasicOutput.java
src/be/nikiroo/fanfix/output/Html.java
src/be/nikiroo/fanfix/reader/BasicReader.java
src/be/nikiroo/fanfix/reader/CliReader.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/GuiReaderGroup.java
src/be/nikiroo/fanfix/reader/Reader.java
src/be/nikiroo/fanfix/reader/TuiReader.java
src/be/nikiroo/fanfix/reader/TuiReaderApplication.java
src/be/nikiroo/fanfix/reader/TuiReaderStoryWindow.java
src/be/nikiroo/fanfix/supported/BasicSupport.java
src/be/nikiroo/fanfix/supported/E621.java
src/be/nikiroo/fanfix/supported/EHentai.java
src/be/nikiroo/fanfix/supported/Fanfiction.java
src/be/nikiroo/fanfix/supported/Fimfiction.java
src/be/nikiroo/fanfix/supported/InfoReader.java
src/be/nikiroo/fanfix/supported/MangaFox.java
src/be/nikiroo/fanfix/supported/Text.java
src/be/nikiroo/fanfix/supported/YiffStar.java
src/be/nikiroo/fanfix/test/BasicSupportTest.java

index f7e1a81ad0699f70d46b6f03edd53574b3319d37..40ce15efec98860c559177dc0734c3b68377f797 100644 (file)
@@ -396,16 +396,21 @@ public class Cache {
         * 
         * @param url
         *            the resource to open
+        * @param allowTooOld
+        *            allow files even if they are considered too old
+        * @param stable
+        *            a stable file (that dones't change too often) -- parameter
+        *            used to check if the file is too old to keep or not
         * 
         * @return the opened resource if found, NULL i not
         * 
         * @throws IOException
         *             in case of I/O error
         */
-       private InputStream load(URL url, boolean allowOld, boolean stable)
+       private InputStream load(URL url, boolean allowTooOld, boolean stable)
                        throws IOException {
                File cached = getCached(url);
-               if (cached.exists() && !isOld(cached, stable)) {
+               if (cached.exists() && (allowTooOld || !isOld(cached, stable))) {
                        return new MarkableFileInputStream(new FileInputStream(cached));
                }
 
index adbd5a374bb3f280dd43a6dd6581a61ab0f1e789..9ac48845ce87d4bc57416bfd2daf7e7f30fa4364 100644 (file)
@@ -199,6 +199,7 @@ public class Main {
                mainProgress.addProgressListener(new Progress.ProgressListener() {
                        private int current = mainProgress.getMin();
 
+                       @Override
                        public void progress(Progress progress, String name) {
                                int diff = progress.getProgress() - current;
                                current += diff;
index c49627f86f93f77108a7a59d032067e546746970..6ccb7725ac3e853df83f327ad90a362b01e2ca05 100644 (file)
@@ -142,4 +142,4 @@ public enum StringId {
                writer.write("# Also, the comments always refer to the key below them.\n");
                writer.write("# \n");
        }
-};
+}
index d9f285f96762ce135b8046578f0df9d75d31b819..86856b0e2c09f5fa6ee1c4faf0f7586c1079dbf7 100644 (file)
@@ -19,6 +19,7 @@ public class Chapter implements Iterable<Paragraph> {
        /**
         * Empty constructor, not to use.
         */
+       @SuppressWarnings("unused")
        private Chapter() {
                // for serialisation purposes
        }
@@ -96,6 +97,7 @@ public class Chapter implements Iterable<Paragraph> {
        /**
         * Get an iterator on the {@link Paragraph}s.
         */
+       @Override
        public Iterator<Paragraph> iterator() {
                return paragraphs == null ? empty.iterator() : paragraphs.iterator();
        }
index 872baff2c1323a6e0f31f4a3b055273d7a4b07df..c969ec9366f5c7d7e45a1ae5e3701b6b4a521020 100644 (file)
@@ -377,6 +377,7 @@ public class MetaData implements Cloneable, Comparable<MetaData> {
                this.fakeCover = fakeCover;
        }
 
+       @Override
        public int compareTo(MetaData o) {
                String oUuid = o == null ? null : o.getUuid();
                return getUuid().compareTo(oUuid);
index 8a9130bf83fdcc8342a796f125a64a1aa994ea4c..1a7429a403a8a6f0bc0742fb29f14ad2d7811da5 100644 (file)
@@ -33,6 +33,7 @@ public class Paragraph {
        /**
         * Empty constructor, not to use.
         */
+       @SuppressWarnings("unused")
        private Paragraph() {
                // for serialisation purposes
        }
index cb65119149414a2eef6a9db75aca333950e4e36e..7ebfbc598d945e1502352872daa8b0e55dbbbaa0 100644 (file)
@@ -55,6 +55,7 @@ public class Story implements Iterable<Chapter> {
        /**
         * Get an iterator on the {@link Chapter}s.
         */
+       @Override
        public Iterator<Chapter> iterator() {
                return chapters == null ? empty.iterator() : chapters.iterator();
        }
index e4dc5e98bce53547c4c7d5ad2cee833e0e95bee0..d7fd5212ed8bddaec5afca42179f37c9b4d80ee6 100644 (file)
@@ -161,9 +161,9 @@ public class LocalLibrary extends BasicLibrary {
        private OutputType getOutputType(MetaData meta) {
                if (meta != null && meta.isImageDocument()) {
                        return image;
-               } else {
-                       return text;
                }
+
+               return text;
        }
 
        /**
@@ -238,39 +238,39 @@ public class LocalLibrary extends BasicLibrary {
                MetaData meta = getInfo(luid);
                if (meta == null) {
                        throw new IOException("Story not found: " + luid);
-               } else {
-                       File infoFile = getStories(null).get(meta)[0];
-                       File targetFile = getStories(null).get(meta)[1];
+               }
 
-                       files.add(infoFile);
-                       files.add(targetFile);
+               File infoFile = getStories(null).get(meta)[0];
+               File targetFile = getStories(null).get(meta)[1];
 
-                       String readerExt = getOutputType(meta).getDefaultExtension(true);
-                       String fileExt = getOutputType(meta).getDefaultExtension(false);
+               files.add(infoFile);
+               files.add(targetFile);
 
-                       String path = targetFile.getAbsolutePath();
-                       if (readerExt != null && !readerExt.equals(fileExt)) {
-                               path = path.substring(0, path.length() - readerExt.length())
-                                               + fileExt;
-                               File relatedFile = new File(path);
+               String readerExt = getOutputType(meta).getDefaultExtension(true);
+               String fileExt = getOutputType(meta).getDefaultExtension(false);
 
-                               if (relatedFile.exists()) {
-                                       files.add(relatedFile);
-                               }
-                       }
+               String path = targetFile.getAbsolutePath();
+               if (readerExt != null && !readerExt.equals(fileExt)) {
+                       path = path.substring(0, path.length() - readerExt.length())
+                                       + fileExt;
+                       File relatedFile = new File(path);
 
-                       String coverExt = "."
-                                       + Instance.getConfig().getString(Config.IMAGE_FORMAT_COVER);
-                       File coverFile = new File(path + coverExt);
-                       if (!coverFile.exists()) {
-                               coverFile = new File(path.substring(0,
-                                               path.length() - fileExt.length())
-                                               + coverExt);
+                       if (relatedFile.exists()) {
+                               files.add(relatedFile);
                        }
+               }
 
-                       if (coverFile.exists()) {
-                               files.add(coverFile);
-                       }
+               String coverExt = "."
+                               + Instance.getConfig().getString(Config.IMAGE_FORMAT_COVER);
+               File coverFile = new File(path + coverExt);
+               if (!coverFile.exists()) {
+                       coverFile = new File(path.substring(0,
+                                       path.length() - fileExt.length())
+                                       + coverExt);
+               }
+
+               if (coverFile.exists()) {
+                       files.add(coverFile);
                }
 
                return files;
@@ -301,6 +301,7 @@ public class LocalLibrary extends BasicLibrary {
                        lastId = 0;
 
                        File[] dirs = baseDir.listFiles(new FileFilter() {
+                               @Override
                                public boolean accept(File file) {
                                        return file != null && file.isDirectory();
                                }
@@ -311,6 +312,7 @@ public class LocalLibrary extends BasicLibrary {
 
                        for (File dir : dirs) {
                                File[] infoFiles = dir.listFiles(new FileFilter() {
+                                       @Override
                                        public boolean accept(File file) {
                                                return file != null
                                                                && file.getPath().toLowerCase()
index 6c1e56f5d22f4ceee61ab260b722352efe583225..511d1c1580cbf607069ab4c1b6fb34b6a1602843 100644 (file)
@@ -57,6 +57,7 @@ public class RemoteLibrary extends BasicLibrary {
 
                        try {
                                new ConnectActionClient(host, port, true, null) {
+                                       @Override
                                        public void action(Version serverVersion) throws Exception {
                                                try {
                                                        Object rep = send("GET_METADATA *");
@@ -83,6 +84,7 @@ public class RemoteLibrary extends BasicLibrary {
                        final File[] tmp = new File[1];
                        try {
                                new ConnectActionClient(host, port, true, null) {
+                                       @Override
                                        public void action(Version serverVersion) throws Exception {
                                                try {
                                                        Object rep = send("GET_STORY " + luid);
index 909c8fe9707b6a76a05d6ebdf151193142757b6e..4607827b14e8010e98b844d0becd3c3df2e61463 100644 (file)
@@ -45,6 +45,7 @@ public abstract class BasicOutput {
 
                ;
 
+               @Override
                public String toString() {
                        return super.toString().toLowerCase();
                }
@@ -267,25 +268,32 @@ public abstract class BasicOutput {
         * 
         * @return the extension
         */
-       public String getDefaultExtension(boolean readerTarget) {
+       public String getDefaultExtension(
+                       @SuppressWarnings("unused") boolean readerTarget) {
                return "";
        }
 
+       @SuppressWarnings("unused")
        protected void writeStoryHeader(Story story) throws IOException {
        }
 
+       @SuppressWarnings("unused")
        protected void writeChapterHeader(Chapter chap) throws IOException {
        }
 
+       @SuppressWarnings("unused")
        protected void writeParagraphHeader(Paragraph para) throws IOException {
        }
 
+       @SuppressWarnings("unused")
        protected void writeStoryFooter(Story story) throws IOException {
        }
 
+       @SuppressWarnings("unused")
        protected void writeChapterFooter(Chapter chap) throws IOException {
        }
 
+       @SuppressWarnings("unused")
        protected void writeParagraphFooter(Paragraph para) throws IOException {
        }
 
@@ -367,6 +375,7 @@ public abstract class BasicOutput {
                writeParagraphFooter(para);
        }
 
+       @SuppressWarnings("unused")
        protected void writeTextLine(ParagraphType type, String line)
                        throws IOException {
        }
index dca0fc4a7d1bb48f45a8bd4b502ad5bdfb35b580..581c9495e7ccbf7d7ebf6ca5da2acb56fe73d175 100644 (file)
@@ -64,9 +64,9 @@ class Html extends BasicOutput {
        public String getDefaultExtension(boolean readerTarget) {
                if (readerTarget) {
                        return File.separator + "index.html";
-               } else {
-                       return "";
                }
+
+               return "";
        }
 
        @Override
index cf83788e7bfc2c239198bdfff4761a677cd85f02..a261c04b4db36c2bd9a7c366b24b25ff0b09e2eb 100644 (file)
@@ -48,6 +48,7 @@ public abstract class BasicReader implements Reader {
                }
        }
 
+       @Override
        public synchronized Story getStory(Progress pg) {
                if (story == null) {
                        story = getLibrary().getStory(meta.getLuid(), pg);
@@ -56,6 +57,7 @@ public abstract class BasicReader implements Reader {
                return story;
        }
 
+       @Override
        public BasicLibrary getLibrary() {
                if (lib == null) {
                        lib = defaultLibrary;
@@ -64,18 +66,22 @@ public abstract class BasicReader implements Reader {
                return lib;
        }
 
+       @Override
        public void setLibrary(BasicLibrary lib) {
                this.lib = lib;
        }
 
+       @Override
        public MetaData getMeta() {
                return meta;
        }
 
+       @Override
        public synchronized void setMeta(MetaData meta) throws IOException {
                setMeta(meta == null ? null : meta.getLuid()); // must check the library
        }
 
+       @Override
        public synchronized void setMeta(String luid) throws IOException {
                story = null;
                meta = getLibrary().getInfo(luid);
@@ -85,6 +91,7 @@ public abstract class BasicReader implements Reader {
                }
        }
 
+       @Override
        public synchronized void setMeta(URL source, Progress pg)
                        throws IOException {
                BasicSupport support = BasicSupport.getSupport(source);
@@ -102,10 +109,12 @@ public abstract class BasicReader implements Reader {
                meta = story.getMeta();
        }
 
+       @Override
        public int getChapter() {
                return chapter;
        }
 
+       @Override
        public void setChapter(int chapter) {
                this.chapter = chapter;
        }
index 8a45885646cde715febce086981272157c04997c..2f0b8cee32910ffae7e31374b807a3cd2d65f32c 100644 (file)
@@ -18,6 +18,7 @@ import be.nikiroo.fanfix.data.Story;
  * @author niki
  */
 class CliReader extends BasicReader {
+       @Override
        public void read() throws IOException {
                MetaData meta = getMeta();
 
@@ -78,6 +79,7 @@ class CliReader extends BasicReader {
                }
        }
 
+       @Override
        public void browse(String source) {
                List<MetaData> stories;
                stories = getLibrary().getListBySource(source);
index 932425838629c945309cfd3979f285ee5b1d0e9a..0faea6e031d9fb712ad6a04bc0a6cfb8adfa2dc9 100644 (file)
@@ -70,6 +70,7 @@ class GuiReader extends BasicReader {
                localLibrary = new LocalLibrary(dir, text, images);
        }
 
+       @Override
        public void read() throws IOException {
                MetaData meta = getMeta();
 
@@ -127,6 +128,7 @@ class GuiReader extends BasicReader {
                return localLibrary.getInfo(luid) != null;
        }
 
+       @Override
        public void browse(String type) {
                // TODO: improve presentation of update message
                final VersionCheck updates = VersionCheck.check();
@@ -154,6 +156,7 @@ class GuiReader extends BasicReader {
 
                        // handle link events
                        updateMessage.addHyperlinkListener(new HyperlinkListener() {
+                               @Override
                                public void hyperlinkUpdate(HyperlinkEvent e) {
                                        if (e.getEventType().equals(
                                                        HyperlinkEvent.EventType.ACTIVATED))
@@ -172,6 +175,7 @@ class GuiReader extends BasicReader {
 
                final String typeFinal = type;
                EventQueue.invokeLater(new Runnable() {
+                       @Override
                        public void run() {
                                if (updates.isNewVersionAvailable()) {
                                        int rep = JOptionPane.showConfirmDialog(null,
index 1334518a49feba8367df5f829ae2e48576a2458a..6475bd9736cf2ebe975a92295f2513317bf386ed 100644 (file)
@@ -189,26 +189,31 @@ class GuiReaderBook extends JPanel {
        private void setupListeners() {
                listeners = new ArrayList<GuiReaderBook.BookActionListener>();
                addMouseListener(new MouseListener() {
+                       @Override
                        public void mouseReleased(MouseEvent e) {
                                if (e.isPopupTrigger()) {
                                        popup(e);
                                }
                        }
 
+                       @Override
                        public void mousePressed(MouseEvent e) {
                                if (e.isPopupTrigger()) {
                                        popup(e);
                                }
                        }
 
+                       @Override
                        public void mouseExited(MouseEvent e) {
                                setHovered(false);
                        }
 
+                       @Override
                        public void mouseEntered(MouseEvent e) {
                                setHovered(true);
                        }
 
+                       @Override
                        public void mouseClicked(MouseEvent e) {
                                if (isEnabled()) {
                                        Date now = new Date();
index 59663fe3e8369d41162e0fc276aacb86b3dce43d..e88c9777ee3afc01ab27efb2cb8595991a4c4f90 100644 (file)
@@ -101,6 +101,7 @@ class GuiReaderFrame extends JFrame {
                add(pgBar, BorderLayout.SOUTH);
 
                pgBar.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                invalidate();
                                pgBar.setProgress(null);
@@ -110,6 +111,7 @@ class GuiReaderFrame extends JFrame {
                });
 
                pgBar.addUpdateListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                invalidate();
                                validate();
@@ -124,6 +126,7 @@ class GuiReaderFrame extends JFrame {
                final Progress pg = new Progress();
                final String typeF = type;
                outOfUi(pg, new Runnable() {
+                       @Override
                        public void run() {
                                GuiReaderFrame.this.reader.getLibrary().refresh(false, pg);
                                invalidate();
@@ -181,10 +184,12 @@ class GuiReaderFrame extends JFrame {
                this.validate();
 
                bookPane.setActionListener(new BookActionListener() {
+                       @Override
                        public void select(GuiReaderBook book) {
                                selectedBook = book;
                        }
 
+                       @Override
                        public void popupRequested(GuiReaderBook book, MouseEvent e) {
                                JPopupMenu popup = new JPopupMenu();
                                popup.add(createMenuItemOpenBook());
@@ -198,6 +203,7 @@ class GuiReaderFrame extends JFrame {
                                popup.show(e.getComponent(), e.getX(), e.getY());
                        }
 
+                       @Override
                        public void action(final GuiReaderBook book) {
                                openBook(book);
                        }
@@ -248,18 +254,21 @@ class GuiReaderFrame extends JFrame {
 
                JMenuItem imprt = new JMenuItem("Import URL...", KeyEvent.VK_U);
                imprt.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                imprt(true);
                        }
                });
                JMenuItem imprtF = new JMenuItem("Import File...", KeyEvent.VK_F);
                imprtF.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                imprt(false);
                        }
                });
                JMenuItem exit = new JMenuItem("Exit", KeyEvent.VK_X);
                exit.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                GuiReaderFrame.this.dispatchEvent(new WindowEvent(
                                                GuiReaderFrame.this, WindowEvent.WINDOW_CLOSING));
@@ -292,6 +301,7 @@ class GuiReaderFrame extends JFrame {
                JMenuItem vauthors = new JMenuItem("Author");
                vauthors.setMnemonic(KeyEvent.VK_A);
                vauthors.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                words = false;
                                refreshBooks();
@@ -301,6 +311,7 @@ class GuiReaderFrame extends JFrame {
                JMenuItem vwords = new JMenuItem("Word count");
                vwords.setMnemonic(KeyEvent.VK_W);
                vwords.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                words = true;
                                refreshBooks();
@@ -317,6 +328,7 @@ class GuiReaderFrame extends JFrame {
                for (final String type : tt) {
                        JMenuItem item = new JMenuItem(type == null ? "All" : type);
                        item.addActionListener(new ActionListener() {
+                               @Override
                                public void actionPerformed(ActionEvent e) {
                                        removeBookPanes();
                                        addBookPane(type, true);
@@ -341,6 +353,7 @@ class GuiReaderFrame extends JFrame {
                        JMenuItem item = new JMenuItem(author == null ? "All"
                                        : author.isEmpty() ? "[unknown]" : author);
                        item.addActionListener(new ActionListener() {
+                               @Override
                                public void actionPerformed(ActionEvent e) {
                                        removeBookPanes();
                                        addBookPane(author, false);
@@ -376,6 +389,7 @@ class GuiReaderFrame extends JFrame {
                item.setMnemonic(KeyEvent.VK_F);
 
                item.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                ConfigEditor<Config> ed = new ConfigEditor<Config>(
                                                Config.class, Instance.getConfig(),
@@ -401,6 +415,7 @@ class GuiReaderFrame extends JFrame {
                item.setMnemonic(KeyEvent.VK_U);
 
                item.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                ConfigEditor<UiConfig> ed = new ConfigEditor<UiConfig>(
                                                UiConfig.class, Instance.getUiConfig(),
@@ -451,6 +466,7 @@ class GuiReaderFrame extends JFrame {
 
                JMenuItem export = new JMenuItem("Save as...", KeyEvent.VK_S);
                export.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                if (selectedBook != null) {
                                        fc.showDialog(GuiReaderFrame.this, "Save");
@@ -461,6 +477,7 @@ class GuiReaderFrame extends JFrame {
                                                                + type.getDefaultExtension(false);
                                                final Progress pg = new Progress();
                                                outOfUi(pg, new Runnable() {
+                                                       @Override
                                                        public void run() {
                                                                try {
                                                                        reader.getLibrary().export(
@@ -510,14 +527,17 @@ class GuiReaderFrame extends JFrame {
        private JMenuItem createMenuItemClearCache() {
                JMenuItem refresh = new JMenuItem("Clear cache", KeyEvent.VK_C);
                refresh.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                if (selectedBook != null) {
                                        outOfUi(null, new Runnable() {
+                                               @Override
                                                public void run() {
                                                        reader.clearLocalReaderCache(selectedBook.getMeta()
                                                                        .getLuid());
                                                        selectedBook.setCached(false);
                                                        SwingUtilities.invokeLater(new Runnable() {
+                                                               @Override
                                                                public void run() {
                                                                        selectedBook.repaint();
                                                                }
@@ -554,6 +574,7 @@ class GuiReaderFrame extends JFrame {
 
                        final String ftype = type;
                        item.addActionListener(new ActionListener() {
+                               @Override
                                public void actionPerformed(ActionEvent e) {
                                        if (selectedBook != null) {
                                                String type = ftype;
@@ -563,15 +584,17 @@ class GuiReaderFrame extends JFrame {
                                                                        "Moving story",
                                                                        JOptionPane.QUESTION_MESSAGE, null, null,
                                                                        selectedBook.getMeta().getSource());
+                                                       
                                                        if (rep == null) {
                                                                return;
-                                                       } else {
-                                                               type = rep.toString();
                                                        }
+
+                                                       type = rep.toString();
                                                }
 
                                                final String ftype = type;
                                                outOfUi(null, new Runnable() {
+                                                       @Override
                                                        public void run() {
                                                                reader.changeType(selectedBook.getMeta()
                                                                                .getLuid(), ftype);
@@ -579,6 +602,7 @@ class GuiReaderFrame extends JFrame {
                                                                selectedBook = null;
 
                                                                SwingUtilities.invokeLater(new Runnable() {
+                                                                       @Override
                                                                        public void run() {
                                                                                setJMenuBar(createMenu());
                                                                        }
@@ -601,10 +625,12 @@ class GuiReaderFrame extends JFrame {
        private JMenuItem createMenuItemRedownload() {
                JMenuItem refresh = new JMenuItem("Redownload", KeyEvent.VK_R);
                refresh.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                if (selectedBook != null) {
                                        final MetaData meta = selectedBook.getMeta();
                                        imprt(meta.getUrl(), new Runnable() {
+                                               @Override
                                                public void run() {
                                                        reader.delete(meta.getLuid());
                                                        GuiReaderFrame.this.selectedBook = null;
@@ -625,9 +651,11 @@ class GuiReaderFrame extends JFrame {
        private JMenuItem createMenuItemDelete() {
                JMenuItem delete = new JMenuItem("Delete", KeyEvent.VK_D);
                delete.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                if (selectedBook != null) {
                                        outOfUi(null, new Runnable() {
+                                               @Override
                                                public void run() {
                                                        reader.delete(selectedBook.getMeta().getLuid());
                                                        selectedBook = null;
@@ -648,6 +676,7 @@ class GuiReaderFrame extends JFrame {
        private JMenuItem createMenuItemOpenBook() {
                JMenuItem open = new JMenuItem("Open", KeyEvent.VK_O);
                open.addActionListener(new ActionListener() {
+                       @Override
                        public void actionPerformed(ActionEvent e) {
                                if (selectedBook != null) {
                                        openBook(selectedBook);
@@ -667,10 +696,12 @@ class GuiReaderFrame extends JFrame {
        private void openBook(final GuiReaderBook book) {
                final Progress pg = new Progress();
                outOfUi(pg, new Runnable() {
+                       @Override
                        public void run() {
                                try {
                                        reader.read(book.getMeta().getLuid(), pg);
                                        SwingUtilities.invokeLater(new Runnable() {
+                                               @Override
                                                public void run() {
                                                        book.setCached(true);
                                                }
@@ -711,6 +742,7 @@ class GuiReaderFrame extends JFrame {
                setEnabled(false);
 
                new Thread(new Runnable() {
+                       @Override
                        public void run() {
                                run.run();
                                refreshBooks();
@@ -782,6 +814,7 @@ class GuiReaderFrame extends JFrame {
                pg.addProgress(pgOnSuccess, 5);
 
                outOfUi(pg, new Runnable() {
+                       @Override
                        public void run() {
                                Exception ex = null;
                                try {
@@ -798,6 +831,7 @@ class GuiReaderFrame extends JFrame {
                                if (!ok) {
                                        Instance.syserr(e);
                                        SwingUtilities.invokeLater(new Runnable() {
+                                               @Override
                                                public void run() {
                                                        JOptionPane.showMessageDialog(GuiReaderFrame.this,
                                                                        "Cannot import: " + url, e.getMessage(),
index ca3768d92a616a08ee714d9ca9419963ef6cc9e7..041e8bc4d680eee9ffc153a2226bb0ea10dff550 100644 (file)
@@ -109,15 +109,18 @@ public class GuiReaderGroup extends JPanel {
                                books.add(book);
 
                                book.addActionListener(new BookActionListener() {
+                                       @Override
                                        public void select(GuiReaderBook book) {
                                                for (GuiReaderBook abook : books) {
                                                        abook.setSelected(abook == book);
                                                }
                                        }
 
+                                       @Override
                                        public void popupRequested(GuiReaderBook book, MouseEvent e) {
                                        }
 
+                                       @Override
                                        public void action(GuiReaderBook book) {
                                        }
                                });
index d2984bd5221c693fe2a3b2afda1a71e675ba55c3..d540d39f9094edb4e9d1e08a16cedfe9b65a5298 100644 (file)
@@ -49,7 +49,7 @@ public interface Reader {
 
                        return null;
                }
-       };
+       }
 
        /**
         * Return the current target {@link MetaData}.
index 8456da3f29d1b02ad0f05958c774925a81d443de..11640cf506302fddae46d4b07a68b8a1a3cbf1e2 100644 (file)
@@ -49,6 +49,7 @@ class TuiReader extends BasicReader {
                return backendType;
        }
 
+       @Override
        public void read() throws IOException {
                try {
                        TuiReaderApplication app = new TuiReaderApplication(this,
@@ -59,6 +60,7 @@ class TuiReader extends BasicReader {
                }
        }
 
+       @Override
        public void browse(String source) {
                List<MetaData> metas = getLibrary().getListBySource(source);
                try {
index 93a0167fe6be9e21b63718a4c2b0d326cc403065..f95cbf369f9518ae96cd311bbd131d8dec0c0e7f 100644 (file)
@@ -46,6 +46,8 @@ class TuiReaderApplication extends TApplication implements Reader {
                new TuiReaderMainWindow(this).setMetas(stories);
        }
 
+       @SuppressWarnings("unused")
+       @Override
        public void read() throws IOException {
                MetaData meta = getMeta();
 
@@ -66,42 +68,52 @@ class TuiReaderApplication extends TApplication implements Reader {
                }
        }
 
+       @Override
        public MetaData getMeta() {
                return reader.getMeta();
        }
 
+       @Override
        public Story getStory(Progress pg) {
                return reader.getStory(pg);
        }
 
+       @Override
        public BasicLibrary getLibrary() {
                return reader.getLibrary();
        }
 
+       @Override
        public void setLibrary(BasicLibrary lib) {
                reader.setLibrary(lib);
        }
 
+       @Override
        public void setMeta(MetaData meta) throws IOException {
                reader.setMeta(meta);
        }
 
+       @Override
        public void setMeta(String luid) throws IOException {
                reader.setMeta(luid);
        }
 
+       @Override
        public void setMeta(URL source, Progress pg) throws IOException {
                reader.setMeta(source, pg);
        }
 
+       @Override
        public void browse(String source) {
                reader.browse(source);
        }
 
+       @Override
        public int getChapter() {
                return reader.getChapter();
        }
 
+       @Override
        public void setChapter(int chapter) {
                reader.setChapter(chapter);
        }
index 9bc18fe992c46a396ffb9debb076f7a581a32850..e8dafc3fa339b47f47f5c2cfb2df5e6d1fdace87 100644 (file)
@@ -52,21 +52,25 @@ class TuiReaderStoryWindow extends TWindow {
                                                                                                                                // button is
                                                                                                                                // pressed
                navigationButtons.add(addButton("<<  ", 0, row, new TAction() {
+                       @Override
                        public void DO() {
                                setChapter(0);
                        }
                }));
                navigationButtons.add(addButton("<  ", 4, row, new TAction() {
+                       @Override
                        public void DO() {
                                setChapter(TuiReaderStoryWindow.this.chapter - 1);
                        }
                }));
                navigationButtons.add(addButton(">  ", 7, row, new TAction() {
+                       @Override
                        public void DO() {
                                setChapter(TuiReaderStoryWindow.this.chapter + 1);
                        }
                }));
                navigationButtons.add(addButton(">>  ", 10, row, new TAction() {
+                       @Override
                        public void DO() {
                                setChapter(getStory().getChapters().size());
                        }
index fc6bbd20bf015e274c10ccc9463dea5a2e9397f6..d56e52d3aea48afa64b28792fba5a8e2fa42090e 100644 (file)
@@ -374,7 +374,7 @@ public abstract class BasicSupport {
 
                        pg.setProgress(50);
 
-                       if (meta != null && meta.getCover() == null) {
+                       if (meta.getCover() == null) {
                                meta.setCover(getDefaultCover(meta.getSubject()));
                        }
 
@@ -576,6 +576,7 @@ public abstract class BasicSupport {
         * @throws IOException
         *             on I/O error
         */
+       @SuppressWarnings("unused")
        protected void preprocess(URL source, InputStream in) throws IOException {
        }
 
@@ -755,9 +756,9 @@ public abstract class BasicSupport {
 
                if (image != null) {
                        return new Paragraph(image);
-               } else {
-                       return processPara(line);
                }
+
+               return processPara(line);
        }
 
        /**
@@ -840,9 +841,9 @@ public abstract class BasicSupport {
        static String[] getImageExt(boolean emptyAllowed) {
                if (emptyAllowed) {
                        return new String[] { "", ".png", ".jpg", ".jpeg", ".gif", ".bmp" };
-               } else {
-                       return new String[] { ".png", ".jpg", ".jpeg", ".gif", ".bmp" };
                }
+
+               return new String[] { ".png", ".jpg", ".jpeg", ".gif", ".bmp" };
        }
 
        /**
@@ -1161,9 +1162,9 @@ public abstract class BasicSupport {
                                        if (prev == car) {
                                                builder.append(closeDoubleQuote);
                                                continue;
-                                       } else {
-                                               builder.append(closeQuote);
                                        }
+
+                                       builder.append(closeQuote);
                                }
                        }
 
index 527e0928cc33cb51215d30ca505dcd6dd4174e8d..1baa6201cb217508074cd54608085d38ecadcd01 100644 (file)
@@ -102,7 +102,7 @@ class E621 extends BasicSupport {
                return null;
        }
 
-       private String getAuthor(URL source, InputStream in) throws IOException {
+       private String getAuthor(URL source, InputStream in) {
                String author = getLine(in, "href=\"/post/show/", 0);
                if (author != null) {
                        String key = "href=\"";
@@ -144,7 +144,7 @@ class E621 extends BasicSupport {
                return null;
        }
 
-       private String getTitle(InputStream in) throws IOException {
+       private String getTitle(InputStream in) {
                String title = getLine(in, "<title>", 0);
                if (title != null) {
                        int pos = title.indexOf('>');
@@ -222,14 +222,17 @@ class E621 extends BasicSupport {
                        final String key = Integer.toString(i);
                        final URL value = new URL(source.toString() + "?page=" + 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;
                                }
index 363635488e35a514f0b5bbb0929b85b5ef605bae..fe993a1d8b53be0503e6f374132f12dfbc69acf1 100644 (file)
@@ -78,8 +78,7 @@ class EHentai extends BasicSupport {
                return true;
        }
 
-       private BufferedImage getCover(URL source, InputStream in)
-                       throws IOException {
+       private BufferedImage getCover(URL source, InputStream in) {
                BufferedImage author = null;
                String coverLine = getKeyLine(in, "<div id=\"gd1\"", " url(", ")");
                if (coverLine != null) {
@@ -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;
                                }
index 1d1f3f4a09cbbd88939c762434a9d57a0cfd342c..fd514931848e72baca337054d0d3333f558e52a7 100644 (file)
@@ -74,7 +74,7 @@ class Fanfiction extends BasicSupport {
                return null;
        }
 
-       private List<String> getTags(InputStream in) throws IOException {
+       private List<String> getTags(InputStream in) {
                List<String> tags = new ArrayList<String>();
 
                String key = "title=\"Send Private Message\"";
@@ -245,14 +245,17 @@ class Fanfiction extends BasicSupport {
                                                        final String chapName = name.trim();
                                                        final URL chapURL = new URL(base + i + suffix);
                                                        urls.add(new Entry<String, URL>() {
+                                                               @Override
                                                                public URL setValue(URL value) {
                                                                        return null;
                                                                }
 
+                                                               @Override
                                                                public URL getValue() {
                                                                        return chapURL;
                                                                }
 
+                                                               @Override
                                                                public String getKey() {
                                                                        return chapName;
                                                                }
@@ -270,14 +273,17 @@ class Fanfiction extends BasicSupport {
                        final String chapName = getTitle(reset(in));
                        final URL chapURL = source;
                        urls.add(new Entry<String, URL>() {
+                               @Override
                                public URL setValue(URL value) {
                                        return null;
                                }
 
+                               @Override
                                public URL getValue() {
                                        return chapURL;
                                }
 
+                               @Override
                                public String getKey() {
                                        return chapName;
                                }
index 08d1712e9f4aa2ccebb8f8e07e1bb49085340bc4..cb26ac6fc42939682ff716d987e305f4aa720ef6 100644 (file)
@@ -235,14 +235,17 @@ class Fimfiction extends BasicSupport {
                                                final URL value = new URL("http://www.fimfiction.net"
                                                                + line);
                                                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;
                                                        }
index 571f77b0a1cda5b08e6e775b257d9db8f27eb101..466a88539bd375e236376b24f3d0fa5772b7489d 100644 (file)
@@ -31,11 +31,11 @@ public class InfoReader {
                                in.close();
                                in = null;
                        }
-               } else {
-                       throw new FileNotFoundException(
-                                       "File given as argument does not exists: "
-                                                       + infoFile.getAbsolutePath());
                }
+
+               throw new FileNotFoundException(
+                               "File given as argument does not exists: "
+                                               + infoFile.getAbsolutePath());
        }
 
        private static MetaData createMeta(URL sourceInfoFile, InputStream in,
index c8eaa1d3035d0fabee3af3ccd2a797ec080a7cce..d6f146429bf19a4c67d4b7305c89a9c96f8d7229 100644 (file)
@@ -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) {
@@ -246,14 +246,17 @@ 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;
                                                }
index 67156956ee14d1389197d02b888b02b1f4a34336..c9ebd18d108ddac863b5182c9554033fe2e78f6e 100644 (file)
@@ -57,7 +57,7 @@ class Text extends BasicSupport {
                meta.setPublisher("");
                meta.setUuid(source.toString());
                meta.setLuid("");
-               meta.setLang(getLang(source, reset(in))); // default is EN
+               meta.setLang(getLang(reset(in))); // default is EN
                meta.setSubject(getSubject(source));
                meta.setType(getType().toString());
                meta.setImageDocument(false);
@@ -77,7 +77,7 @@ class Text extends BasicSupport {
 
        }
 
-       private String getLang(URL source, InputStream in) throws IOException {
+       private String getLang(InputStream in) {
                @SuppressWarnings("resource")
                Scanner scan = new Scanner(in, "UTF-8");
                scan.useDelimiter("\\n");
@@ -103,14 +103,14 @@ class Text extends BasicSupport {
                return lang;
        }
 
-       private String getTitle(InputStream in) throws IOException {
+       private String getTitle(InputStream in) {
                @SuppressWarnings("resource")
                Scanner scan = new Scanner(in, "UTF-8");
                scan.useDelimiter("\\n");
                return scan.next();
        }
 
-       private String getAuthor(InputStream in) throws IOException {
+       private String getAuthor(InputStream in) {
                @SuppressWarnings("resource")
                Scanner scan = new Scanner(in, "UTF-8");
                scan.useDelimiter("\\n");
@@ -126,7 +126,7 @@ class Text extends BasicSupport {
                return fixAuthor(author);
        }
 
-       private String getDate(InputStream in) throws IOException {
+       private String getDate(InputStream in) {
                @SuppressWarnings("resource")
                Scanner scan = new Scanner(in, "UTF-8");
                scan.useDelimiter("\\n");
@@ -151,7 +151,7 @@ class Text extends BasicSupport {
                return getChapterContent(source, in, 0, null);
        }
 
-       private BufferedImage getCover(URL source) throws IOException {
+       private BufferedImage getCover(URL source) {
                String path;
                try {
                        path = new File(source.toURI()).getPath();
@@ -188,14 +188,17 @@ class Text extends BasicSupport {
                                final URL value = source;
                                final String key = chapName;
                                chaps.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;
                                        }
index 9813df890025a750aeec3af93a77f69de0dc15e0..ba24e50708052cf91b3dcfded508c298b17470bf 100644 (file)
@@ -36,7 +36,7 @@ class YiffStar extends BasicSupport {
                MetaData meta = new MetaData();
 
                meta.setTitle(getTitle(reset(in)));
-               meta.setAuthor(getAuthor(source, reset(in)));
+               meta.setAuthor(getAuthor(reset(in)));
                meta.setDate("");
                meta.setTags(getTags(reset(in)));
                meta.setSource(getSourceName());
@@ -159,7 +159,7 @@ class YiffStar extends BasicSupport {
                return null;
        }
 
-       private String getAuthor(URL source, InputStream in) throws IOException {
+       private String getAuthor(InputStream in) {
                String author = getLine(in, "class=\"onlinestatus", 0);
                if (author != null) {
                        return StringUtils.unhtml(author).trim();
@@ -168,7 +168,7 @@ class YiffStar extends BasicSupport {
                return null;
        }
 
-       private String getTitle(InputStream in) throws IOException {
+       private String getTitle(InputStream in) {
                String title = getLine(in, "class=\"sflabel pagetitle", 0);
                if (title != null) {
                        if (title.contains("(series)")) {
@@ -206,14 +206,17 @@ class YiffStar extends BasicSupport {
                                        final URL value = guest(link);
                                        final String key = StringUtils.unhtml(line).trim();
                                        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;
                                                }
@@ -271,11 +274,11 @@ class YiffStar extends BasicSupport {
                if (link.contains("?")) {
                        if (link.contains("/?")) {
                                return new URL(link.replace("?", "guest?"));
-                       } else {
-                               return new URL(link.replace("?", "/guest?"));
                        }
-               } else {
-                       return new URL(link + "/guest");
+
+                       return new URL(link.replace("?", "/guest?"));
                }
+
+               return new URL(link + "/guest");
        }
 }
index 40da442c0a76afb7f3c4514f8e35242c984f9da3..af33f9d0695494bb3b954b3aa72605f2998a115a 100644 (file)
@@ -180,7 +180,7 @@ public class BasicSupportTest extends TestLauncher {
                                        public void setUp() throws Exception {
                                                super.setUp();
 
-                                       };
+                                       }
 
                                        @Override
                                        public void tearDown() throws Exception {
@@ -325,12 +325,12 @@ public class BasicSupportTest extends TestLauncher {
                                                                                + "Fanfan." + "\n" + "\n"
                                                                                + "Chapter 2: Chap2" + "\n" + "\n" //
                                                                                + "Tulipe." + "\n");
-                                       };
+                                       }
 
                                        @Override
                                        public void tearDown() throws Exception {
                                                tmp.delete();
-                                       };
+                                       }
 
                                        @Override
                                        public void test() throws Exception {
@@ -368,12 +368,12 @@ public class BasicSupportTest extends TestLauncher {
                                                                                + "Fanfan." + "\n" + "\n"
                                                                                + "Chapter 2: Chap2" + "\n" + "\n" //
                                                                                + "Tulipe." + "\n");
-                                       };
+                                       }
 
                                        @Override
                                        public void tearDown() throws Exception {
                                                tmp.delete();
-                                       };
+                                       }
 
                                        @Override
                                        public void test() throws Exception {