Program: 30705
Project: 30705
Buggy source:
public ArrayList<Token> process(String doc) throws Exception {
  if (service == null || count % 10 == 0) {
    initialize();
  }
  count++;
  ArrayList<Token> allWords=new ArrayList<Token>();
  Annotation document=new Annotation(doc);
  System.err.println("String_Node_Str");
  pipeline.annotate(document);
  int s=0;
  int t=0;
  int p=0;
  boolean quotation=false;
  List<CoreMap> sentences=document.get(SentencesAnnotation.class);
  int totalSentences=sentences.size() - 1;
  for (  CoreMap sentence : sentences) {
    if (s % 100 == 0 || s == totalSentences) {
      double ratio=((double)s) / totalSentences;
      System.err.print(String.format("String_Node_Str",ratio,s,totalSentences));
    }
    int id=1;
    String[] parseTokens=new String[sentence.get(TokensAnnotation.class).size()];
    ArrayList<Token> annos=new ArrayList<Token>();
    for (    CoreLabel token : sentence.get(TokensAnnotation.class)) {
      String word=token.get(TextAnnotation.class);
      String pos=token.get(PartOfSpeechAnnotation.class);
      String lemma=token.get(LemmaAnnotation.class);
      String ne=token.get(NamedEntityTagAnnotation.class);
      int beginOffset=token.beginPosition();
      int endOffset=token.endPosition();
      String whitespaceAfter=token.after();
      String original=token.originalText();
      if (word.equals("String_Node_Str")) {
        quotation=true;
      }
      Token anno=new Token();
      anno.original=original;
      anno.word=word;
      anno.pos=pos;
      anno.lemma=lemma;
      anno.ner=ne;
      anno.sentenceID=s;
      anno.tokenId=t;
      anno.beginOffset=beginOffset;
      anno.endOffset=endOffset;
      anno.quotation=quotation;
      anno.setWhitespaceAfter(whitespaceAfter);
      anno.p=p;
      annos.add(anno);
      String parseToken=String.format("String_Node_Str",id,word,lemma,pos,pos,"String_Node_Str");
      parseTokens[id - 1]=parseToken;
      id++;
      allWords.add(anno);
      t++;
      whitespaceAfter=anno.whitespaceAfter;
      if (word.equals("String_Node_Str")) {
        quotation=false;
      }
      if (token.after().matches("String_Node_Str")) {
        p++;
      }
    }
    s++;
    DependencyStructure graph=service.parse(parseTokens);
    SymbolTable symboltable=graph.getSymbolTables().getSymbolTable("String_Node_Str");
    SortedSet<Integer> depInts=graph.getDependencyIndices();
    for (    int dint : depInts) {
      if (dint > 0) {
        Token anno=annos.get(dint - 1);
        DependencyNode node=graph.getDependencyNode(dint);
        DependencyNode head=node.getHead();
        int headIndex=0;
        String label="String_Node_Str";
        if (head != null) {
          Edge edge=node.getHeadEdge();
          headIndex=head.getIndex();
          label=edge.getLabelSymbol(symboltable);
        }
        int globalHead=-1;
        if (headIndex > 0) {
          int offset=headIndex - dint;
          globalHead=offset + anno.tokenId;
        }
        anno.head=globalHead;
        anno.deprel=label;
        annos.set(dint - 1,anno);
      }
    }
  }
  p++;
  System.err.println();
  service.terminateParserModel();
  return allWords;
}

