Program: 163411
Project: 163411
Buggy source:
/** 
 * Get all indexes in the given selector and adds the conversions defined at that index to the map of conversionsByIndex. <p>This method is called in the same sequence each selector was created (in   {@link FieldConversionMapping#prepareExecution(String[])}) <p>At the end of the process, the map of conversionsByIndex will have each index with its list of conversions in the order they were declared.
 * @param selector           the selected fields for a given conversion sequence.
 * @param conversionsByIndex map of all conversions registered to every field index, in the order they were declared
 * @param values             The field sequence that identifies how records will be organized.<p> This is generally the sequence of headers in a record, but it might be just the first parsed row from a given input (as field selection by index is allowed).
 */
public void prepareExecution(FieldSelector selector,Map<Integer,List<Conversion<?,?>>> conversionsByIndex,String[] values){
  if (conversionsMap == null) {
    return;
  }
  Conversion<String,?>[] conversions=conversionsMap.get(selector);
  if (conversions == null) {
    return;
  }
  int[] fieldIndexes=selector.getFieldIndexes(values);
  for (  int fieldIndex : fieldIndexes) {
    List<Conversion<?,?>> conversionsAtIndex=conversionsByIndex.get(fieldIndex);
    if (conversionsAtIndex == null) {
      conversionsAtIndex=new ArrayList<Conversion<?,?>>();
      conversionsByIndex.put(fieldIndex,conversionsAtIndex);
    }
    validateDuplicates(selector,conversionsAtIndex,conversions);
    conversionsAtIndex.addAll(Arrays.asList(conversions));
  }
}

Fixed version (ground truth):
/** 
 * Get all indexes in the given selector and adds the conversions defined at that index to the map of conversionsByIndex. <p>This method is called in the same sequence each selector was created (in   {@link FieldConversionMapping#prepareExecution(boolean,String[])}) <p>At the end of the process, the map of conversionsByIndex will have each index with its list of conversions in the order they were declared.
 * @param writing			 flag indicating whether a writing process is being initialized.
 * @param selector           the selected fields for a given conversion sequence.
 * @param conversionsByIndex map of all conversions registered to every field index, in the order they were declared
 * @param values             The field sequence that identifies how records will be organized.<p> This is generally the sequence of headers in a record, but it might be just the first parsed row from a given input (as field selection by index is allowed).
 */
public void prepareExecution(boolean writing,FieldSelector selector,Map<Integer,List<Conversion<?,?>>> conversionsByIndex,String[] values){
  if (conversionsMap == null) {
    return;
  }
  Conversion<String,?>[] conversions=conversionsMap.get(selector);
  if (conversions == null) {
    return;
  }
  if (!writing && conversionsMap.size() > values.length) {
    boolean isSelectionOfNames=true;
    for (    FieldSelector expectedSelection : conversionsMap.keySet()) {
      if (!(expectedSelection instanceof FieldNameSelector || expectedSelection instanceof FieldEnumSelector)) {
        isSelectionOfNames=false;
        break;
      }
    }
    if (isSelectionOfNames) {
      int i=values.length;
      values=Arrays.copyOf(values,conversionsMap.size() + 1);
      for (      FieldSelector expectedSelection : conversionsMap.keySet()) {
        List<?> selection=((FieldSet<?>)expectedSelection).get();
        if (selection.size() == 1) {
          String selected=ArgumentUtils.normalize(selection.get(0).toString());
          if (ArgumentUtils.indexOf(values,selected) == -1) {
            values[i++]=selected;
          }
        }
      }
    }
  }
  int[] fieldIndexes=selector.getFieldIndexes(values);
  for (  int fieldIndex : fieldIndexes) {
    List<Conversion<?,?>> conversionsAtIndex=conversionsByIndex.get(fieldIndex);
    if (conversionsAtIndex == null) {
      conversionsAtIndex=new ArrayList<Conversion<?,?>>();
      conversionsByIndex.put(fieldIndex,conversionsAtIndex);
    }
    validateDuplicates(selector,conversionsAtIndex,conversions);
    conversionsAtIndex.addAll(Arrays.asList(conversions));
  }
}