/** don't need error message to show */ private String doGetSaveFile( String url, String path, FileDownloaderHttpHelper.DownloadListener downloadListener) { URIBuilder uriBuilder; HttpGet httpGet = new HttpGet(); try { uriBuilder = new URIBuilder(url); httpGet.setURI(uriBuilder.build()); AppLogger.d(uriBuilder.build().toString()); } catch (URISyntaxException e) { AppLogger.d(e.getMessage()); } HttpResponse response = null; try { response = httpClient.execute(httpGet); } catch (ConnectTimeoutException ignored) { AppLogger.e(ignored.getMessage()); } catch (ClientProtocolException ignored) { AppLogger.e(ignored.getMessage()); } catch (IOException ignored) { AppLogger.e(ignored.getMessage()); } if (response != null) { return FileDownloaderHttpHelper.saveFile(response, path, downloadListener); } else { return ""; } }
private HttpResponse getHttpResponse(HttpRequestBase httpRequest, HttpContext localContext) throws WeiboException { HttpResponse response = null; try { if (localContext != null) { response = httpClient.execute(httpRequest, localContext); } else { response = httpClient.execute(httpRequest); } } catch (ConnectTimeoutException e) { AppLogger.e(e.getMessage()); throw new WeiboException(GlobalContext.getInstance().getString(R.string.timeout), e); } catch (ClientProtocolException e) { AppLogger.e(e.getMessage()); throw new WeiboException(GlobalContext.getInstance().getString(R.string.timeout), e); } catch (IOException e) { AppLogger.e(e.getMessage()); throw new WeiboException(GlobalContext.getInstance().getString(R.string.timeout), e); } return response; }