mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 762974 - Don't retry if delegate or observer callbacks throw in BaseResource. r=liuche
This commit is contained in:
parent
12cb93585a
commit
be30cdd369
@ -240,16 +240,13 @@ public class BaseResource implements Resource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void execute() {
|
private void execute() {
|
||||||
|
HttpResponse response;
|
||||||
try {
|
try {
|
||||||
HttpResponse response = client.execute(request, context);
|
response = client.execute(request, context);
|
||||||
Logger.debug(LOG_TAG, "Response: " + response.getStatusLine().toString());
|
Logger.debug(LOG_TAG, "Response: " + response.getStatusLine().toString());
|
||||||
HttpResponseObserver observer = getHttpResponseObserver();
|
|
||||||
if (observer != null) {
|
|
||||||
observer.observeHttpResponse(response);
|
|
||||||
}
|
|
||||||
delegate.handleHttpResponse(response);
|
|
||||||
} catch (ClientProtocolException e) {
|
} catch (ClientProtocolException e) {
|
||||||
delegate.handleHttpProtocolException(e);
|
delegate.handleHttpProtocolException(e);
|
||||||
|
return;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Logger.debug(LOG_TAG, "I/O exception returned from execute.");
|
Logger.debug(LOG_TAG, "I/O exception returned from execute.");
|
||||||
if (!retryOnFailedRequest) {
|
if (!retryOnFailedRequest) {
|
||||||
@ -257,6 +254,7 @@ public class BaseResource implements Resource {
|
|||||||
} else {
|
} else {
|
||||||
retryRequest();
|
retryRequest();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Bug 740731: Don't let an exception fall through. Wrapping isn't
|
// Bug 740731: Don't let an exception fall through. Wrapping isn't
|
||||||
// optimal, but often the exception is treated as an Exception anyway.
|
// optimal, but often the exception is treated as an Exception anyway.
|
||||||
@ -265,7 +263,15 @@ public class BaseResource implements Resource {
|
|||||||
} else {
|
} else {
|
||||||
retryRequest();
|
retryRequest();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't retry if the observer or delegate throws!
|
||||||
|
HttpResponseObserver observer = getHttpResponseObserver();
|
||||||
|
if (observer != null) {
|
||||||
|
observer.observeHttpResponse(response);
|
||||||
|
}
|
||||||
|
delegate.handleHttpResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void retryRequest() {
|
private void retryRequest() {
|
||||||
|
Loading…
Reference in New Issue
Block a user