Program: 110720
Project: 110720
Buggy source:
URLConnection connect(URL originalUrl,ImmutableMap<String,String> requestHeaders) throws IOException {
  if (Thread.interrupted()) {
    throw new InterruptedIOException();
  }
  URL url=originalUrl;
  if (HttpUtils.isProtocol(url,"String_Node_Str")) {
    return url.openConnection();
  }
  List<Throwable> suppressions=new ArrayList<>();
  int retries=0;
  int redirects=0;
  int connectTimeout=MIN_CONNECT_TIMEOUT_MS;
  while (true) {
    HttpURLConnection connection=null;
    try {
      connection=(HttpURLConnection)url.openConnection(proxyHelper.createProxyIfNeeded(url));
      boolean isAlreadyCompressed=COMPRESSED_EXTENSIONS.contains(HttpUtils.getExtension(url.getPath())) || COMPRESSED_EXTENSIONS.contains(HttpUtils.getExtension(originalUrl.getPath()));
      for (      Map.Entry<String,String> entry : requestHeaders.entrySet()) {
        if (isAlreadyCompressed && Ascii.equalsIgnoreCase(entry.getKey(),"String_Node_Str")) {
          continue;
        }
        connection.setRequestProperty(entry.getKey(),entry.getValue());
      }
      connection.setConnectTimeout(connectTimeout);
      connection.setReadTimeout(READ_TIMEOUT_MS);
      int code;
      try {
        connection.connect();
        code=connection.getResponseCode();
      }
 catch (      FileNotFoundException ignored) {
        code=connection.getResponseCode();
      }
catch (      UnknownHostException e) {
        String message="String_Node_Str" + e.getMessage();
        eventHandler.handle(Event.progress(message));
        throw new UnrecoverableHttpException(message);
      }
catch (      IllegalArgumentException e) {
        throw new UnrecoverableHttpException(e.getMessage());
      }
catch (      IOException e) {
        if (e.getMessage() == null || !e.getMessage().startsWith("String_Node_Str")) {
          throw e;
        }
        code=connection.getResponseCode();
      }
      if (code == 200 || code == 206) {
        return connection;
      }
 else       if (code == 301 || code == 302 || code == 307) {
        readAllBytesAndClose(connection.getInputStream());
        if (++redirects == MAX_REDIRECTS) {
          eventHandler.handle(Event.progress("String_Node_Str" + originalUrl));
          throw new UnrecoverableHttpException("String_Node_Str");
        }
        url=HttpUtils.getLocation(connection);
        if (code == 301) {
          originalUrl=url;
        }
      }
 else       if (code == 403) {
        throw new IOException(describeHttpResponse(connection));
      }
 else       if (code == 408) {
        throw new IOException(describeHttpResponse(connection));
      }
 else       if (code < 500 || code == 501 || code == 502 || code == 505) {
        readAllBytesAndClose(connection.getErrorStream());
        throw new UnrecoverableHttpException(describeHttpResponse(connection));
      }
 else {
        throw new IOException(describeHttpResponse(connection));
      }
    }
 catch (    UnrecoverableHttpException e) {
      throw e;
    }
catch (    IOException e) {
      if (connection != null) {
        connection.disconnect();
      }
      int timeout=IntMath.pow(2,retries) * MIN_RETRY_DELAY_MS;
      if (e instanceof SocketTimeoutException) {
        eventHandler.handle(Event.progress("String_Node_Str" + url));
        connectTimeout=Math.min(connectTimeout * 2,MAX_CONNECT_TIMEOUT_MS);
        timeout=1;
      }
 else       if (e instanceof InterruptedIOException) {
        throw e;
      }
      if (++retries == MAX_RETRIES) {
        if (!(e instanceof SocketTimeoutException)) {
          eventHandler.handle(Event.progress(format("String_Node_Str",url,e.getMessage())));
        }
        for (        Throwable suppressed : suppressions) {
          e.addSuppressed(suppressed);
        }
        throw e;
      }
      suppressions.add(e);
      eventHandler.handle(Event.progress(format("String_Node_Str",url,timeout)));
      url=originalUrl;
      try {
        sleeper.sleepMillis(timeout);
      }
 catch (      InterruptedException translated) {
        throw new InterruptedIOException();
      }
    }
catch (    RuntimeException e) {
      if (connection != null) {
        connection.disconnect();
      }
      eventHandler.handle(Event.progress(format("String_Node_Str",url,e)));
      throw e;
    }
  }
}

