X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=library%2FWebLibrary.java;h=9af38e2b6bd1c7ccb565ca6f244e31ef42f40746;hp=7566877cebd48343b47c1764ed31045ee8de78dd;hb=002972e9de731678035d56304d75a6d9e8233635;hpb=6d465e886ae46c9da99117cc4302948f700a51c4 diff --git a/library/WebLibrary.java b/library/WebLibrary.java index 7566877..9af38e2 100644 --- a/library/WebLibrary.java +++ b/library/WebLibrary.java @@ -133,7 +133,17 @@ public class WebLibrary extends BasicLibrary { * in case of I/O errors */ public void stop() throws IOException { - post(WebLibraryUrls.EXIT_URL, null).close(); + 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 @@ -164,6 +174,7 @@ public class WebLibrary extends BasicLibrary { try { Image img = new Image(in); if (img.getSize() > 0) { + img.close(); return img; } @@ -179,6 +190,7 @@ public class WebLibrary extends BasicLibrary { try { Image img = new Image(in); if (img.getSize() > 0) { + img.close(); return img; } @@ -194,6 +206,7 @@ public class WebLibrary extends BasicLibrary { try { Image img = new Image(in); if (img.getSize() > 0) { + img.close(); return img; }