Program: 56754
Project: 56754
Buggy source:
private static void setCookie() throws IOException {
  if (YahooFinance.HISTQUOTES2_COOKIE != null && !YahooFinance.HISTQUOTES2_COOKIE.isEmpty()) {
    cookie=YahooFinance.HISTQUOTES2_COOKIE;
    log.debug("String_Node_Str",cookie);
    return;
  }
  URL request=new URL(YahooFinance.HISTQUOTES2_SCRAPE_URL);
  RedirectableRequest redirectableRequest=new RedirectableRequest(request,5);
  redirectableRequest.setConnectTimeout(YahooFinance.CONNECTION_TIMEOUT);
  redirectableRequest.setReadTimeout(YahooFinance.CONNECTION_TIMEOUT);
  URLConnection connection=redirectableRequest.openConnection();
  for (  String headerKey : connection.getHeaderFields().keySet()) {
    if ("String_Node_Str".equalsIgnoreCase(headerKey)) {
      for (      String cookieField : connection.getHeaderFields().get(headerKey)) {
        for (        String cookieValue : cookieField.split("String_Node_Str")) {
          if (cookieValue.matches("String_Node_Str")) {
            cookie=cookieValue;
            log.debug("String_Node_Str",cookie);
            return;
          }
        }
      }
    }
  }
  log.warn("String_Node_Str");
}

Fixed version (ground truth):
private static void setCookie() throws IOException {
  if (YahooFinance.HISTQUOTES2_COOKIE != null && !YahooFinance.HISTQUOTES2_COOKIE.isEmpty()) {
    cookie=YahooFinance.HISTQUOTES2_COOKIE;
    log.debug("String_Node_Str",cookie);
    return;
  }
  URL request=new URL(YahooFinance.HISTQUOTES2_SCRAPE_URL);
  RedirectableRequest redirectableRequest=new RedirectableRequest(request,5);
  redirectableRequest.setConnectTimeout(YahooFinance.CONNECTION_TIMEOUT);
  redirectableRequest.setReadTimeout(YahooFinance.CONNECTION_TIMEOUT);
  URLConnection connection=redirectableRequest.openConnection();
  for (  String headerKey : connection.getHeaderFields().keySet()) {
    if ("String_Node_Str".equalsIgnoreCase(headerKey)) {
      for (      String cookieField : connection.getHeaderFields().get(headerKey)) {
        for (        String cookieValue : cookieField.split("String_Node_Str")) {
          if (cookieValue.matches("String_Node_Str")) {
            cookie=cookieValue;
            log.debug("String_Node_Str",cookie);
            return;
          }
        }
      }
    }
  }
  InputStreamReader is=new InputStreamReader(connection.getInputStream());
  BufferedReader br=new BufferedReader(is);
  String line;
  Pattern patternPostForm=Pattern.compile("String_Node_Str");
  Pattern patternInput=Pattern.compile("String_Node_Str");
  Matcher matcher;
  Map<String,String> datas=new HashMap<String,String>();
  boolean postFind=false;
  while ((line=br.readLine()) != null) {
    matcher=patternPostForm.matcher(line);
    if (matcher.find()) {
      postFind=true;
    }
    if (postFind) {
      matcher=patternInput.matcher(line);
      if (matcher.find()) {
        String name=matcher.group(3);
        String value=matcher.group(5);
        datas.put(name,value);
      }
    }
  }
  if (datas.size() > 0) {
    datas.put("String_Node_Str",YahooFinance.HISTQUOTES2_COOKIE_NAMESPACE);
    datas.put("String_Node_Str",YahooFinance.HISTQUOTES2_COOKIE_AGREE);
    datas.put("String_Node_Str",YahooFinance.HISTQUOTES2_SCRAPE_URL);
    datas.put("String_Node_Str",YahooFinance.HISTQUOTES2_COOKIE_OATH_DONEURL + datas.get("String_Node_Str") + "String_Node_Str"+ datas.get("String_Node_Str")+ "String_Node_Str"+ datas.get("String_Node_Str"));
    URL requestOath=new URL(YahooFinance.HISTQUOTES2_COOKIE_OATH_URL);
    HttpURLConnection connectionOath=null;
    connectionOath=(HttpURLConnection)requestOath.openConnection();
    connectionOath.setConnectTimeout(YahooFinance.CONNECTION_TIMEOUT);
    connectionOath.setReadTimeout(YahooFinance.CONNECTION_TIMEOUT);
    connectionOath.setRequestMethod("String_Node_Str");
    connectionOath.setDoOutput(true);
    connectionOath.setRequestProperty("String_Node_Str",connection.getURL().toString());
    connectionOath.setRequestProperty("String_Node_Str",YahooFinance.HISTQUOTES2_COOKIE_OATH_HOST);
    connectionOath.setRequestProperty("String_Node_Str",YahooFinance.HISTQUOTES2_COOKIE_OATH_ORIGIN);
    connectionOath.setRequestProperty("String_Node_Str","String_Node_Str");
    StringBuilder params=new StringBuilder("String_Node_Str");
    for (    String key : datas.keySet()) {
      if (params.length() == 0) {
        params.append(key);
        params.append("String_Node_Str");
        params.append(URLEncoder.encode(datas.get(key),"String_Node_Str"));
      }
 else {
        params.append("String_Node_Str");
        params.append(key);
        params.append("String_Node_Str");
        params.append(URLEncoder.encode(datas.get(key),"String_Node_Str"));
      }
    }
    log.debug("String_Node_Str" + params.toString());
    connectionOath.setRequestProperty("String_Node_Str",Integer.toString(params.toString().length()));
    OutputStreamWriter outputStreamWriter=new OutputStreamWriter(connectionOath.getOutputStream());
    outputStreamWriter.write(params.toString());
    outputStreamWriter.flush();
    connectionOath.setInstanceFollowRedirects(true);
    connectionOath.getResponseCode();
  }
  CookieStore cookieJar=((CookieManager)CookieHandler.getDefault()).getCookieStore();
  List<HttpCookie> cookies=cookieJar.getCookies();
  for (  HttpCookie hcookie : cookies) {
    if (hcookie.toString().matches("String_Node_Str")) {
      cookie=hcookie.toString();
      log.debug("String_Node_Str",cookie);
      return;
    }
  }
  log.warn("String_Node_Str");
}