X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FRemoteLibrary.java;h=69dc377c7ef64e29e818d9c009ddfaa14d652125;hb=0013f760d69fd7db2b298c3da5d89bc0b102eabf;hp=4d8d5123bc787bcf65167bc29dd2d8d840200083;hpb=0bb51c9c66697fe63ba066715207deabbcc1d479;p=nikiroo-utils.git
diff --git a/src/be/nikiroo/fanfix/library/RemoteLibrary.java b/src/be/nikiroo/fanfix/library/RemoteLibrary.java
index 4d8d512..69dc377 100644
--- a/src/be/nikiroo/fanfix/library/RemoteLibrary.java
+++ b/src/be/nikiroo/fanfix/library/RemoteLibrary.java
@@ -41,12 +41,7 @@ public class RemoteLibrary extends BasicLibrary {
Object rep = super.send(data);
if (rep instanceof RemoteLibraryException) {
RemoteLibraryException remoteEx = (RemoteLibraryException) rep;
- IOException cause = remoteEx.getCause();
- if (cause == null) {
- cause = new IOException("IOException");
- }
-
- throw cause;
+ throw remoteEx.unwrapException();
}
return rep;
@@ -83,7 +78,7 @@ public class RemoteLibrary extends BasicLibrary {
*
wl: flag to allow access to all the stories (bypassing the
* whitelist if it exists)
*
- *
+ *
* Some examples:
*
* - my_key: normal connection, will take the default server
@@ -357,8 +352,9 @@ public class RemoteLibrary extends BasicLibrary {
@Override
// Could work (more slowly) without it
- public Story imprt(final URL url, Progress pg) throws IOException {
+ public MetaData imprt(final URL url, Progress pg) throws IOException {
// Import the file locally if it is actually a file
+
if (url == null || url.getProtocol().equalsIgnoreCase("file")) {
return super.imprt(url, pg);
}
@@ -369,13 +365,7 @@ public class RemoteLibrary extends BasicLibrary {
pg = new Progress();
}
- pg.setMinMax(0, 2);
- Progress pgImprt = new Progress();
- Progress pgGet = new Progress();
- pg.addProgress(pgImprt, 1);
- pg.addProgress(pgGet, 1);
-
- final Progress pgF = pgImprt;
+ final Progress pgF = pg;
final String[] luid = new String[1];
connectRemoteAction(new RemoteAction() {
@@ -404,11 +394,8 @@ public class RemoteLibrary extends BasicLibrary {
throw new IOException("Remote failure");
}
- Story story = getStory(luid[0], pgGet);
- pgGet.done();
-
pg.done();
- return story;
+ return getInfo(luid[0]);
}
@Override
@@ -446,6 +433,9 @@ public class RemoteLibrary extends BasicLibrary {
/**
* Stop the server.
+ *
+ * @throws IOException
+ * in case of I/O error (including bad key)
*/
public void exit() throws IOException {
connectRemoteAction(new RemoteAction() {
@@ -453,6 +443,7 @@ public class RemoteLibrary extends BasicLibrary {
public void action(ConnectActionClientObject action)
throws Exception {
action.send(new Object[] { subkey, "EXIT" });
+ Thread.sleep(100);
}
});
}