Program: 28867
Project: 28867
Buggy source:
private String constructJsonForDefaultMapping(Object eventObj){
  StringBuilder sb=new StringBuilder();
  int numberOfOuterObjects=0;
  if (enclosingElement != null) {
    String[] nodeNames=enclosingElement.split("String_Node_Str");
    if (DEFAULT_ENCLOSING_ELEMENT.equals(nodeNames[0])) {
      numberOfOuterObjects=nodeNames.length - 1;
    }
 else {
      numberOfOuterObjects=nodeNames.length;
    }
    for (    String nodeName : nodeNames) {
      if (!DEFAULT_ENCLOSING_ELEMENT.equals(nodeName)) {
        sb.append(JSON_EVENT_START_SYMBOL).append("String_Node_Str").append(nodeName).append("String_Node_Str").append(JSON_KEYVALUE_SEPERATOR);
      }
    }
    if (eventObj.getClass() == Event.class) {
      Event event=(Event)eventObj;
      JsonObject jsonEvent=constructSingleEventForDefaultMapping(doPartialProcessing(event));
      sb.append(jsonEvent);
    }
 else     if (eventObj.getClass() == Event[].class) {
      JsonArray eventArray=new JsonArray();
      for (      Event event : (Event[])eventObj) {
        eventArray.add(constructSingleEventForDefaultMapping(doPartialProcessing(event)));
      }
      sb.append(eventArray.toString());
    }
 else {
      log.error("String_Node_Str" + eventObj.toString() + "String_Node_Str");
      return null;
    }
    for (int i=0; i < numberOfOuterObjects; i++) {
      sb.append(JSON_EVENT_END_SYMBOL);
    }
    return sb.toString();
  }
 else {
    if (eventObj.getClass() == Event.class) {
      Event event=(Event)eventObj;
      JsonObject jsonEvent=constructSingleEventForDefaultMapping(doPartialProcessing(event));
      return jsonEvent.toString();
    }
 else     if (eventObj.getClass() == Event[].class) {
      JsonArray eventArray=new JsonArray();
      for (      Event event : (Event[])eventObj) {
        eventArray.add(constructSingleEventForDefaultMapping(doPartialProcessing(event)));
      }
      return (eventArray.toString());
    }
 else {
      log.error("String_Node_Str" + eventObj.toString() + "String_Node_Str");
      return null;
    }
  }
}

Fixed version (ground truth):
private String constructJsonForDefaultMapping(Object eventObj){
  StringBuilder sb=new StringBuilder();
  int numberOfOuterObjects;
  if (enclosingElement != null) {
    String[] nodeNames=enclosingElement.split("String_Node_Str");
    if (DEFAULT_ENCLOSING_ELEMENT.equals(nodeNames[0])) {
      numberOfOuterObjects=nodeNames.length - 1;
    }
 else {
      numberOfOuterObjects=nodeNames.length;
    }
    for (    String nodeName : nodeNames) {
      if (!DEFAULT_ENCLOSING_ELEMENT.equals(nodeName)) {
        sb.append(JSON_EVENT_START_SYMBOL).append("String_Node_Str").append(nodeName).append("String_Node_Str").append(JSON_KEYVALUE_SEPERATOR);
      }
    }
    if (eventObj instanceof Event) {
      Event event=(Event)eventObj;
      JsonObject jsonEvent=constructSingleEventForDefaultMapping(doPartialProcessing(event));
      sb.append(jsonEvent);
    }
 else     if (eventObj instanceof Event[]) {
      JsonArray eventArray=new JsonArray();
      for (      Event event : (Event[])eventObj) {
        eventArray.add(constructSingleEventForDefaultMapping(doPartialProcessing(event)));
      }
      sb.append(eventArray.toString());
    }
 else {
      log.error("String_Node_Str" + eventObj.toString() + "String_Node_Str");
      return null;
    }
    for (int i=0; i < numberOfOuterObjects; i++) {
      sb.append(JSON_EVENT_END_SYMBOL);
    }
    return sb.toString();
  }
 else {
    if (eventObj instanceof Event) {
      Event event=(Event)eventObj;
      JsonObject jsonEvent=constructSingleEventForDefaultMapping(doPartialProcessing(event));
      return jsonEvent.toString();
    }
 else     if (eventObj instanceof Event[]) {
      JsonArray eventArray=new JsonArray();
      for (      Event event : (Event[])eventObj) {
        eventArray.add(constructSingleEventForDefaultMapping(doPartialProcessing(event)));
      }
      return (eventArray.toString());
    }
 else {
      log.error("String_Node_Str" + eventObj.toString() + "String_Node_Str");
      return null;
    }
  }
}