Program: 154132
Project: 154132
Buggy source:
public static int fetch(Page page,boolean ignoreIfBinary){
  String toFetchURL=page.getWebURL().getURL();
  HttpGet get=null;
  HttpEntity entity=null;
  try {
    get=new HttpGet(toFetchURL);
synchronized (mutex) {
      long now=(new Date()).getTime();
      if (now - startOfPeriod > 10000) {
        logger.info("String_Node_Str" + processedCount / ((now - startOfPeriod) / 1000));
        processedCount=0;
        startOfPeriod=now;
      }
      processedCount++;
      if (now - lastFetchTime < politenessDelay) {
        Thread.sleep(politenessDelay - (now - lastFetchTime));
      }
      lastFetchTime=(new Date()).getTime();
    }
    HttpResponse response=httpclient.execute(get);
    entity=response.getEntity();
    if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
      if (response.getStatusLine().getStatusCode() != HttpStatus.SC_NOT_FOUND) {
        logger.info("String_Node_Str" + response.getStatusLine().toString() + "String_Node_Str"+ toFetchURL);
      }
 else       if (show404Pages) {
        logger.info("String_Node_Str" + toFetchURL + "String_Node_Str"+ page.getWebURL().getParentDocid()+ "String_Node_Str");
      }
      return response.getStatusLine().getStatusCode();
    }
    String uri=get.getURI().toString();
    if (!uri.equals(toFetchURL)) {
      if (!URLCanonicalizer.getCanonicalURL(uri).equals(toFetchURL)) {
        int newdocid=DocIDServer.getDocID(uri);
        if (newdocid != -1) {
          if (newdocid > 0) {
            return PageFetchStatus.RedirectedPageIsSeen;
          }
          WebURL webURL=new WebURL();
          webURL.setURL(uri);
          webURL.setDocid(-newdocid);
          page.setWebURL(webURL);
        }
      }
    }
    if (entity != null) {
      long size=entity.getContentLength();
      if (size == -1) {
        Header length=response.getLastHeader("String_Node_Str");
        if (length == null) {
          length=response.getLastHeader("String_Node_Str");
        }
        if (length != null) {
          size=Integer.parseInt(length.getValue());
        }
 else {
          size=-1;
        }
      }
      if (size > MAX_DOWNLOAD_SIZE) {
        entity.consumeContent();
        return PageFetchStatus.PageTooBig;
      }
      boolean isBinary=false;
      Header type=entity.getContentType();
      if (type != null && type.getValue().toLowerCase().contains("String_Node_Str")) {
        isBinary=true;
        if (ignoreIfBinary) {
          return PageFetchStatus.PageIsBinary;
        }
      }
      if (page.load(entity.getContent(),(int)size,isBinary)) {
        return PageFetchStatus.OK;
      }
 else {
        return PageFetchStatus.PageLoadError;
      }
    }
 else {
      get.abort();
    }
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + e.getMessage() + "String_Node_Str"+ toFetchURL+ "String_Node_Str"+ page.getWebURL().getParentDocid()+ "String_Node_Str");
    return PageFetchStatus.FatalTransportError;
  }
catch (  IllegalStateException e) {
  }
catch (  Exception e) {
    if (e.getMessage() == null) {
      logger.error("String_Node_Str" + page.getWebURL().getURL());
    }
 else {
      logger.error(e.getMessage() + "String_Node_Str" + page.getWebURL().getURL());
    }
  }
 finally {
    try {
      if (entity != null) {
        entity.consumeContent();
      }
 else       if (get != null) {
        get.abort();
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return PageFetchStatus.UnknownError;
}

Fixed version (ground truth):
public static int fetch(Page page,boolean ignoreIfBinary){
  String toFetchURL=page.getWebURL().getURL();
  HttpGet get=null;
  HttpEntity entity=null;
  try {
    get=new HttpGet(toFetchURL);
synchronized (mutex) {
      long now=(new Date()).getTime();
      if (now - startOfPeriod > 10000) {
        logger.info("String_Node_Str" + processedCount / ((now - startOfPeriod) / 1000));
        processedCount=0;
        startOfPeriod=now;
      }
      processedCount++;
      if (now - lastFetchTime < politenessDelay) {
        Thread.sleep(politenessDelay - (now - lastFetchTime));
      }
      lastFetchTime=(new Date()).getTime();
    }
    HttpResponse response=httpclient.execute(get);
    entity=response.getEntity();
    int statusCode=response.getStatusLine().getStatusCode();
    if (statusCode != HttpStatus.SC_OK) {
      if (statusCode != HttpStatus.SC_NOT_FOUND) {
        if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
          Header header=response.getFirstHeader("String_Node_Str");
          if (header != null) {
            String movedToUrl=header.getValue();
            page.getWebURL().setURL(movedToUrl);
          }
 else {
            page.getWebURL().setURL(null);
          }
          return PageFetchStatus.Moved;
        }
        logger.info("String_Node_Str" + response.getStatusLine().toString() + "String_Node_Str"+ toFetchURL);
      }
 else       if (show404Pages) {
        logger.info("String_Node_Str" + toFetchURL + "String_Node_Str"+ page.getWebURL().getParentDocid()+ "String_Node_Str");
      }
      return response.getStatusLine().getStatusCode();
    }
    String uri=get.getURI().toString();
    if (!uri.equals(toFetchURL)) {
      if (!URLCanonicalizer.getCanonicalURL(uri).equals(toFetchURL)) {
        int newdocid=DocIDServer.getDocID(uri);
        if (newdocid != -1) {
          if (newdocid > 0) {
            return PageFetchStatus.RedirectedPageIsSeen;
          }
          WebURL webURL=new WebURL();
          webURL.setURL(uri);
          webURL.setDocid(-newdocid);
          page.setWebURL(webURL);
        }
      }
    }
    if (entity != null) {
      long size=entity.getContentLength();
      if (size == -1) {
        Header length=response.getLastHeader("String_Node_Str");
        if (length == null) {
          length=response.getLastHeader("String_Node_Str");
        }
        if (length != null) {
          size=Integer.parseInt(length.getValue());
        }
 else {
          size=-1;
        }
      }
      if (size > MAX_DOWNLOAD_SIZE) {
        entity.consumeContent();
        return PageFetchStatus.PageTooBig;
      }
      boolean isBinary=false;
      Header type=entity.getContentType();
      if (type != null && type.getValue().toLowerCase().contains("String_Node_Str")) {
        isBinary=true;
        if (ignoreIfBinary) {
          return PageFetchStatus.PageIsBinary;
        }
      }
      if (page.load(entity.getContent(),(int)size,isBinary)) {
        return PageFetchStatus.OK;
      }
 else {
        return PageFetchStatus.PageLoadError;
      }
    }
 else {
      get.abort();
    }
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + e.getMessage() + "String_Node_Str"+ toFetchURL+ "String_Node_Str"+ page.getWebURL().getParentDocid()+ "String_Node_Str");
    return PageFetchStatus.FatalTransportError;
  }
catch (  IllegalStateException e) {
  }
catch (  Exception e) {
    if (e.getMessage() == null) {
      logger.error("String_Node_Str" + page.getWebURL().getURL());
    }
 else {
      logger.error(e.getMessage() + "String_Node_Str" + page.getWebURL().getURL());
    }
  }
 finally {
    try {
      if (entity != null) {
        entity.consumeContent();
      }
 else       if (get != null) {
        get.abort();
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return PageFetchStatus.UnknownError;
}