[Demonstration 1]

[Buggy Method]
private static String getDownloadUrl(String urlStr) {
    String downloadUrl = "";
    HttpURLConnection conn = null;
    try {
        URL url = new URL(urlStr);
        conn = (HttpURLConnection) url.openConnection();
        conn.setConnectTimeout(20000);
        conn.setReadTimeout(5000);
        conn.setRequestMethod("HEAD");
        int responseCode = conn.getResponseCode();
        if (200 == responseCode || 302 == responseCode) {
            downloadUrl = conn.getHeaderField("Location");
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (conn != null) {
            conn.disconnect();
        }
    }
    logger.debug("downloadUrl : " + downloadUrl);
    return downloadUrl;
}

[Buggy Hunk]
private static String getDownloadUrl(String urlStr) {

[Patch]
public static String getDownloadUrl(String urlStr) {

[Demonstration 2]

[Buggy Method]
public boolean isOK(URL url) {
    //		return this.is(new ArrayList<Response.Status>(){{add(Response.Status.OK);add(Response.Status.SEE_OTHER);add(Response.Status.MOVED_PERMANENTLY);}}, url);
    return getURLResponseStatus(url).getStatusCode() < 400;
}

[Buggy Hunk]
public boolean isOK(URL url){

[Patch]
public boolean isOK(URL url) throws UriBuilderException{

[Demonstration 3]

[Buggy Method]
public HttpClient getClient() {
    RequestConfig.Builder requestConfigBuilder = RequestConfig.custom();
    requestConfigBuilder.setConnectTimeout(ConfigHelper.getConnectTimeout()).setSocketTimeout(ConfigHelper.getReadTimeout());
    if (ConfigHelper.getProxyInetAddress() != null) {
        HttpHost proxy = new HttpHost(ConfigHelper.getProxyInetAddress());
        requestConfigBuilder.setProxy(proxy);
    }
    RequestConfig requestConfig = requestConfigBuilder.build();
    org.apache.http.client.HttpClient client = HttpClients.custom().setDefaultRequestConfig(requestConfig).setConnectionManager(connectionManager).build();
    HttpClient httpClient = new HttpClient4(client);
    return httpClient;
}

[Buggy Hunk]
HttpHost proxy = new HttpHost(ConfigHelper.getProxyInetAddress());

[Patch]
HttpHost proxy = new HttpHost(ConfigHelper.getProxyInetAddress(), ConfigHelper.getProxyPort());