import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
*
* @return the imported {@link Story}
*
+ * @throws UnknownHostException
+ * if the host is not supported
* @throws IOException
* in case of I/O error
*/
public Story imprt(URL url, Progress pg) throws IOException {
BasicSupport support = BasicSupport.getSupport(url);
if (support == null) {
- throw new IOException("URL not supported: " + url.toString());
+ throw new UnknownHostException("" + url);
}
return save(support.process(url, pg), null);
}
Story story = rebuildStory(list);
- Instance.getLibrary().save(story, "" + args[1], null);
+ Instance.getLibrary().save(story, "" + args[0], null);
} else if ("DELETE_STORY".equals(command)) {
Instance.getLibrary().delete("" + args[0]);
} else if ("GET_COVER".equals(command)) {
import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
pgOnSuccess.setProgress(0);
if (!ok) {
- error("Cannot import URL", "Failed to import " + url
- + ": \n" + e.getMessage(), e);
+ if (e instanceof UnknownHostException) {
+ error("Failed to import " + url, "Cannot import URL",
+ null);
+ } else {
+ error("Failed to import " + url + ": \n"
+ + e.getMessage(), "Cannot import URL", e);
+ }
} else {
if (onSuccess != null) {
onSuccess.run(story);