Fix UTF-8 and "/" -> "\" issues for Win32
[fanfix.git] / src / be / nikiroo / fanfix / reader / LocalReader.java
index bfb8b97276d9d71b9d76782b592409e1c02c8c73..86b779c343c0b964d9c80d96493ccd47ec02f7d5 100644 (file)
@@ -48,21 +48,23 @@ class LocalReader extends BasicReader {
        }
 
        // return new luid
        }
 
        // return new luid
-       public String imprt(String luid) {
+       public String imprt(String luid) throws IOException {
                try {
                        Story story = Instance.getLibrary().getStory(luid);
                try {
                        Story story = Instance.getLibrary().getStory(luid);
-                       story = lib.save(story);
-                       return story.getMeta().getLuid();
+                       if (story != null) {
+                               story = lib.save(story);
+                               return story.getMeta().getLuid();
+                       } else {
+                               throw new IOException("Cannot find story in Library: " + luid);
+                       }
                } catch (IOException e) {
                } catch (IOException e) {
-                       Instance.syserr(new IOException(
+                       throw new IOException(
                                        "Cannot import story from library to LocalReader library: "
                                        "Cannot import story from library to LocalReader library: "
-                                                       + luid, e));
+                                                       + luid, e);
                }
                }
-
-               return null;
        }
 
        }
 
-       public File getTarget(String luid) {
+       public File getTarget(String luid) throws IOException {
                MetaData meta = lib.getInfo(luid);
                File file = lib.getFile(luid);
                if (file == null) {
                MetaData meta = lib.getInfo(luid);
                File file = lib.getFile(luid);
                if (file == null) {