Program: 141078
Project: 141078
Buggy source:
@Override public void write(final Design design) throws IOException {
  if (design == null) {
    throw new NullPointerException("String_Node_Str");
  }
  this.bw=new BufferedWriter(new OutputStreamWriter(this.out,Globals.DEFAULT_CHARSET));
  this.bw.append(SAMPLE_NUMBER_FIELD);
  this.bw.append(SEPARATOR);
  this.bw.append(SAMPLE_NAME_FIELD);
  final List<String> sampleMDKeys=DesignUtils.getAllSamplesMetadataKeys(design);
  for (  String key : sampleMDKeys) {
    if (SampleMetadata.UUID_KEY.equals(key)) {
      continue;
    }
    this.bw.append(SEPARATOR);
    this.bw.append(key);
  }
  if (design.getMetadata().containsGenomeFile()) {
    this.bw.append(SEPARATOR);
    this.bw.append("String_Node_Str");
  }
  if (design.getMetadata().containsGffFile()) {
    this.bw.append(SEPARATOR);
    this.bw.append("String_Node_Str");
  }
  if (design.getMetadata().containsGtfFile()) {
    this.bw.append(SEPARATOR);
    this.bw.append(DesignMetadata.GFF_FILE_KEY);
  }
  if (design.getMetadata().containsAdditionnalAnnotationFile()) {
    this.bw.append(SEPARATOR);
    this.bw.append("String_Node_Str");
  }
  final Experiment exp=design.getExperiments().isEmpty() ? null : design.getExperiments().get(0);
  final List<String> esmdk=exp == null ? null : DesignUtils.getExperimentSampleAllMetadataKeys(exp);
  if (exp != null) {
    this.bw.append(SEPARATOR);
    this.bw.append(EXPERIMENT_FIELD);
    if (esmdk.contains(ExperimentSampleMetadata.CONDITION_KEY)) {
      this.bw.append(SEPARATOR);
      this.bw.append("String_Node_Str");
    }
    if (esmdk.contains(ExperimentSampleMetadata.REP_TECH_GROUP_KEY)) {
      this.bw.append(SEPARATOR);
      this.bw.append("String_Node_Str");
    }
    if (esmdk.contains(ExperimentSampleMetadata.REFERENCE_KEY)) {
      this.bw.append(SEPARATOR);
      this.bw.append("String_Node_Str");
    }
  }
  if (sampleMDKeys.contains(UUID_KEY)) {
    bw.append(TAB_SEPARATOR);
    bw.append(UUID_KEY);
  }
  this.bw.append(NEWLINE);
  for (  Sample sample : design.getSamples()) {
    this.bw.append("String_Node_Str" + sample.getNumber());
    this.bw.append(SEPARATOR);
    this.bw.append(sample.getId());
    final SampleMetadata smd=sample.getMetadata();
    for (    String key : sampleMDKeys) {
      if (UUID_KEY.equals(key)) {
        continue;
      }
      this.bw.append(SEPARATOR);
      if (smd.contains(key)) {
        this.bw.append(smd.get(key));
      }
    }
    if (design.getMetadata().containsGenomeFile()) {
      this.bw.append(SEPARATOR);
      this.bw.append(design.getMetadata().getGenomeFile());
    }
    if (design.getMetadata().containsGffFile()) {
      this.bw.append(SEPARATOR);
      this.bw.append(design.getMetadata().getGffFile());
    }
    if (design.getMetadata().containsGtfFile()) {
      this.bw.append(SEPARATOR);
      this.bw.append(design.getMetadata().getGtfFile());
    }
    if (design.getMetadata().containsAdditionnalAnnotationFile()) {
      this.bw.append(SEPARATOR);
      this.bw.append(design.getMetadata().getAdditionnalAnnotationFile());
    }
    if (exp != null) {
      this.bw.append(SEPARATOR);
      this.bw.append(exp.getId());
      ExperimentSample es=exp.getExperimentSample(sample);
      if (esmdk.contains(ExperimentSampleMetadata.CONDITION_KEY)) {
        this.bw.append(SEPARATOR);
        if (es.getMetadata().containsCondition()) {
          this.bw.append(es.getMetadata().getCondition());
        }
      }
      if (esmdk.contains(ExperimentSampleMetadata.REP_TECH_GROUP_KEY)) {
        this.bw.append(SEPARATOR);
        if (es.getMetadata().containsRepTechGroup()) {
          this.bw.append(es.getMetadata().getRepTechGroup());
        }
      }
      if (esmdk.contains(ExperimentSampleMetadata.REFERENCE_KEY)) {
        this.bw.append(SEPARATOR);
        if (es.getMetadata().containsReference()) {
          this.bw.append("String_Node_Str" + es.getMetadata().getReference());
        }
      }
    }
    if (sampleMDKeys.contains(UUID_KEY)) {
      bw.append(TAB_SEPARATOR);
      bw.append(smd.get(UUID_KEY));
    }
    this.bw.append(NEWLINE);
  }
  this.bw.close();
}