Fixed version (ground truth):
URLConnection connect(URL originalUrl,ImmutableMap<String,String> requestHeaders) throws IOException {
  if (Thread.interrupted()) {
    throw new InterruptedIOException();
  }
  URL url=originalUrl;
  if (HttpUtils.isProtocol(url,"String_Node_Str")) {
    return url.openConnection();
  }
  List<Throwable> suppressions=new ArrayList<>();
  int retries=0;
  int redirects=0;
  int connectTimeout=MIN_CONNECT_TIMEOUT_MS;
  while (true) {
    HttpURLConnection connection=null;
    try {
      connection=(HttpURLConnection)url.openConnection(proxyHelper.createProxyIfNeeded(url));
      boolean isAlreadyCompressed=COMPRESSED_EXTENSIONS.contains(HttpUtils.getExtension(url.getPath())) || COMPRESSED_EXTENSIONS.contains(HttpUtils.getExtension(originalUrl.getPath()));
      connection.setInstanceFollowRedirects(false);
      for (      Map.Entry<String,String> entry : requestHeaders.entrySet()) {
        if (isAlreadyCompressed && Ascii.equalsIgnoreCase(entry.getKey(),"String_Node_Str")) {
          continue;
        }
        connection.setRequestProperty(entry.getKey(),entry.getValue());
      }
      connection.setConnectTimeout(connectTimeout);
      connection.setReadTimeout(READ_TIMEOUT_MS);
      int code;
      try {
        connection.connect();
        code=connection.getResponseCode();
      }
 catch (      FileNotFoundException ignored) {
        code=connection.getResponseCode();
      }
catch (      UnknownHostException e) {
        String message="String_Node_Str" + e.getMessage();
        eventHandler.handle(Event.progress(message));
        throw new UnrecoverableHttpException(message);
      }
catch (      IllegalArgumentException e) {
        throw new UnrecoverableHttpException(e.getMessage());
      }
catch (      IOException e) {
        if (e.getMessage() == null || !e.getMessage().startsWith("String_Node_Str")) {
          throw e;
        }
        code=connection.getResponseCode();
      }
      if (code == 200 || code == 206) {
        return connection;
      }
 else       if (code == 301 || code == 302 || code == 303 || code == 307) {
        readAllBytesAndClose(connection.getInputStream());
        if (++redirects == MAX_REDIRECTS) {
          eventHandler.handle(Event.progress("String_Node_Str" + originalUrl));
          throw new UnrecoverableHttpException("String_Node_Str");
        }
        url=HttpUtils.getLocation(connection);
        if (code == 301) {
          originalUrl=url;
        }
      }
 else       if (code == 403) {
        throw new IOException(describeHttpResponse(connection));
      }
 else       if (code == 408) {
        throw new IOException(describeHttpResponse(connection));
      }
 else       if (code < 500 || code == 501 || code == 502 || code == 505) {
        readAllBytesAndClose(connection.getErrorStream());
        throw new UnrecoverableHttpException(describeHttpResponse(connection));
      }
 else {
        throw new IOException(describeHttpResponse(connection));
      }
    }
 catch (    UnrecoverableHttpException e) {
      throw e;
    }
catch (    IOException e) {
      if (connection != null) {
        connection.disconnect();
      }
      int timeout=IntMath.pow(2,retries) * MIN_RETRY_DELAY_MS;
      if (e instanceof SocketTimeoutException) {
        eventHandler.handle(Event.progress("String_Node_Str" + url));
        connectTimeout=Math.min(connectTimeout * 2,MAX_CONNECT_TIMEOUT_MS);
        timeout=1;
      }
 else       if (e instanceof InterruptedIOException) {
        throw e;
      }
      if (++retries == MAX_RETRIES) {
        if (!(e instanceof SocketTimeoutException)) {
          eventHandler.handle(Event.progress(format("String_Node_Str",url,e.getMessage())));
        }
        for (        Throwable suppressed : suppressions) {
          e.addSuppressed(suppressed);
        }
        throw e;
      }
      suppressions.add(e);
      eventHandler.handle(Event.progress(format("String_Node_Str",url,timeout)));
      url=originalUrl;
      try {
        sleeper.sleepMillis(timeout);
      }
 catch (      InterruptedException translated) {
        throw new InterruptedIOException();
      }
    }
catch (    RuntimeException e) {
      if (connection != null) {
        connection.disconnect();
      }
      eventHandler.handle(Event.progress(format("String_Node_Str",url,e)));
      throw e;
    }
  }
}