Fix imagestash, better exception logging on HTTP failures

This commit is contained in:
4pr0n 2015-03-30 01:41:40 -07:00
parent 1b9eea8499
commit cdaa3b26d1
2 changed files with 4 additions and 2 deletions

View File

@ -73,7 +73,7 @@ public class ImagestashRipper extends AbstractJSONRipper {
JSONObject image = images.getJSONObject(i); JSONObject image = images.getJSONObject(i);
String imageURL = image.getString("src"); String imageURL = image.getString("src");
if (imageURL.startsWith("/")) { if (imageURL.startsWith("/")) {
imageURL = "http://imagestash.org" + imageURL; imageURL = "https://imagestash.org" + imageURL;
} }
imageURLs.add(imageURL); imageURLs.add(imageURL);
} }

View File

@ -123,6 +123,7 @@ public class Http {
public Response response() throws IOException { public Response response() throws IOException {
Response response = null; Response response = null;
IOException lastException = null;
int retries = this.retries; int retries = this.retries;
while (--retries >= 0) { while (--retries >= 0) {
try { try {
@ -130,9 +131,10 @@ public class Http {
return response; return response;
} catch (IOException e) { } catch (IOException e) {
logger.warn("Error while loading " + url, e); logger.warn("Error while loading " + url, e);
lastException = e;
continue; continue;
} }
} }
throw new IOException("Failed to load " + url + " after " + this.retries + " attempts"); throw new IOException("Failed to load " + url + " after " + this.retries + " attempts", lastException);
} }
} }