Fixed version (ground truth):
@Override public void write(final Design design) throws IOException {
  if (design == null) {
    throw new NullPointerException("String_Node_Str");
  }
  this.bw=new BufferedWriter(new OutputStreamWriter(this.out,Globals.DEFAULT_CHARSET));
  this.bw.append(SAMPLE_NUMBER_FIELD);
  this.bw.append(SEPARATOR);
  this.bw.append(SAMPLE_NAME_FIELD);
  final List<String> sampleMDKeys=DesignUtils.getAllSamplesMetadataKeys(design);
  for (  String key : sampleMDKeys) {
    if (SampleMetadata.UUID_KEY.equals(key)) {
      continue;
    }
    this.bw.append(SEPARATOR);
    this.bw.append(key);
  }
  if (design.getMetadata().containsGenomeFile()) {
    this.bw.append(SEPARATOR);
    this.bw.append("String_Node_Str");
  }
  if (design.getMetadata().containsGffFile()) {
    this.bw.append(SEPARATOR);
    this.bw.append("String_Node_Str");
  }
  if (design.getMetadata().containsGtfFile()) {
    this.bw.append(SEPARATOR);
    this.bw.append(DesignMetadata.GFF_FILE_KEY);
  }
  if (design.getMetadata().containsAdditionnalAnnotationFile()) {
    this.bw.append(SEPARATOR);
    this.bw.append("String_Node_Str");
  }
  final Experiment exp=design.getExperiments().isEmpty() ? null : design.getExperiments().get(0);
  final List<String> esmdk=exp == null ? null : DesignUtils.getExperimentSampleAllMetadataKeys(exp);
  if (exp != null) {
    this.bw.append(SEPARATOR);
    this.bw.append(EXPERIMENT_FIELD);
    if (esmdk.contains(ExperimentSampleMetadata.CONDITION_KEY)) {
      this.bw.append(SEPARATOR);
      this.bw.append("String_Node_Str");
    }
    if (esmdk.contains(ExperimentSampleMetadata.REP_TECH_GROUP_KEY)) {
      this.bw.append(SEPARATOR);
      this.bw.append("String_Node_Str");
    }
    if (esmdk.contains(ExperimentSampleMetadata.REFERENCE_KEY)) {
      this.bw.append(SEPARATOR);
      this.bw.append("String_Node_Str");
    }
  }
  if (sampleMDKeys.contains(UUID_KEY)) {
    bw.append(TAB_SEPARATOR);
    bw.append(UUID_KEY);
  }
  this.bw.append(NEWLINE);
  for (  Sample sample : design.getSamples()) {
    this.bw.append("String_Node_Str" + sample.getNumber());
    this.bw.append(SEPARATOR);
    this.bw.append(sample.getId());
    final SampleMetadata smd=sample.getMetadata();
    for (    String key : sampleMDKeys) {
      if (UUID_KEY.equals(key)) {
        continue;
      }
      this.bw.append(SEPARATOR);
      if (smd.contains(key)) {
        this.bw.append(smd.get(key));
      }
    }
    if (design.getMetadata().containsGenomeFile()) {
      this.bw.append(SEPARATOR);
      this.bw.append(design.getMetadata().getGenomeFile());
    }
    if (design.getMetadata().containsGffFile()) {
      this.bw.append(SEPARATOR);
      this.bw.append(design.getMetadata().getGffFile());
    }
    if (design.getMetadata().containsGtfFile()) {
      this.bw.append(SEPARATOR);
      this.bw.append(design.getMetadata().getGtfFile());
    }
    if (design.getMetadata().containsAdditionnalAnnotationFile()) {
      this.bw.append(SEPARATOR);
      this.bw.append(design.getMetadata().getAdditionnalAnnotationFile());
    }
    if (exp != null) {
      this.bw.append(SEPARATOR);
      this.bw.append(exp.getId());
      ExperimentSample es=exp.getExperimentSample(sample);
      if (esmdk.contains(ExperimentSampleMetadata.CONDITION_KEY)) {
        this.bw.append(SEPARATOR);
        if (es.getMetadata().containsCondition()) {
          this.bw.append(es.getMetadata().getCondition());
        }
      }
      if (esmdk.contains(ExperimentSampleMetadata.REP_TECH_GROUP_KEY)) {
        this.bw.append(SEPARATOR);
        if (es.getMetadata().containsRepTechGroup()) {
          this.bw.append(es.getMetadata().getRepTechGroup());
        }
      }
      if (esmdk.contains(ExperimentSampleMetadata.REFERENCE_KEY)) {
        this.bw.append(SEPARATOR);
        if (es.getMetadata().containsReference()) {
          this.bw.append(es.getMetadata().getReference());
        }
      }
    }
    if (sampleMDKeys.contains(UUID_KEY)) {
      bw.append(TAB_SEPARATOR);
      bw.append(smd.get(UUID_KEY));
    }
    this.bw.append(NEWLINE);
  }
  this.bw.close();
}