Program: 102862
Project: 102862
Buggy source:
@Override public Page download(Request request,Task task){
  Site site=null;
  if (task != null) {
    site=task.getSite();
  }
  int retryTimes=0;
  Set<Integer> acceptStatCode;
  String charset=null;
  Map<String,String> headers=null;
  if (site != null) {
    retryTimes=site.getRetryTimes();
    acceptStatCode=site.getAcceptStatCode();
    charset=site.getCharset();
    headers=site.getHeaders();
  }
 else {
    acceptStatCode=new HashSet<Integer>();
    acceptStatCode.add(200);
  }
  logger.info("String_Node_Str" + request.getUrl());
  HttpClient httpClient=getHttpClientPool().getClient(site);
  try {
    HttpGet httpGet=new HttpGet(request.getUrl());
    if (headers != null) {
      for (      Map.Entry<String,String> headerEntry : headers.entrySet()) {
        httpGet.addHeader(headerEntry.getKey(),headerEntry.getValue());
      }
    }
    HttpResponse httpResponse=null;
    int tried=0;
    boolean retry;
    do {
      try {
        httpResponse=httpClient.execute(httpGet);
        retry=false;
      }
 catch (      IOException e) {
        tried++;
        if (tried > retryTimes) {
          logger.warn("String_Node_Str" + request.getUrl() + "String_Node_Str",e);
          if (site.getCycleRetryTimes() > 0) {
            Page page=new Page();
            Object cycleTriedTimesObject=request.getExtra(Request.CYCLE_TRIED_TIMES);
            if (cycleTriedTimesObject == null) {
              page.addTargetRequest(request.setPriority(0).putExtra(Request.CYCLE_TRIED_TIMES,1));
            }
 else {
              int cycleTriedTimes=(Integer)cycleTriedTimesObject;
              cycleTriedTimes++;
              if (cycleTriedTimes >= site.getCycleRetryTimes()) {
                return null;
              }
              page.addTargetRequest(request.setPriority(0).putExtra(Request.CYCLE_TRIED_TIMES,1));
            }
            return page;
          }
          return null;
        }
        logger.info("String_Node_Str" + request.getUrl() + "String_Node_Str"+ tried+ "String_Node_Str");
        retry=true;
      }
    }
 while (retry);
    int statusCode=httpResponse.getStatusLine().getStatusCode();
    if (acceptStatCode.contains(statusCode)) {
      handleGzip(httpResponse);
      if (charset == null) {
        String value=httpResponse.getEntity().getContentType().getValue();
        charset=UrlUtils.getCharset(value);
      }
      return handleResponse(request,charset,httpResponse,task);
    }
 else {
      logger.warn("String_Node_Str" + statusCode + "String_Node_Str"+ request.getUrl());
    }
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + request.getUrl() + "String_Node_Str",e);
  }
  return null;
}

Fixed version (ground truth):
@Override public Page download(Request request,Task task){
  Site site=null;
  if (task != null) {
    site=task.getSite();
  }
  int retryTimes=0;
  Set<Integer> acceptStatCode;
  String charset=null;
  Map<String,String> headers=null;
  if (site != null) {
    retryTimes=site.getRetryTimes();
    acceptStatCode=site.getAcceptStatCode();
    charset=site.getCharset();
    headers=site.getHeaders();
  }
 else {
    acceptStatCode=new HashSet<Integer>();
    acceptStatCode.add(200);
  }
  logger.info("String_Node_Str" + request.getUrl());
  HttpClient httpClient=getHttpClientPool().getClient(site);
  try {
    HttpGet httpGet=new HttpGet(request.getUrl());
    if (headers != null) {
      for (      Map.Entry<String,String> headerEntry : headers.entrySet()) {
        httpGet.addHeader(headerEntry.getKey(),headerEntry.getValue());
      }
    }
    if (!httpGet.containsHeader("String_Node_Str")) {
      httpGet.addHeader("String_Node_Str","String_Node_Str");
    }
    HttpResponse httpResponse=null;
    int tried=0;
    boolean retry;
    do {
      try {
        httpResponse=httpClient.execute(httpGet);
        retry=false;
      }
 catch (      IOException e) {
        tried++;
        if (tried > retryTimes) {
          logger.warn("String_Node_Str" + request.getUrl() + "String_Node_Str",e);
          if (site.getCycleRetryTimes() > 0) {
            Page page=new Page();
            Object cycleTriedTimesObject=request.getExtra(Request.CYCLE_TRIED_TIMES);
            if (cycleTriedTimesObject == null) {
              page.addTargetRequest(request.setPriority(0).putExtra(Request.CYCLE_TRIED_TIMES,1));
            }
 else {
              int cycleTriedTimes=(Integer)cycleTriedTimesObject;
              cycleTriedTimes++;
              if (cycleTriedTimes >= site.getCycleRetryTimes()) {
                return null;
              }
              page.addTargetRequest(request.setPriority(0).putExtra(Request.CYCLE_TRIED_TIMES,1));
            }
            return page;
          }
          return null;
        }
        logger.info("String_Node_Str" + request.getUrl() + "String_Node_Str"+ tried+ "String_Node_Str");
        retry=true;
      }
    }
 while (retry);
    int statusCode=httpResponse.getStatusLine().getStatusCode();
    if (acceptStatCode.contains(statusCode)) {
      handleGzip(httpResponse);
      if (charset == null) {
        String value=httpResponse.getEntity().getContentType().getValue();
        charset=UrlUtils.getCharset(value);
      }
      return handleResponse(request,charset,httpResponse,task);
    }
 else {
      logger.warn("String_Node_Str" + statusCode + "String_Node_Str"+ request.getUrl());
    }
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + request.getUrl() + "String_Node_Str",e);
  }
  return null;
}