Program: 188955
Project: 188955
Buggy source:
/** 
 * Generates a sample info object given the fields, and prompts for null fields if the interactive flag is on. The individualNumber and projectCode are required. Everything else can be null or less than 0.
 * @param prettyName
 * @param projectCode
 * @param individualNumber
 * @param librarySourceTemplateType
 * @param tissueOrigin
 * @param tissueType
 * @param libraryType
 * @param librarySizeCode
 * @param barcode
 * @param organismId
 * @param targetedResequencing
 * @param tissuePreparation
 * @return
 * @throws Exception
 */
protected SampleInfo generateSampleInfo(String prettyName,String projectCode,String individualNumber,String librarySourceTemplateType,String tissueOrigin,String tissueType,String libraryType,String librarySizeCode,String barcode,int organismId,String targetedResequencing,String tissuePreparation,String sampleDescription,String iusName,String iusDescription) throws Exception {
  if (individualNumber == null || individualNumber.isEmpty() || projectCode == null || projectCode.isEmpty()) {
    throw new Exception("String_Node_Str" + projectCode + "String_Node_Str"+ individualNumber);
  }
  SampleInfo sa=new SampleInfo();
  sa.setIndividualNumber(individualNumber);
  sa.setProjectCode(projectCode);
  if (libraryType == null || libraryType.isEmpty()) {
    libraryType=prompt(prettyName,"String_Node_Str",libraryTypeList,this.lity,Field.library_type);
    this.lity=libraryType;
  }
  sa.setLibraryType(libraryType);
  if (librarySourceTemplateType == null || librarySourceTemplateType.isEmpty()) {
    librarySourceTemplateType=prompt(prettyName,"String_Node_Str",librarySourceTemplateTypeList,this.lstety,Field.library_source_template_type);
    this.lstety=librarySourceTemplateType;
  }
  sa.setLibrarySourceTemplateType(librarySourceTemplateType);
  if (targetedResequencing == null || targetedResequencing.isEmpty()) {
    targetedResequencing=prompt(prettyName,"String_Node_Str",targetedResequencingList,this.tare,Field.targeted_resequencing);
    this.tare=targetedResequencing;
  }
  sa.setTargetedResequencing(targetedResequencing);
  if (tissueOrigin == null || tissueOrigin.isEmpty()) {
    tissueOrigin=prompt(prettyName,"String_Node_Str",tissueOriginList,this.tior,Field.tissue_origin);
    if (tissueOrigin.isEmpty()) {
      tissueOrigin="String_Node_Str";
    }
 else {
      this.tior=tissueOrigin;
    }
  }
  sa.setTissueOrigin(tissueOrigin);
  if (tissuePreparation == null || tissuePreparation.isEmpty()) {
    tissuePreparation=prompt(prettyName,"String_Node_Str",tissuePreparationList,this.tipr,Field.tissue_preparation);
    this.tipr=tissuePreparation;
  }
  sa.setTissuePreparation(tissuePreparation);
  if (tissueType == null || tissueType.isEmpty()) {
    tissueType=prompt(prettyName,"String_Node_Str",tissueTypeList,this.tity,Field.tissue_type);
    if (tissueType.isEmpty()) {
      tissueType="String_Node_Str";
    }
 else {
      this.tity=tissueType;
    }
  }
  sa.setTissueType(tissueType);
  if (librarySizeCode == null || librarySizeCode.isEmpty() || !StringUtils.isNumeric(librarySizeCode)) {
    Integer lSize=prompt("String_Node_Str",this.lSize,Field.library_size_code);
    if (lSize <= 0) {
      librarySizeCode="String_Node_Str";
    }
 else {
      this.lSize=lSize;
      librarySizeCode=lSize.toString();
    }
  }
  sa.setLibrarySizeCode(librarySizeCode);
  if (barcode == null || barcode.isEmpty()) {
    barcode=prompt("String_Node_Str","String_Node_Str",Field.barcode);
  }
  sa.setBarcode(barcode);
  if (iusName == null) {
    if (interactive) {
      iusName=prompt("String_Node_Str",barcode,null);
    }
 else {
      iusName=barcode;
    }
  }
  sa.setIusName(iusName);
  if (iusDescription == null) {
    if (interactive) {
      iusDescription=prompt("String_Node_Str",barcode,null);
    }
 else {
      iusDescription=barcode;
    }
  }
  sa.setIusDescription(iusDescription);
  StringBuilder name=new StringBuilder();
  name.append(projectCode).append("String_Node_Str").append(individualNumber);
  name.append("String_Node_Str").append(tissueOrigin).append("String_Node_Str").append(tissueType).append("String_Node_Str").append(libraryType).append("String_Node_Str");
  name.append(librarySizeCode).append("String_Node_Str").append(librarySourceTemplateType);
  sa.setName(name.toString());
  if (sampleDescription == null) {
    if (interactive) {
      sampleDescription=prompt("String_Node_Str",name.toString(),null);
    }
 else {
      sampleDescription=name.toString();
    }
  }
  sa.setSampleDescription(sampleDescription);
  if (organismId <= 0) {
    List<Organism> organisms=new ArrayList<Organism>(metadata.getOrganisms());
    for (int i=0; i < organisms.size(); i++) {
      Log.stdout(i + "String_Node_Str" + organisms.get(i).toString());
    }
    organismId=prompt("String_Node_Str",31,Field.organism_id);
  }
  sa.setOrganismId(organismId);
  return sa;
}

