Program: 24289
Project: 24289
Buggy source:
private static void addInternalNPStructureForRoleAppositives(Tree tree){
  TreeFactory factory=new LabeledScoredTreeFactory();
  String patS="String_Node_Str";
  TregexPattern pat=TregexPatternFactory.getPattern(patS);
  TregexMatcher matcher=pat.matcher(tree);
  String prevLabelS="String_Node_Str";
  String curLabelS;
  Tree tmp;
  int start;
  Tree newNode;
  while (matcher.find()) {
    Tree parentNP=matcher.getNode("String_Node_Str");
    start=-1;
    boolean endOfSubseq;
    for (int i=0; i < parentNP.numChildren(); i++) {
      endOfSubseq=false;
      tmp=parentNP.getChild(i);
      curLabelS=tmp.label().value();
      if (start == -1) {
        if (curLabelS.matches("String_Node_Str")) {
          start=i;
        }
      }
 else {
        if (prevLabelS.matches("String_Node_Str")) {
          endOfSubseq=!curLabelS.matches("String_Node_Str");
        }
 else         if (prevLabelS.matches("String_Node_Str")) {
          endOfSubseq=!curLabelS.matches("String_Node_Str");
        }
      }
      if (endOfSubseq) {
        newNode=factory.newTreeNode("String_Node_Str",new ArrayList<Tree>());
        for (int j=0; j < i - start; j++) {
          newNode.addChild(parentNP.getChild(start));
          parentNP.removeChild(start);
        }
        parentNP.addChild(start,newNode);
        i=start + 1;
        if (curLabelS.matches("String_Node_Str")) {
          start=i;
        }
 else {
          start=-1;
        }
      }
      prevLabelS=curLabelS;
    }
    if (start != -1) {
      newNode=factory.newTreeNode("String_Node_Str",new ArrayList<Tree>());
      for (int j=0; j < parentNP.numChildren() - start + 1; j++) {
        newNode.addChild(parentNP.getChild(start));
        parentNP.removeChild(start);
      }
      parentNP.addChild(start,newNode);
    }
  }
}

Fixed version (ground truth):
private static void addInternalNPStructureForRoleAppositives(Tree tree){
  TreeFactory factory=new LabeledScoredTreeFactory();
  String patS="String_Node_Str";
  TregexPattern pat=TregexPatternFactory.getPattern(patS);
  TregexMatcher matcher=pat.matcher(tree);
  String prevLabelS="String_Node_Str";
  String curLabelS;
  Tree tmp;
  int start;
  Tree newNode;
  while (matcher.find()) {
    Tree parentNP=matcher.getNode("String_Node_Str");
    start=-1;
    boolean endOfSubseq;
    for (int i=0; i < parentNP.numChildren(); i++) {
      endOfSubseq=false;
      tmp=parentNP.getChild(i);
      curLabelS=tmp.label().value();
      if (start == -1) {
        if (curLabelS.matches("String_Node_Str")) {
          start=i;
        }
      }
 else {
        if (prevLabelS.matches("String_Node_Str")) {
          endOfSubseq=!curLabelS.matches("String_Node_Str");
        }
      }
      if (endOfSubseq) {
        newNode=factory.newTreeNode("String_Node_Str",new ArrayList<Tree>());
        for (int j=0; j < i - start; j++) {
          newNode.addChild(parentNP.getChild(start));
          parentNP.removeChild(start);
        }
        parentNP.addChild(start,newNode);
        i=start + 1;
        if (curLabelS.matches("String_Node_Str")) {
          start=i;
        }
 else {
          start=-1;
        }
      }
      prevLabelS=curLabelS;
    }
    if (start != -1) {
      newNode=factory.newTreeNode("String_Node_Str",new ArrayList<Tree>());
      for (int j=0; j < parentNP.numChildren() - start + 1; j++) {
        newNode.addChild(parentNP.getChild(start));
        parentNP.removeChild(start);
      }
      parentNP.addChild(start,newNode);
    }
  }
}