4444import org .apache .http .client .entity .UrlEncodedFormEntity ;
4545import org .apache .http .client .methods .RequestBuilder ;
4646import org .apache .http .client .utils .URIBuilder ;
47- import org .apache .http .conn .ConnectTimeoutException ;
4847import org .apache .http .conn .HttpHostConnectException ;
4948import org .apache .http .conn .ssl .NoopHostnameVerifier ;
5049import org .apache .http .entity .ByteArrayEntity ;
@@ -68,7 +67,6 @@ public class HttpClientFilter extends RequestFilterBase {
6867 * instead of converting it to a String.
6968 */
7069 private static final List <String > RAW_BODY_CONTENT_TYPE_HINTS = Arrays .asList ("image" , "pdf" , "msword" );
71- private static final int HTTP_STATUS_EXTERNAL_TIMEOUT = 531 ;
7270
7371 private static GsonBuilder gsonBuilder = new GsonBuilder ();
7472 private static final Gson GSON = gsonBuilder
@@ -161,15 +159,12 @@ public final void execute(Request request, Response response) {
161159 } finally {
162160 response .finish ();
163161 }
164- } catch (ConnectTimeoutException e ) {
165- httpResponse .setStatus (HttpStatus .valueOf (HTTP_STATUS_EXTERNAL_TIMEOUT ));
166- throw new ConnectException ("Connection timeout: " + e .getMessage (), e );
162+ } catch (ConnectException e ) {
163+ throw new HttpClientConnectException ("Connection Exception" , e );
167164 } catch (SocketTimeoutException e ) {
168- httpResponse .setStatus (HttpStatus .valueOf (HTTP_STATUS_EXTERNAL_TIMEOUT ));
169- throw new ConnectException ("Read timeout: " + e .getMessage (), e );
165+ throw new HttpClientConnectException ("Read Timeout Exception" , e );
170166 } catch (NoHttpResponseException e ) {
171- httpResponse .setStatus (HttpStatus .valueOf (HTTP_STATUS_EXTERNAL_TIMEOUT ));
172- throw new ConnectException ("Target server failed to respond: " + e .getMessage (), e );
167+ throw new HttpClientConnectException ("Target server failed to response" , e );
173168 } catch (SSLHandshakeException e ) {
174169 throw new HttpClientConnectException ("SSL handshake failed" , e );
175170 } catch (SSLException e ) {
0 commit comments