Fixed version (ground truth):
public ArrayList<Token> process(String doc) throws Exception {
  if (service == null || count % 10 == 0) {
    initialize();
  }
  count++;
  ArrayList<Token> allWords=new ArrayList<Token>();
  Annotation document=new Annotation(doc);
  System.err.println("String_Node_Str");
  pipeline.annotate(document);
  int s=0;
  int t=0;
  int p=0;
  boolean quotation=false;
  List<CoreMap> sentences=document.get(SentencesAnnotation.class);
  int totalSentences=sentences.size() - 1;
  ArrayList<ArrayList<Token>> sentenceannos=new ArrayList<ArrayList<Token>>();
  for (int cm_indx=0; cm_indx < sentences.size(); cm_indx++) {
    CoreMap sentence=sentences.get(cm_indx);
    if (s % 100 == 0 || s == totalSentences) {
      double ratio=((double)s) / totalSentences;
      System.err.print(String.format("String_Node_Str",ratio,s,totalSentences));
    }
    ArrayList<Token> annos=new ArrayList<Token>();
    for (    CoreLabel token : sentence.get(TokensAnnotation.class)) {
      String word=token.get(TextAnnotation.class);
      String pos=token.get(PartOfSpeechAnnotation.class);
      String lemma=token.get(LemmaAnnotation.class);
      String ne=token.get(NamedEntityTagAnnotation.class);
      int beginOffset=token.beginPosition();
      int endOffset=token.endPosition();
      String whitespaceAfter=token.after();
      String original=token.originalText();
      if (word.equals("String_Node_Str")) {
        quotation=true;
      }
      Token anno=new Token();
      anno.original=original;
      anno.word=word;
      anno.pos=pos;
      anno.lemma=lemma;
      anno.ner=ne;
      anno.sentenceID=s;
      anno.tokenId=t;
      anno.beginOffset=beginOffset;
      anno.endOffset=endOffset;
      anno.quotation=quotation;
      anno.setWhitespaceAfter(whitespaceAfter);
      anno.p=p;
      annos.add(anno);
      allWords.add(anno);
      t++;
      whitespaceAfter=anno.whitespaceAfter;
      if (word.equals("String_Node_Str")) {
        quotation=false;
      }
      if (token.after().matches("String_Node_Str")) {
        p++;
      }
    }
    sentenceannos.add(annos);
  }
  ArrayList<ArrayList<Token>> new_sentences=new ArrayList<ArrayList<Token>>();
  boolean lastFlag=false;
  for (int s_idx=0; s_idx < sentenceannos.size(); s_idx++) {
    boolean lowercaseFlag=false;
    ArrayList<Token> annos=sentenceannos.get(s_idx);
    if (annos.size() > 0 && annos.get(0).word.toLowerCase().equals(annos.get(0).word) && annos.get(0).word.matches("String_Node_Str")) {
      lowercaseFlag=true;
    }
    if (lastFlag == true && lowercaseFlag == true) {
      ArrayList<Token> this_annos=new_sentences.get(new_sentences.size() - 1);
      for (int t_idx=0; t_idx < annos.size(); t_idx++) {
        Token anno=annos.get(t_idx);
        this_annos.add(anno);
      }
      new_sentences.set(new_sentences.size() - 1,this_annos);
    }
 else {
      ArrayList<Token> newannos=new ArrayList<Token>();
      for (int t_idx=0; t_idx < annos.size(); t_idx++) {
        Token anno=annos.get(t_idx);
        newannos.add(anno);
      }
      new_sentences.add(newannos);
    }
    lastFlag=false;
    if (annos.size() > 1) {
      Token ultimate=annos.get(annos.size() - 1);
      Token penultimate=annos.get(annos.size() - 2);
      if (ultimate.word.equals("String_Node_Str") && (penultimate.word.equals("String_Node_Str") || penultimate.word.equals("String_Node_Str"))) {
        lastFlag=true;
      }
    }
  }
  for (int s_idx=0; s_idx < new_sentences.size(); s_idx++) {
    ArrayList<Token> annos=new_sentences.get(s_idx);
    int id=1;
    String[] parseTokens=new String[annos.size()];
    for (    Token anno : annos) {
      String parseToken=String.format("String_Node_Str",id,anno.word,anno.lemma,anno.pos,anno.pos,"String_Node_Str");
      parseTokens[id - 1]=parseToken;
      id++;
      anno.sentenceID=s;
    }
    s++;
    DependencyStructure graph=service.parse(parseTokens);
    SymbolTable symboltable=graph.getSymbolTables().getSymbolTable("String_Node_Str");
    SortedSet<Integer> depInts=graph.getDependencyIndices();
    for (    int dint : depInts) {
      if (dint > 0) {
        Token anno=annos.get(dint - 1);
        DependencyNode node=graph.getDependencyNode(dint);
        DependencyNode head=node.getHead();
        int headIndex=0;
        String label="String_Node_Str";
        if (head != null) {
          Edge edge=node.getHeadEdge();
          headIndex=head.getIndex();
          label=edge.getLabelSymbol(symboltable);
        }
        int globalHead=-1;
        if (headIndex > 0) {
          int offset=headIndex - dint;
          globalHead=offset + anno.tokenId;
        }
        anno.head=globalHead;
        anno.deprel=label;
        annos.set(dint - 1,anno);
      }
    }
  }
  p++;
  System.err.println();
  service.terminateParserModel();
  return allWords;
}