mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
throw an exception when needed, prevents html error pages parsing
This commit is contained in:
@@ -97,12 +97,19 @@ public class HttpGetter {
|
||||
HttpResponse response = null;
|
||||
try {
|
||||
response = client.execute(httpget);
|
||||
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_MODIFIED) {
|
||||
int code = response.getStatusLine().getStatusCode();
|
||||
if (code == HttpStatus.SC_NOT_MODIFIED) {
|
||||
throw new NotModifiedException();
|
||||
} else if (code >= 300) {
|
||||
throw new HttpResponseException(code,
|
||||
"Server returned HTTP error code " + code);
|
||||
}
|
||||
|
||||
} catch (HttpResponseException e) {
|
||||
if (e.getStatusCode() == HttpStatus.SC_NOT_MODIFIED) {
|
||||
throw new NotModifiedException();
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
Header lastModifiedHeader = response
|
||||
|
||||
Reference in New Issue
Block a user