Program: 141099
Project: 141099
Buggy source:
/** 
 * Generate the R script.
 * @param samples list of sample experiments
 * @return String rScript R script to execute
 * @throws EoulsanException if an error occurs while generate the R script
 */
protected String generateScript(final Experiment experiment,final StepContext context) throws EoulsanException {
  final Map<String,List<Integer>> conditionsMap=new HashMap<>();
  final List<Integer> rSampleIds=new ArrayList<>();
  final List<String> rSampleNames=new ArrayList<>();
  final List<String> rCondNames=new ArrayList<>();
  List<String> rRepTechGroup=new ArrayList<>();
  int i=0;
  for (  Sample s : experiment.getSamples()) {
    if (!s.getMetadata().containsCondition()) {
      throw new EoulsanException("String_Node_Str");
    }
    final String condition=s.getMetadata().getCondition().trim();
    if ("String_Node_Str".equals(condition)) {
      throw new EoulsanException("String_Node_Str" + s.getName() + "String_Node_Str"+ s.getId()+ "String_Node_Str");
    }
    final String repTechGroup=s.getMetadata().getRepTechGroup().trim();
    if (!"String_Node_Str".equals(repTechGroup)) {
      rRepTechGroup.add(repTechGroup);
    }
    final List<Integer> index;
    if (!conditionsMap.containsKey(condition)) {
      index=new ArrayList<>();
      conditionsMap.put(condition,index);
    }
 else {
      index=conditionsMap.get(condition);
    }
    index.add(i);
    rSampleIds.add(s.getNumber());
    rSampleNames.add(s.getName());
    rCondNames.add(condition);
    i++;
  }
  checkRepTechGroupCoherence(rRepTechGroup,rCondNames);
  String pdfTitle=escapeUnderScore(experiment.getName()) + "String_Node_Str";
  String filePrefix="String_Node_Str" + escapeUnderScore(experiment.getName());
  final StringBuilder sb=generateRnwpreamble(experiment.getSamples(),pdfTitle,filePrefix);
  replaceRtgNA(rRepTechGroup,rSampleNames);
  generateSampleNamePart(rSampleNames,sb);
  generateSampleIdsPart(rSampleIds,sb);
  generateExpressionFileNamesPart(sb);
  generateRepTechGroupPart(rRepTechGroup,sb);
  generateConditionPart(rCondNames,sb);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str" + experiment.getName() + "String_Node_Str"+ "String_Node_Str");
  sb.append("String_Node_Str");
  sb.append(readStaticScript(TARGET_CREATION));
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  if (experiment.getSamples().size() > 2) {
    sb.append(readStaticScript(CLUSTERING_PCA_RAW));
  }
  if (isTechnicalReplicates(rRepTechGroup)) {
    sb.append(readStaticScript(NORMALISATION_PART1_WHITH_TECHREP));
  }
 else {
    sb.append(readStaticScript(NORMALIZATION_PART1_WHITHOUT_TECHREP));
  }
  if (isEnoughRepTechGroup(rRepTechGroup)) {
    sb.append(readStaticScript(CLUSTERING_PCA_NORM));
  }
  sb.append(readStaticScript(NORMALIZATION_PART2));
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * Generate the R script.
 * @param experiment the experiment
 * @param context step context
 * @return String rScript R script to execute
 * @throws EoulsanException if an error occurs while generate the R script
 */
protected String generateScript(final Experiment experiment,final StepContext context) throws EoulsanException {
  final Map<String,List<Integer>> conditionsMap=new HashMap<>();
  final List<Integer> rSampleIds=new ArrayList<>();
  final List<String> rSampleNames=new ArrayList<>();
  final List<String> rCondNames=new ArrayList<>();
  List<String> rRepTechGroup=new ArrayList<>();
  int i=0;
  for (  Sample s : experiment.getSamples()) {
    if (!s.getMetadata().containsCondition()) {
      throw new EoulsanException("String_Node_Str");
    }
    final String condition=s.getMetadata().getCondition().trim();
    if ("String_Node_Str".equals(condition)) {
      throw new EoulsanException("String_Node_Str" + s.getName() + "String_Node_Str"+ s.getId()+ "String_Node_Str");
    }
    final String repTechGroup=s.getMetadata().getRepTechGroup().trim();
    if (!"String_Node_Str".equals(repTechGroup)) {
      rRepTechGroup.add(repTechGroup);
    }
    final List<Integer> index;
    if (!conditionsMap.containsKey(condition)) {
      index=new ArrayList<>();
      conditionsMap.put(condition,index);
    }
 else {
      index=conditionsMap.get(condition);
    }
    index.add(i);
    rSampleIds.add(s.getNumber());
    rSampleNames.add(s.getName());
    rCondNames.add(condition);
    i++;
  }
  checkRepTechGroupCoherence(rRepTechGroup,rCondNames);
  String pdfTitle=escapeUnderScore(experiment.getName()) + "String_Node_Str";
  String filePrefix="String_Node_Str" + escapeUnderScore(experiment.getName());
  final StringBuilder sb=generateRnwpreamble(experiment.getSamples(),pdfTitle,filePrefix);
  replaceRtgNA(rRepTechGroup,rSampleNames);
  generateSampleNamePart(rSampleNames,sb);
  generateSampleIdsPart(rSampleIds,sb);
  generateExpressionFileNamesPart(sb);
  generateRepTechGroupPart(rRepTechGroup,sb);
  generateConditionPart(rCondNames,sb);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str" + experiment.getName() + "String_Node_Str"+ "String_Node_Str");
  sb.append("String_Node_Str");
  sb.append(readStaticScript(TARGET_CREATION));
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  if (experiment.getSamples().size() > 2) {
    sb.append(readStaticScript(CLUSTERING_PCA_RAW));
  }
  if (isTechnicalReplicates(rRepTechGroup)) {
    sb.append(readStaticScript(NORMALISATION_PART1_WHITH_TECHREP));
  }
 else {
    sb.append(readStaticScript(NORMALIZATION_PART1_WHITHOUT_TECHREP));
  }
  if (isEnoughRepTechGroup(rRepTechGroup)) {
    sb.append(readStaticScript(CLUSTERING_PCA_NORM));
  }
  sb.append(readStaticScript(NORMALIZATION_PART2));
  sb.append("String_Node_Str");
  return sb.toString();
}