Program: 36064
Project: 36064
Buggy source:
/** 
 * This function does not output a formal XML document, but instead just the raw text  of a document annotated with XML markup around events and timexes.
 * @param docname The one file in the InfoFile that you want to stringify with XML markup.
 * @param eventElemName You can specify what you want the event's XML element to be (e.g., event or target)
 * @param idAttributeString You can specify what you want the event's XML attribute to be for its ID (e.g., id or eid)
 * @return A String which is the raw text with added XML markup around events and timexes.
 */
public String markupOriginalText(String docname,String eventElemName,String idAttributeString,boolean numericIDOnly,boolean showTense,boolean showAspect,boolean showClass){
  StringBuffer buf=new StringBuffer();
  boolean firstToken=true;
  List<Sentence> sentences=getSentences(docname);
  System.out.println("String_Node_Str" + docname + "String_Node_Str"+ sentences.size()+ "String_Node_Str");
  for (  Sentence sent : sentences) {
    List<CoreLabel> tokens=sent.tokens();
    Map<Integer,TextEvent> indexToEvents=new HashMap<Integer,TextEvent>();
    for (    TextEvent event : sent.events())     indexToEvents.put(event.getIndex(),event);
    Map<Integer,Timex> indexToTimexes=new HashMap<Integer,Timex>();
    for (    Timex timex : sent.timexes())     indexToTimexes.put(timex.getTokenOffset(),timex);
    Set<Integer> endTimexes=new HashSet<Integer>();
    int ii=1;
    for (    CoreLabel token : tokens) {
      if (firstToken) {
        buf.append(token.getString(CoreAnnotations.BeforeAnnotation.class));
        firstToken=false;
      }
      boolean endevent=false;
      if (indexToEvents.containsKey(ii)) {
        TextEvent event=indexToEvents.get(ii);
        String eventid=event.getId();
        if (numericIDOnly && eventid.startsWith("String_Node_Str"))         eventid=eventid.substring(1);
        buf.append("String_Node_Str" + eventElemName);
        buf.append("String_Node_Str" + idAttributeString + "String_Node_Str"+ eventid+ "String_Node_Str");
        if (showTense)         buf.append("String_Node_Str" + event.getTense() + "String_Node_Str");
        if (showAspect)         buf.append("String_Node_Str" + event.getAspect() + "String_Node_Str");
        if (showClass)         buf.append("String_Node_Str" + event.getTheClass() + "String_Node_Str");
        buf.append("String_Node_Str");
        endevent=true;
      }
      if (indexToTimexes.containsKey(ii)) {
        Timex timex=indexToTimexes.get(ii);
        buf.append(timex.toXMLString());
        endTimexes.add(ii + timex.getTokenLength() - 1);
      }
      String str=token.getString(CoreAnnotations.OriginalTextAnnotation.class);
      str=str.replaceAll("String_Node_Str","String_Node_Str");
      buf.append(str);
      if (endevent)       buf.append("String_Node_Str" + eventElemName + "String_Node_Str");
      if (endTimexes.contains(ii))       buf.append("String_Node_Str");
      buf.append(token.getString(CoreAnnotations.AfterAnnotation.class));
      ii++;
    }
  }
  return buf.toString();
}

Fixed version (ground truth):
/** 
 * This function does not output a formal XML document, but instead just the raw text  of a document annotated with XML markup around events and timexes.
 * @param docname The one file in the InfoFile that you want to stringify with XML markup.
 * @param eventElemName You can specify what you want the event's XML element to be (e.g., event or target)
 * @param idAttributeString You can specify what you want the event's XML attribute to be for its ID (e.g., id or eid)
 * @return A String which is the raw text with added XML markup around events and timexes.
 */
public String markupOriginalText(String docname,String eventElemName,String idAttributeString,boolean numericIDOnly,boolean showTense,boolean showAspect,boolean showClass){
  StringBuffer buf=new StringBuffer();
  boolean firstToken=true;
  List<Sentence> sentences=getSentences(docname);
  System.out.println("String_Node_Str" + docname + "String_Node_Str"+ sentences.size()+ "String_Node_Str");
  for (  Sentence sent : sentences) {
    List<CoreLabel> tokens=sent.tokens();
    Map<Integer,TextEvent> indexToEvents=new HashMap<Integer,TextEvent>();
    for (    TextEvent event : sent.events())     indexToEvents.put(event.getIndex(),event);
    Map<Integer,Timex> indexToTimexes=new HashMap<Integer,Timex>();
    for (    Timex timex : sent.timexes())     indexToTimexes.put(timex.getTokenOffset(),timex);
    Set<Integer> endTimexes=new HashSet<Integer>();
    int ii=1;
    for (    CoreLabel token : tokens) {
      if (firstToken) {
        buf.append(token.getString(CoreAnnotations.BeforeAnnotation.class));
        firstToken=false;
      }
      boolean endevent=false;
      if (indexToTimexes.containsKey(ii)) {
        Timex timex=indexToTimexes.get(ii);
        buf.append(timex.toXMLString());
        endTimexes.add(ii + timex.getTokenLength() - 1);
      }
      if (indexToEvents.containsKey(ii)) {
        TextEvent event=indexToEvents.get(ii);
        String eventid=event.getId();
        if (numericIDOnly && eventid.startsWith("String_Node_Str"))         eventid=eventid.substring(1);
        buf.append("String_Node_Str" + eventElemName);
        buf.append("String_Node_Str" + idAttributeString + "String_Node_Str"+ eventid+ "String_Node_Str");
        if (showTense)         buf.append("String_Node_Str" + event.getTense() + "String_Node_Str");
        if (showAspect)         buf.append("String_Node_Str" + event.getAspect() + "String_Node_Str");
        if (showClass)         buf.append("String_Node_Str" + event.getTheClass() + "String_Node_Str");
        buf.append("String_Node_Str");
        endevent=true;
      }
      String str=token.getString(CoreAnnotations.OriginalTextAnnotation.class);
      str=str.replaceAll("String_Node_Str","String_Node_Str");
      buf.append(str);
      if (endevent)       buf.append("String_Node_Str" + eventElemName + "String_Node_Str");
      if (endTimexes.contains(ii))       buf.append("String_Node_Str");
      buf.append(token.getString(CoreAnnotations.AfterAnnotation.class));
      ii++;
    }
  }
  return buf.toString();
}