From f279d8c37de8921f0521c442b05eb99e0a6a36e5 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Thu, 19 Aug 2010 19:37:03 +0000 Subject: [PATCH] HTTPCLIENT-980: CachingHttpClient returns a 503 response when the backend HttpClient produces an IOException Contributed by Jonathan Moore git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@987280 13f79535-47bb-0310-9956-ffa450edef68 --- .../impl/client/cache/CachingHttpClient.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java index 534fa7928..5afb99e58 100644 --- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java +++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java @@ -41,7 +41,6 @@ import org.apache.http.HttpStatus; import org.apache.http.HttpVersion; import org.apache.http.ProtocolException; import org.apache.http.RequestLine; -import org.apache.http.StatusLine; import org.apache.http.annotation.ThreadSafe; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; @@ -53,7 +52,6 @@ import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.conn.ClientConnectionManager; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicHttpResponse; -import org.apache.http.message.BasicStatusLine; import org.apache.http.params.HttpParams; import org.apache.http.protocol.HttpContext; @@ -452,18 +450,10 @@ public class CachingHttpClient implements HttpClient { Date requestDate = getCurrentDate(); - try { - log.debug("Calling the backend"); - HttpResponse backendResponse = backend.execute(target, request, context); - return handleBackendResponse(target, request, requestDate, getCurrentDate(), - backendResponse); - } catch (ClientProtocolException cpex) { - throw cpex; - } catch (IOException ex) { - StatusLine status = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_SERVICE_UNAVAILABLE, ex - .getMessage()); - return new BasicHttpResponse(status); - } + log.debug("Calling the backend"); + HttpResponse backendResponse = backend.execute(target, request, context); + return handleBackendResponse(target, request, requestDate, getCurrentDate(), + backendResponse); }