Program: 154133
Project: 154133
Buggy source:
private int preProcessPage(WebURL curURL){
  if (curURL == null) {
    return -1;
  }
  Page page=new Page(curURL);
  int statusCode=PageFetcher.fetch(page,IGNORE_BINARY_CONTENT);
  curURL=page.getWebURL();
  int docid=curURL.getDocid();
  if (statusCode != PageFetchStatus.OK) {
    if (statusCode == PageFetchStatus.PageTooBig) {
      logger.error("String_Node_Str" + curURL.getURL());
    }
    return statusCode;
  }
  try {
    if (!page.isBinary()) {
      htmlParser.parse(page.getHTML(),curURL.getURL());
      page.setText(htmlParser.getText());
      page.setTitle(htmlParser.getTitle());
      if (page.getText() == null) {
        return PageFetchStatus.NotInTextFormat;
      }
      Iterator<String> it=htmlParser.getLinks().iterator();
      ArrayList<WebURL> toSchedule=new ArrayList<WebURL>();
      ArrayList<WebURL> toList=new ArrayList<WebURL>();
      while (it.hasNext()) {
        String url=it.next();
        if (url != null) {
          int newdocid=DocIDServer.getDocID(url);
          if (newdocid > 0) {
            if (newdocid != docid) {
              WebURL webURL=new WebURL();
              webURL.setURL(url);
              webURL.setDocid(newdocid);
              toList.add(webURL);
            }
          }
 else {
            WebURL webURL=new WebURL();
            webURL.setURL(url);
            webURL.setDocid(-newdocid);
            toList.add(webURL);
            if (shouldVisit(webURL)) {
              if (MAX_CRAWL_DEPTH == -1 || curURL.getDepth() < MAX_CRAWL_DEPTH) {
                webURL.setParentDocid(docid);
                webURL.setDepth((short)(curURL.getDepth() + 1));
                toSchedule.add(webURL);
              }
            }
          }
        }
      }
      Frontier.scheduleAll(toSchedule);
      page.setURLs(toList);
    }
    visit(page);
  }
 catch (  Exception e) {
    e.printStackTrace();
    logger.error(e.getMessage() + "String_Node_Str" + curURL.getURL());
  }
  return PROCESS_OK;
}

Fixed version (ground truth):
private int preProcessPage(WebURL curURL){
  if (curURL == null) {
    return -1;
  }
  Page page=new Page(curURL);
  int statusCode=PageFetcher.fetch(page,IGNORE_BINARY_CONTENT);
  curURL=page.getWebURL();
  int docid=curURL.getDocid();
  if (statusCode != PageFetchStatus.OK) {
    if (statusCode == PageFetchStatus.Moved) {
      if (FOLLOW_REDIRECTS) {
        String movedToUrl=curURL.getURL();
        if (movedToUrl == null) {
          return PageFetchStatus.MovedToUnknownLocation;
        }
        movedToUrl=URLCanonicalizer.getCanonicalURL(movedToUrl);
        int newdocid=DocIDServer.getDocID(movedToUrl);
        if (newdocid > 0) {
          return PageFetchStatus.RedirectedPageIsSeen;
        }
 else {
          WebURL webURL=new WebURL();
          webURL.setURL(movedToUrl);
          webURL.setDocid(-newdocid);
          if (shouldVisit(webURL)) {
            webURL.setParentDocid(curURL.getParentDocid());
            webURL.setDepth((short)(curURL.getDepth()));
            Frontier.schedule(webURL);
          }
        }
      }
      return PageFetchStatus.Moved;
    }
 else     if (statusCode == PageFetchStatus.PageTooBig) {
      logger.error("String_Node_Str" + curURL.getURL());
    }
    return statusCode;
  }
  try {
    if (!page.isBinary()) {
      htmlParser.parse(page.getHTML(),curURL.getURL());
      page.setText(htmlParser.getText());
      page.setTitle(htmlParser.getTitle());
      if (page.getText() == null) {
        return PageFetchStatus.NotInTextFormat;
      }
      Iterator<String> it=htmlParser.getLinks().iterator();
      ArrayList<WebURL> toSchedule=new ArrayList<WebURL>();
      ArrayList<WebURL> toList=new ArrayList<WebURL>();
      while (it.hasNext()) {
        String url=it.next();
        if (url != null) {
          int newdocid=DocIDServer.getDocID(url);
          if (newdocid > 0) {
            if (newdocid != docid) {
              WebURL webURL=new WebURL();
              webURL.setURL(url);
              webURL.setDocid(newdocid);
              toList.add(webURL);
            }
          }
 else {
            WebURL webURL=new WebURL();
            webURL.setURL(url);
            webURL.setDocid(-newdocid);
            toList.add(webURL);
            if (shouldVisit(webURL)) {
              if (MAX_CRAWL_DEPTH == -1 || curURL.getDepth() < MAX_CRAWL_DEPTH) {
                webURL.setParentDocid(docid);
                webURL.setDepth((short)(curURL.getDepth() + 1));
                toSchedule.add(webURL);
              }
            }
          }
        }
      }
      Frontier.scheduleAll(toSchedule);
      page.setURLs(toList);
    }
    visit(page);
  }
 catch (  Exception e) {
    e.printStackTrace();
    logger.error(e.getMessage() + "String_Node_Str" + curURL.getURL());
  }
  return PROCESS_OK;
}