X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FMangaFox.java;fp=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FMangaFox.java;h=c418d38150f68d76b671ac6b724bacd6a75341bb;hb=87a7a0a59a65fd170deb274caae6544da5254dda;hp=f1226076315e844d6b55718fe26394bc556c1ae2;hpb=57f21783818af79797a2c3db600a11f38e4074a1;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/supported/MangaFox.java b/src/be/nikiroo/fanfix/supported/MangaFox.java index f122607..c418d38 100644 --- a/src/be/nikiroo/fanfix/supported/MangaFox.java +++ b/src/be/nikiroo/fanfix/supported/MangaFox.java @@ -261,8 +261,13 @@ class MangaFox extends BasicSupport { // note: when used, the base URL can be an ad-page imageIn = openEx(url + "1.html"); imageDoc = DataUtil.load(imageIn, "UTF-8", url + "1.html"); + } catch (IOException e) { + Instance.getTraceHandler().error( + new IOException("Cannot get image " + 1 + " of manga", e)); } finally { - imageIn.close(); + if (imageIn != null) { + imageIn.close(); + } } Element select = imageDoc.getElementsByClass("m").first(); Elements options = select.getElementsByTag("option"); @@ -272,26 +277,33 @@ class MangaFox extends BasicSupport { // 2. list them for (int i = 1; i <= size; i++) { - if (i > 1) { // because fist one was opened for size + if (i > 1) { // because first one was opened for size try { imageIn = openEx(url + i + ".html"); imageDoc = DataUtil.load(imageIn, "UTF-8", url + i + ".html"); + + String linkImage = imageDoc.getElementById("image").absUrl( + "src"); + if (linkImage != null) { + builder.append("["); + // to help with the retry and the originalUrl, part 1 + builder.append(withoutQuery(linkImage)); + builder.append("]
"); + } + + // to help with the retry and the originalUrl, part 2 + refresh(linkImage); + } catch (IOException e) { + Instance.getTraceHandler().error( + new IOException("Cannot get image " + i + + " of manga", e)); } finally { - imageIn.close(); + if (imageIn != null) { + imageIn.close(); + } } } - - String linkImage = imageDoc.getElementById("image").absUrl("src"); - if (linkImage != null) { - builder.append("["); - // to help with the retry and the originalUrl, part 1 - builder.append(withoutQuery(linkImage)); - builder.append("]
"); - } - - // to help with the retry and the originalUrl, part 2 - refresh(linkImage); } return builder.toString();