List of usage examples for java.net SocketTimeoutException fillInStackTrace
public synchronized Throwable fillInStackTrace()
From source file:com.hoccer.tools.HttpHelper.java
private static HttpResponse executeHTTPMethod(HttpRequestBase pMethod, int pConnectionTimeout) throws IOException, HttpClientException, HttpServerException { HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, pConnectionTimeout); HttpConnectionParams.setSoTimeout(httpParams, pConnectionTimeout); HttpClientParams.setRedirecting(httpParams, true); DefaultHttpClient httpclient = new HttpClientWithKeystore(httpParams); // Log redirects httpclient.setRedirectHandler(new DefaultRedirectHandler() { @Override/*from ww w . ja v a 2s . co m*/ public URI getLocationURI(HttpResponse response, HttpContext context) throws ProtocolException { URI uri = super.getLocationURI(response, context); return uri; } }); HttpResponse response; try { response = httpclient.execute(pMethod); } catch (SocketTimeoutException e) { e = new SocketTimeoutException(e.getMessage() + ": " + pMethod.getURI()); e.fillInStackTrace(); throw e; } catch (SocketException e) { e = new SocketException(e.getMessage() + ": " + pMethod.getURI()); e.fillInStackTrace(); throw e; } HttpException.throwIfError(pMethod.getURI().toString(), response); return response; }