return new Version();
}
+ /**
+ * Stop the server.
+ *
+ * @throws IOException
+ * in case of I/O errors
+ */
+ public void stop() throws IOException {
+ try {
+ post(WebLibraryUrls.EXIT_URL, null).close();
+ } catch (Exception e) {
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e1) {
+ }
+ if (getStatus() != Status.UNAVAILABLE) {
+ throw new IOException("Cannot exit the library", e);
+ }
+ }
+ }
+
@Override
public Status getStatus() {
try {
InputStream in = post(WebLibraryUrls.getStoryUrlCover(luid));
try {
Image img = new Image(in);
- if (img.getSize() > 0) {
- return img;
+ if (img.getSize() == 0) {
+ img.close();
+ img = null;
}
- return null;
+ return img;
} finally {
in.close();
}
InputStream in = post(WebLibraryUrls.getCoverUrlSource(source));
try {
Image img = new Image(in);
- if (img.getSize() > 0) {
- return img;
+ if (img.getSize() == 0) {
+ img.close();
+ img = null;
}
- return null;
+ return img;
} finally {
in.close();
}
InputStream in = post(WebLibraryUrls.getCoverUrlAuthor(author));
try {
Image img = new Image(in);
- if (img.getSize() > 0) {
- return img;
+ if (img.getSize() == 0) {
+ img.close();
+ img = null;
}
- return null;
+ return img;
} finally {
in.close();
}