Program: 141009
Project: 141009
Buggy source:
private MapperProcess createMapperProcessPE(final EntryMapping mapping,final String bwaPath,final String indexPath,final File inputFile1,final File inputFile2) throws IOException {
  boolean bwaAln=!MEM_FLAVOR.equals(mapping.getFlavor());
  if (bwaAln) {
    return new MapperProcess(mapping.getName(),mapping.getExecutor(),mapping.getTemporaryDirectory(),true,inputFile1,inputFile2){
      private File saiFile1;
      private File saiFile2;
      private File fastqFile1;
      private File fastqFile2;
      private FastqWriterThread writer1;
      private FastqWriterThread writer2;
      protected void additionalInit() throws IOException {
        final File tmpDir=EoulsanRuntime.getRuntime().getTempDirectory();
        final String uuid=getUUID();
        this.saiFile1=new File(tmpDir,PREFIX_FILES + "String_Node_Str" + uuid+ SAI_EXTENSION);
        this.saiFile2=new File(tmpDir,PREFIX_FILES + "String_Node_Str" + uuid+ SAI_EXTENSION);
        this.fastqFile1=new File(tmpDir,PREFIX_FILES + "String_Node_Str" + uuid+ FASTQ_EXTENSION);
        this.fastqFile2=new File(tmpDir,PREFIX_FILES + "String_Node_Str" + uuid+ FASTQ_EXTENSION);
        FileUtils.createNamedPipe(this.saiFile1);
        FileUtils.createNamedPipe(this.saiFile2);
        addFilesToRemove(this.saiFile1,this.saiFile2,this.fastqFile1,this.fastqFile2);
        this.writer1=new FastqWriterThread(this.fastqFile1,"String_Node_Str");
        this.writer2=new FastqWriterThread(this.fastqFile2,"String_Node_Str");
      }
      @Override public void writeEntry(      final String name1,      final String sequence1,      final String quality1,      final String name2,      final String sequence2,      final String quality2) throws IOException {
        super.writeEntry(name1,sequence1,quality1,name2,sequence2,quality2);
        this.writer1.write(ReadSequence.toFastQ(name1,sequence1,quality2) + '\n');
        this.writer2.write(ReadSequence.toFastQ(name2,sequence2,quality2) + '\n');
      }
      @Override public void writeEntry1(      final ReadSequence read) throws IOException {
        super.writeEntry1(read);
        this.writer1.write(read.toFastQ() + '\n');
      }
      @Override public void writeEntry2(      final ReadSequence read) throws IOException {
        super.writeEntry2(read);
        this.writer2.write(read.toFastQ() + '\n');
      }
      @Override public void closeEntriesWriter() throws IOException {
        super.closeWriter1();
        super.closeWriter2();
        this.writer1.close();
        this.writer2.close();
      }
      @Override public void closeWriter1() throws IOException {
        super.closeWriter1();
        this.writer1.close();
      }
      @Override public void closeWriter2() throws IOException {
        super.closeWriter2();
        this.writer2.close();
      }
      @Override protected List<List<String>> createCommandLines(){
        final boolean illuminaFastq=mapping.getFastqFormat() == FASTQ_ILLUMINA || mapping.getFastqFormat() == FASTQ_ILLUMINA_1_5;
        final List<String> cmd1=new ArrayList<>();
        cmd1.add(bwaPath);
        if (MEM_FLAVOR.equals(mapping.getFlavor())) {
          cmd1.add(MEM_FLAVOR);
        }
 else {
          cmd1.add(ALN_FLAVOR);
        }
        if (illuminaFastq) {
          cmd1.add("String_Node_Str");
        }
        final int threadNumber=mapping.getThreadNumber() > 1 ? mapping.getThreadNumber() / 2 : 1;
        cmd1.addAll(mapping.getMapperArguments());
        cmd1.add("String_Node_Str");
        cmd1.add(threadNumber + "String_Node_Str");
        cmd1.add("String_Node_Str");
        cmd1.add(this.saiFile1.getAbsolutePath());
        cmd1.add(indexPath);
        cmd1.add(getNamedPipeFile1().getAbsolutePath());
        final List<String> cmd2=new ArrayList<>();
        cmd2.add(bwaPath);
        cmd2.add(ALN_FLAVOR);
        if (illuminaFastq) {
          cmd2.add("String_Node_Str");
        }
        cmd2.addAll(mapping.getMapperArguments());
        cmd2.add("String_Node_Str");
        cmd2.add(threadNumber + "String_Node_Str");
        cmd2.add("String_Node_Str");
        cmd2.add(this.saiFile2.getAbsolutePath());
        cmd2.add(indexPath);
        cmd2.add(getNamedPipeFile2().getAbsolutePath());
        final List<String> cmd3=new ArrayList<>();
        cmd3.add(bwaPath);
        cmd3.add("String_Node_Str");
        cmd3.add(indexPath);
        cmd3.add(this.saiFile1.getAbsolutePath());
        cmd3.add(this.saiFile2.getAbsolutePath());
        cmd3.add(this.fastqFile1.getAbsolutePath());
        cmd3.add(this.fastqFile2.getAbsolutePath());
        final List<List<String>> result=new ArrayList<>();
        result.add(cmd1);
        result.add(cmd2);
        result.add(cmd3);
        return result;
      }
    }
;
  }
 else {
    return new MapperProcess(mapping.getName(),mapping.getExecutor(),mapping.getTemporaryDirectory(),true,inputFile1,inputFile2){
      @Override protected List<List<String>> createCommandLines(){
        final List<String> cmd=new ArrayList<>();
        cmd.add(bwaPath);
        cmd.add(MEM_FLAVOR);
        cmd.addAll(mapping.getMapperArguments());
        cmd.add("String_Node_Str");
        cmd.add(mapping.getThreadNumber() + "String_Node_Str");
        cmd.add(indexPath);
        cmd.add(getNamedPipeFile1().getAbsolutePath());
        cmd.add(getNamedPipeFile2().getAbsolutePath());
        return Collections.singletonList(cmd);
      }
    }
;
  }
}

