Program: 163369
Project: 163369
Buggy source:
/** 
 * Identifies which fields are associated with which columns in a row.
 * @param row              A row with values for the given java bean.
 * @param headers          The names of all fields of the record (including any header that is not mapped to the java bean). May be null if no headers have been defined in {@link CommonSettings#getHeaders()}
 * @param indexes          The indexes of the headers or row that are actually being used. May be null if no fields have been selected using {@link CommonSettings#selectFields(String)} or {@link CommonSettings#selectIndexes(Integer)}
 * @param columnsReordered Indicates the indexes provided were reordered and do not match the original sequence of headers.
 */
private void mapFieldIndexes(ParsingContext context,Object[] row,String[] headers,int[] indexes,boolean columnsReordered){
  if (headers == null) {
    headers=ArgumentUtils.EMPTY_STRING_ARRAY;
  }
  int biggestIndex=headers.length > row.length ? headers.length : row.length;
  for (  FieldMapping mapping : parsedFields) {
    int index=mapping.getIndex();
    if (biggestIndex < index) {
      biggestIndex=index;
    }
  }
  FieldMapping[] fieldOrder=new FieldMapping[biggestIndex + 1];
  TreeSet<String> fieldsNotFound=new TreeSet<String>();
  for (  FieldMapping mapping : parsedFields) {
    if (mapping.isMappedToField()) {
      int index=ArgumentUtils.indexOf(headers,mapping.getFieldName());
      if (index == -1) {
        fieldsNotFound.add(mapping.getFieldName());
        continue;
      }
      fieldOrder[index]=mapping;
    }
 else     if (mapping.getIndex() < fieldOrder.length) {
      fieldOrder[mapping.getIndex()]=mapping;
    }
  }
  if (context != null && !fieldsNotFound.isEmpty()) {
    if (headers.length == 0) {
      throw new DataProcessingException("String_Node_Str" + fieldsNotFound.toString() + "String_Node_Str");
    }
    if (strictHeaderValidationEnabled) {
      throw new DataProcessingException("String_Node_Str" + fieldsNotFound.toString() + "String_Node_Str"+ Arrays.toString(headers));
    }
  }
  if (indexes != null) {
    for (int i=0; i < fieldOrder.length; i++) {
      boolean isIndexUsed=false;
      for (int j=0; j < indexes.length; j++) {
        if (indexes[j] == i) {
          isIndexUsed=true;
          break;
        }
      }
      if (!isIndexUsed) {
        fieldOrder[i]=null;
      }
    }
    if (columnsReordered) {
      FieldMapping[] newFieldOrder=new FieldMapping[indexes.length];
      for (int i=0; i < indexes.length; i++) {
        for (int j=0; j < fieldOrder.length; j++) {
          int index=indexes[i];
          FieldMapping field=fieldOrder[index];
          newFieldOrder[i]=field;
        }
      }
      fieldOrder=newFieldOrder;
    }
  }
  this.readOrder=fieldOrder;
}

Fixed version (ground truth):
/** 
 * Identifies which fields are associated with which columns in a row.
 * @param row              A row with values for the given java bean.
 * @param headers          The names of all fields of the record (including any header that is not mapped to the java bean). May be null if no headers have been defined in {@link CommonSettings#getHeaders()}
 * @param indexes          The indexes of the headers or row that are actually being used. May be null if no fields have been selected using {@link CommonSettings#selectFields(String)} or {@link CommonSettings#selectIndexes(Integer)}
 * @param columnsReordered Indicates the indexes provided were reordered and do not match the original sequence of headers.
 */
private void mapFieldIndexes(ParsingContext context,Object[] row,String[] headers,int[] indexes,boolean columnsReordered){
  if (headers == null) {
    headers=ArgumentUtils.EMPTY_STRING_ARRAY;
  }
  int biggestIndex=headers.length > row.length ? headers.length : row.length;
  for (  FieldMapping mapping : parsedFields) {
    int index=mapping.getIndex();
    if (biggestIndex < index) {
      biggestIndex=index;
    }
  }
  FieldMapping[] fieldOrder=new FieldMapping[biggestIndex + 1];
  TreeSet<String> fieldsNotFound=new TreeSet<String>();
  for (  FieldMapping mapping : parsedFields) {
    if (mapping.isMappedToField()) {
      int index=ArgumentUtils.indexOf(headers,mapping.getFieldName());
      if (index == -1) {
        fieldsNotFound.add(mapping.getFieldName());
        continue;
      }
      fieldOrder[index]=mapping;
    }
 else     if (mapping.getIndex() < fieldOrder.length) {
      fieldOrder[mapping.getIndex()]=mapping;
    }
  }
  if (context != null && !fieldsNotFound.isEmpty()) {
    if (headers.length == 0) {
      throw new DataProcessingException("String_Node_Str" + fieldsNotFound.toString() + "String_Node_Str");
    }
    if (strictHeaderValidationEnabled) {
      throw new DataProcessingException("String_Node_Str" + fieldsNotFound.toString() + "String_Node_Str"+ Arrays.toString(headers));
    }
  }
  if (indexes != null) {
    for (int i=0; i < fieldOrder.length; i++) {
      boolean isIndexUsed=false;
      for (int j=0; j < indexes.length; j++) {
        if (indexes[j] == i) {
          isIndexUsed=true;
          break;
        }
      }
      if (!isIndexUsed) {
        fieldOrder[i]=null;
      }
    }
    if (columnsReordered) {
      FieldMapping[] newFieldOrder=new FieldMapping[indexes.length];
      for (int i=0; i < indexes.length; i++) {
        for (int j=0; j < fieldOrder.length; j++) {
          int index=indexes[i];
          if (index != -1) {
            FieldMapping field=fieldOrder[index];
            newFieldOrder[i]=field;
          }
        }
      }
      fieldOrder=newFieldOrder;
    }
  }
  this.readOrder=fieldOrder;
}