X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2FLocalReader.java;h=86b779c343c0b964d9c80d96493ccd47ec02f7d5;hp=26f48f5a21210fe4d6026b44d0e2bdae3cf3e2c1;hb=3d247bc3bb955a9b85686f0db431157cb9dc4a10;hpb=a6395bef99a8e917f67341ef1906917b87df24a4 diff --git a/src/be/nikiroo/fanfix/reader/LocalReader.java b/src/be/nikiroo/fanfix/reader/LocalReader.java index 26f48f5..86b779c 100644 --- a/src/be/nikiroo/fanfix/reader/LocalReader.java +++ b/src/be/nikiroo/fanfix/reader/LocalReader.java @@ -10,7 +10,6 @@ import be.nikiroo.fanfix.bundles.Config; import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.fanfix.data.Story; import be.nikiroo.fanfix.output.BasicOutput.OutputType; -import be.nikiroo.fanfix.supported.BasicSupport.SupportType; class LocalReader extends BasicReader { private Library lib; @@ -49,21 +48,23 @@ class LocalReader extends BasicReader { } // return new luid - public String imprt(String luid) { + public String imprt(String luid) throws IOException { 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) { - Instance.syserr(new IOException( + throw new IOException( "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) { @@ -76,8 +77,8 @@ class LocalReader extends BasicReader { } @Override - public void start(SupportType type) { - final SupportType typeFinal = type; + public void start(String type) { + final String typeFinal = type; EventQueue.invokeLater(new Runnable() { public void run() { new LocalReaderFrame(LocalReader.this, typeFinal) @@ -85,8 +86,4 @@ class LocalReader extends BasicReader { } }); } - - public static void main(String[] args) throws IOException { - new LocalReader().start(null); - } }