Fixed version (ground truth):
private MapperProcess createMapperProcessPE(final EntryMapping mapping,final String bwaPath,final String indexPath,final File inputFile1,final File inputFile2) throws IOException {
  boolean bwaAln=!MEM_FLAVOR.equals(mapping.getFlavor());
  if (bwaAln) {
    return new MapperProcess(mapping.getName(),mapping.getExecutor(),mapping.getTemporaryDirectory(),true,inputFile1,inputFile2){
      private File saiFile1;
      private File saiFile2;
      private File fastqFile1;
      private File fastqFile2;
      private FastqWriterThread writer1;
      private FastqWriterThread writer2;
      protected void additionalInit() throws IOException {
        final File tmpDir=EoulsanRuntime.getRuntime().getTempDirectory();
        final String uuid=getUUID();
        this.saiFile1=new File(tmpDir,PREFIX_FILES + "String_Node_Str" + uuid+ SAI_EXTENSION);
        this.saiFile2=new File(tmpDir,PREFIX_FILES + "String_Node_Str" + uuid+ SAI_EXTENSION);
        if (inputFile1 == null) {
          this.fastqFile1=new File(tmpDir,PREFIX_FILES + "String_Node_Str" + uuid+ FASTQ_EXTENSION);
          this.fastqFile2=new File(tmpDir,PREFIX_FILES + "String_Node_Str" + uuid+ FASTQ_EXTENSION);
          this.writer1=new FastqWriterThread(this.fastqFile1,"String_Node_Str");
          this.writer2=new FastqWriterThread(this.fastqFile2,"String_Node_Str");
        }
        FileUtils.createNamedPipe(this.saiFile1);
        FileUtils.createNamedPipe(this.saiFile2);
        addFilesToRemove(this.saiFile1,this.saiFile2,this.fastqFile1,this.fastqFile2);
      }
      @Override public void writeEntry(      final String name1,      final String sequence1,      final String quality1,      final String name2,      final String sequence2,      final String quality2) throws IOException {
        super.writeEntry(name1,sequence1,quality1,name2,sequence2,quality2);
        this.writer1.write(ReadSequence.toFastQ(name1,sequence1,quality2) + '\n');
        this.writer2.write(ReadSequence.toFastQ(name2,sequence2,quality2) + '\n');
      }
      @Override public void writeEntry1(      final ReadSequence read) throws IOException {
        super.writeEntry1(read);
        this.writer1.write(read.toFastQ() + '\n');
      }
      @Override public void writeEntry2(      final ReadSequence read) throws IOException {
        super.writeEntry2(read);
        this.writer2.write(read.toFastQ() + '\n');
      }
      @Override public void closeEntriesWriter() throws IOException {
        super.closeWriter1();
        super.closeWriter2();
        this.writer1.close();
        this.writer2.close();
      }
      @Override public void closeWriter1() throws IOException {
        super.closeWriter1();
        this.writer1.close();
      }
      @Override public void closeWriter2() throws IOException {
        super.closeWriter2();
        this.writer2.close();
      }
      @Override protected List<List<String>> createCommandLines(){
        final boolean illuminaFastq=mapping.getFastqFormat() == FASTQ_ILLUMINA || mapping.getFastqFormat() == FASTQ_ILLUMINA_1_5;
        final List<String> cmd1=new ArrayList<>();
        cmd1.add(bwaPath);
        if (MEM_FLAVOR.equals(mapping.getFlavor())) {
          cmd1.add(MEM_FLAVOR);
        }
 else {
          cmd1.add(ALN_FLAVOR);
        }
        if (illuminaFastq) {
          cmd1.add("String_Node_Str");
        }
        final int threadNumber=mapping.getThreadNumber() > 1 ? mapping.getThreadNumber() / 2 : 1;
        cmd1.addAll(mapping.getMapperArguments());
        cmd1.add("String_Node_Str");
        cmd1.add(threadNumber + "String_Node_Str");
        cmd1.add("String_Node_Str");
        cmd1.add(this.saiFile1.getAbsolutePath());
        cmd1.add(indexPath);
        cmd1.add(getNamedPipeFile1().getAbsolutePath());
        final List<String> cmd2=new ArrayList<>();
        cmd2.add(bwaPath);
        cmd2.add(ALN_FLAVOR);
        if (illuminaFastq) {
          cmd2.add("String_Node_Str");
        }
        cmd2.addAll(mapping.getMapperArguments());
        cmd2.add("String_Node_Str");
        cmd2.add(threadNumber + "String_Node_Str");
        cmd2.add("String_Node_Str");
        cmd2.add(this.saiFile2.getAbsolutePath());
        cmd2.add(indexPath);
        cmd2.add(getNamedPipeFile2().getAbsolutePath());
        final List<String> cmd3=new ArrayList<>();
        cmd3.add(bwaPath);
        cmd3.add("String_Node_Str");
        cmd3.add(indexPath);
        cmd3.add(this.saiFile1.getAbsolutePath());
        cmd3.add(this.saiFile2.getAbsolutePath());
        if (inputFile1 != null) {
          cmd3.add(inputFile1.getAbsolutePath());
          cmd3.add(inputFile2.getAbsolutePath());
        }
 else {
          cmd3.add(this.fastqFile1.getAbsolutePath());
          cmd3.add(this.fastqFile2.getAbsolutePath());
        }
        final List<List<String>> result=new ArrayList<>();
        result.add(cmd1);
        result.add(cmd2);
        result.add(cmd3);
        return result;
      }
    }
;
  }
 else {
    return new MapperProcess(mapping.getName(),mapping.getExecutor(),mapping.getTemporaryDirectory(),true,inputFile1,inputFile2){
      @Override protected List<List<String>> createCommandLines(){
        final List<String> cmd=new ArrayList<>();
        cmd.add(bwaPath);
        cmd.add(MEM_FLAVOR);
        cmd.addAll(mapping.getMapperArguments());
        cmd.add("String_Node_Str");
        cmd.add(mapping.getThreadNumber() + "String_Node_Str");
        cmd.add(indexPath);
        cmd.add(getNamedPipeFile1().getAbsolutePath());
        cmd.add(getNamedPipeFile2().getAbsolutePath());
        return Collections.singletonList(cmd);
      }
    }
;
  }
}