Program: 30641
Project: 30641
Buggy source:
/** 
 * Validate that POSITION >= 1, and that all BARCODEs are the same length and unique
 * @return null if command line is valid.  If command line is invalid, returns an array of error messageto be written to the appropriate place.
 */
@Override protected String[] customCommandLineValidation(){
  if (READ_STRUCTURE == null) {
    factory=new IlluminaDataProviderFactory(BASECALLS_DIR,LANE,BARCODE_CYCLE,BARCODE.get(0).length(),IlluminaDataType.BaseCalls,IlluminaDataType.PF);
    readStructure=factory.readStructure();
  }
 else {
    readStructure=new ReadStructure(READ_STRUCTURE);
    factory=new IlluminaDataProviderFactory(BASECALLS_DIR,LANE,readStructure,IlluminaDataType.BaseCalls,IlluminaDataType.PF);
  }
  final ArrayList<String> messages=new ArrayList<String>();
  if (READ_STRUCTURE == null && BARCODE_CYCLE < 1) {
    messages.add("String_Node_Str" + BARCODE_CYCLE + "String_Node_Str");
  }
  if (BARCODE_FILE != null) {
    parseBarcodeFile(messages);
  }
 else {
    final Set<String> barcodes=new HashSet<String>();
    for (    final String barcode : BARCODE) {
      if (barcodes.contains(barcode)) {
        messages.add("String_Node_Str" + barcode + "String_Node_Str");
      }
      barcodes.add(barcode);
      final BarcodeMetric metric=new BarcodeMetric(null,null,barcode,new String[]{barcode});
      barcodeMetrics.add(metric);
    }
  }
  if (barcodeMetrics.size() == 0) {
    messages.add("String_Node_Str");
  }
  if (messages.size() == 0) {
    return null;
  }
  return messages.toArray(new String[messages.size()]);
}

Fixed version (ground truth):
/** 
 * Validate that POSITION >= 1, and that all BARCODEs are the same length and unique
 * @return null if command line is valid.  If command line is invalid, returns an array of error messageto be written to the appropriate place.
 */
@Override protected String[] customCommandLineValidation(){
  final ArrayList<String> messages=new ArrayList<String>();
  if (READ_STRUCTURE == null) {
    int barcodeLength=0;
    if (BARCODE == null || BARCODE.size() == 0) {
      if (BARCODE_FILE != null)       barcodeLength=getBarcodeLengthFromFile();
    }
 else {
      barcodeLength=BARCODE.get(0).length();
    }
    if (barcodeLength == 0)     messages.add("String_Node_Str");
    log.debug("String_Node_Str" + barcodeLength);
    factory=new IlluminaDataProviderFactory(BASECALLS_DIR,LANE,BARCODE_CYCLE,barcodeLength,IlluminaDataType.BaseCalls,IlluminaDataType.PF);
    readStructure=factory.readStructure();
  }
 else {
    readStructure=new ReadStructure(READ_STRUCTURE);
    factory=new IlluminaDataProviderFactory(BASECALLS_DIR,LANE,readStructure,IlluminaDataType.BaseCalls,IlluminaDataType.PF);
  }
  if (READ_STRUCTURE == null && BARCODE_CYCLE < 1) {
    messages.add("String_Node_Str" + BARCODE_CYCLE + "String_Node_Str");
  }
  if (BARCODE_FILE != null) {
    parseBarcodeFile(messages);
  }
 else {
    final Set<String> barcodes=new HashSet<String>();
    for (    final String barcode : BARCODE) {
      if (barcodes.contains(barcode)) {
        messages.add("String_Node_Str" + barcode + "String_Node_Str");
      }
      barcodes.add(barcode);
      final BarcodeMetric metric=new BarcodeMetric(null,null,barcode,new String[]{barcode});
      barcodeMetrics.add(metric);
    }
  }
  if (barcodeMetrics.size() == 0) {
    messages.add("String_Node_Str");
  }
  if (messages.size() == 0) {
    return null;
  }
  return messages.toArray(new String[messages.size()]);
}