Program: 22079
Project: 22079
Buggy source:
private Text[] formatSnippets(List<Snippet> snippets) throws IOException {
  final SnippetFormatter formatter;
  if (getOption("String_Node_Str",false)) {
    formatter=new OffsetSnippetFormatter();
  }
 else   if (getOption(OPTION_RETURN_DEBUG_GRAPH,false)) {
    formatter=new GraphvizSnippetFormatter(defaultField.buildSourceExtracter());
  }
 else   if (getOption(OPTION_RETURN_SNIPPETS_WITH_OFFSET,false)) {
    formatter=new OffsetAugmenterSnippetFormatter(new SnippetFormatter.Default(defaultField.buildSourceExtracter(),context.field.fieldOptions().preTags()[0],context.field.fieldOptions().postTags()[0]));
  }
 else {
    formatter=new SnippetFormatter.Default(defaultField.buildSourceExtracter(),context.field.fieldOptions().preTags()[0],context.field.fieldOptions().postTags()[0]);
  }
  List<FieldWrapper> fetchFields=buildFetchFields();
  if (fetchFields == null) {
    Text[] result=new Text[snippets.size()];
    int i=0;
    for (    Snippet snippet : snippets) {
      result[i++]=new Text(formatter.format(snippet));
    }
    return result;
  }
  int fieldsPerSnippet=1 + fetchFields.size();
  Text[] result=new Text[snippets.size() * fieldsPerSnippet];
  FetchedFieldIndexPicker picker=segmenter.buildFetchedFieldIndexPicker();
  int i=0;
  for (  Snippet snippet : snippets) {
    result[i++]=new Text(formatter.format(snippet));
    int index=picker.index(snippet);
    for (    FieldWrapper fetchField : fetchFields) {
      List<String> values=fetchField.getFieldValues();
      if (index >= 0 && index < values.size()) {
        result[i++]=new Text(values.get(index));
      }
 else {
        result[i++]=EMPTY_STRING;
      }
    }
  }
  return result;
}

Fixed version (ground truth):
private Text[] formatSnippets(List<Snippet> snippets) throws IOException {
  final SnippetFormatter formatter;
  if (getOption("String_Node_Str",FALSE)) {
    formatter=new OffsetSnippetFormatter();
  }
 else   if (getOption(OPTION_RETURN_DEBUG_GRAPH,FALSE)) {
    formatter=new GraphvizSnippetFormatter(defaultField.buildSourceExtracter());
  }
 else   if (getOption(OPTION_RETURN_SNIPPETS_WITH_OFFSET,FALSE)) {
    formatter=new OffsetAugmenterSnippetFormatter(new SnippetFormatter.Default(defaultField.buildSourceExtracter(),context.field.fieldOptions().preTags()[0],context.field.fieldOptions().postTags()[0]));
  }
 else {
    formatter=new SnippetFormatter.Default(defaultField.buildSourceExtracter(),context.field.fieldOptions().preTags()[0],context.field.fieldOptions().postTags()[0]);
  }
  List<FieldWrapper> fetchFields=buildFetchFields();
  if (fetchFields == null) {
    Text[] result=new Text[snippets.size()];
    int i=0;
    for (    Snippet snippet : snippets) {
      result[i++]=new Text(formatter.format(snippet));
    }
    return result;
  }
  int fieldsPerSnippet=1 + fetchFields.size();
  Text[] result=new Text[snippets.size() * fieldsPerSnippet];
  FetchedFieldIndexPicker picker=segmenter.buildFetchedFieldIndexPicker();
  int i=0;
  for (  Snippet snippet : snippets) {
    result[i++]=new Text(formatter.format(snippet));
    int index=picker.index(snippet);
    for (    FieldWrapper fetchField : fetchFields) {
      List<String> values=fetchField.getFieldValues();
      if (index >= 0 && index < values.size()) {
        result[i++]=new Text(values.get(index));
      }
 else {
        result[i++]=EMPTY_STRING;
      }
    }
  }
  return result;
}