Fixed version (ground truth):
/** 
 * Generates a sample info object given the fields, and prompts for null fields if the interactive flag is on. The individualNumber and projectCode are required. Everything else can be null or less than 0.
 * @param prettyName
 * @param projectCode
 * @param individualNumber
 * @param librarySourceTemplateType
 * @param tissueOrigin
 * @param tissueType
 * @param libraryType
 * @param librarySizeCode
 * @param barcode
 * @param organismId
 * @param targetedResequencing
 * @param tissuePreparation
 * @return
 * @throws Exception
 */
protected SampleInfo generateSampleInfo(String prettyName,String projectCode,String individualNumber,String librarySourceTemplateType,String tissueOrigin,String tissueType,String libraryType,String librarySizeCode,String barcode,int organismId,String targetedResequencing,String tissuePreparation,String sampleDescription,String iusName,String iusDescription) throws Exception {
  if (individualNumber == null || individualNumber.isEmpty() || projectCode == null || projectCode.isEmpty()) {
    throw new Exception("String_Node_Str" + projectCode + "String_Node_Str"+ individualNumber);
  }
  SampleInfo sa=new SampleInfo();
  sa.setIndividualNumber(individualNumber);
  sa.setProjectCode(projectCode);
  if (libraryType == null || libraryType.isEmpty()) {
    libraryType=prompt(prettyName,"String_Node_Str",libraryTypeList,this.lity,Field.library_type);
    this.lity=libraryType;
  }
  sa.setLibraryType(libraryType);
  if (librarySourceTemplateType == null || librarySourceTemplateType.isEmpty()) {
    librarySourceTemplateType=prompt(prettyName,"String_Node_Str",librarySourceTemplateTypeList,this.lstety,Field.library_source_template_type);
    this.lstety=librarySourceTemplateType;
  }
  sa.setLibrarySourceTemplateType(librarySourceTemplateType);
  if (targetedResequencing == null || targetedResequencing.isEmpty()) {
    targetedResequencing=prompt(prettyName,"String_Node_Str",targetedResequencingList,this.tare,Field.targeted_resequencing);
    this.tare=targetedResequencing;
  }
  sa.setTargetedResequencing(targetedResequencing);
  if (tissueOrigin == null || tissueOrigin.isEmpty()) {
    tissueOrigin=prompt(prettyName,"String_Node_Str",tissueOriginList,this.tior,Field.tissue_origin);
    if (tissueOrigin == null || tissueOrigin.trim().isEmpty()) {
      tissueOrigin="String_Node_Str";
    }
 else {
      this.tior=tissueOrigin;
    }
  }
  sa.setTissueOrigin(tissueOrigin);
  if (tissuePreparation == null || tissuePreparation.isEmpty()) {
    tissuePreparation=prompt(prettyName,"String_Node_Str",tissuePreparationList,this.tipr,Field.tissue_preparation);
    this.tipr=tissuePreparation;
  }
  sa.setTissuePreparation(tissuePreparation);
  if (tissueType == null || tissueType.isEmpty()) {
    tissueType=prompt(prettyName,"String_Node_Str",tissueTypeList,this.tity,Field.tissue_type);
    if (tissueType == null || tissueType.trim().isEmpty()) {
      tissueType="String_Node_Str";
    }
 else {
      this.tity=tissueType;
    }
  }
  sa.setTissueType(tissueType);
  if (librarySizeCode == null || librarySizeCode.isEmpty() || !StringUtils.isNumeric(librarySizeCode)) {
    Integer lSize=prompt("String_Node_Str",this.lSize,Field.library_size_code);
    if (lSize <= 0) {
      librarySizeCode="String_Node_Str";
    }
 else {
      this.lSize=lSize;
      librarySizeCode=lSize.toString();
    }
  }
  sa.setLibrarySizeCode(librarySizeCode);
  if (barcode == null || barcode.isEmpty()) {
    barcode=prompt("String_Node_Str","String_Node_Str",Field.barcode);
  }
  sa.setBarcode(barcode);
  if (iusName == null) {
    if (interactive) {
      iusName=prompt("String_Node_Str",barcode,null);
    }
 else {
      iusName=barcode;
    }
  }
  sa.setIusName(iusName);
  if (iusDescription == null) {
    if (interactive) {
      iusDescription=prompt("String_Node_Str",barcode,null);
    }
 else {
      iusDescription=barcode;
    }
  }
  sa.setIusDescription(iusDescription);
  StringBuilder name=new StringBuilder();
  name.append(projectCode).append("String_Node_Str").append(individualNumber);
  name.append("String_Node_Str").append(tissueOrigin).append("String_Node_Str").append(tissueType).append("String_Node_Str").append(libraryType).append("String_Node_Str");
  name.append(librarySizeCode).append("String_Node_Str").append(librarySourceTemplateType);
  sa.setName(name.toString());
  if (sampleDescription == null) {
    if (interactive) {
      sampleDescription=prompt("String_Node_Str",name.toString(),null);
    }
 else {
      sampleDescription=name.toString();
    }
  }
  sa.setSampleDescription(sampleDescription);
  if (organismId <= 0) {
    List<Organism> organisms=new ArrayList<Organism>(metadata.getOrganisms());
    for (int i=0; i < organisms.size(); i++) {
      Log.stdout((i + 1) + "String_Node_Str" + organisms.get(i).getName());
    }
    organismId=prompt("String_Node_Str",31,Field.organism_id);
    if (organismId > 0 && organismId <= organisms.size()) {
      organismId=organisms.get(organismId).getOrganismId();
    }
  }
  sa.setOrganismId(organismId);
  return sa;
}