Fix imagestash, better exception logging on HTTP failures
This commit is contained in:
parent
1b9eea8499
commit
cdaa3b26d1
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user