()
| 197 | } |
| 198 | |
| 199 | public Response response() throws IOException { |
| 200 | Response response; |
| 201 | IOException lastException = null; |
| 202 | int retries = this.retries; |
| 203 | while (--retries >= 0) { |
| 204 | try { |
| 205 | response = connection.execute(); |
| 206 | return response; |
| 207 | } catch (IOException e) { |
| 208 | // Warn users about possibly fixable permission error |
| 209 | if (e instanceof org.jsoup.HttpStatusException) { |
| 210 | HttpStatusException ex = (HttpStatusException) e; |
| 211 | |
| 212 | // These status codes might indicate missing cookies |
| 213 | // 401 Unauthorized |
| 214 | // 403 Forbidden |
| 215 | |
| 216 | int status = ex.getStatusCode(); |
| 217 | if (status == 401 || status == 403) { |
| 218 | throw new IOException("Failed to load " + url + ": Status Code " + status + ". You might be able to circumvent this error by setting cookies for this domain", e); |
| 219 | } |
| 220 | if (status == 404) { |
| 221 | throw new IOException("File not found " + url + ": Status Code " + status + ". ", e); |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | if (retrySleep > 0 && retries >= 0) { |
| 226 | logger.warn("Error while loading " + url + " waiting "+ retrySleep + " ms before retrying.", e); |
| 227 | Utils.sleep(retrySleep); |
| 228 | } else { |
| 229 | logger.warn("Error while loading " + url, e); |
| 230 | } |
| 231 | lastException = e; |
| 232 | } |
| 233 | } |
| 234 | throw new IOException("Failed to load " + url + " after " + this.retries + " attempts", lastException); |
| 235 | } |
| 236 | |
| 237 | public static void SSLVerifyOff() { |
| 238 | try { |
no test coverage detected