Program: 50498
Project: 50498
Buggy source:
/** 
 * Perform the split transcripts mode.
 * @throws IOException error reading / writing
 */
@Override public void execute() throws IOException {
  if (!config.validate()) {
    throw new IOException("String_Node_Str");
  }
  final GeneTranscriptRelationships gtr=new GeneTranscriptRelationships();
  final IndexedIdentifier transcriptIdents=new IndexedIdentifier();
  final Int2ObjectMap<MutableString> transcriptIndexToIdMap=new Int2ObjectOpenHashMap<MutableString>();
  int entries=0;
  for (  final FastXEntry entry : new FastXReader(config.getInputFile())) {
    entries++;
    parseHeader(entry.getEntryHeader());
    final MutableString transcriptId=transcriptHeader.get("String_Node_Str");
    final MutableString geneId=transcriptHeader.get("String_Node_Str");
    final int transcriptIndex=transcriptIdents.registerIdentifier(transcriptId);
    gtr.addRelationship(geneId,transcriptIndex);
    transcriptIndexToIdMap.put(transcriptIndex,transcriptId);
  }
  LOG.info("String_Node_Str");
  final Int2IntMap transcriptIndex2FileIndex=new Int2IntOpenHashMap();
  final String configOutputFilename=config.getOutputBase() + "String_Node_Str";
  final String configOutputPath=FilenameUtils.getPath(configOutputFilename);
  if (StringUtils.isNotBlank(configOutputPath)) {
    LOG.info("String_Node_Str" + configOutputPath);
    FileUtils.forceMkdir(new File(configOutputPath));
  }
  PrintWriter configOutput=null;
  try {
    configOutput=new PrintWriter(configOutputFilename);
    configOutput.println("String_Node_Str");
    final Int2IntMap fileIndex2NumberOfEntries=new Int2IntOpenHashMap();
    fileIndex2NumberOfEntries.defaultReturnValue(0);
    transcriptIndex2FileIndex.defaultReturnValue(-1);
    final int initialNumberOfFiles=getNumberOfFiles(gtr,transcriptIndex2FileIndex);
    for (int geneIndex=0; geneIndex < gtr.getNumberOfGenes(); geneIndex++) {
      final MutableString geneId=gtr.getGeneId(geneIndex);
      final IntSet transcriptIndices=gtr.getTranscriptSet(geneIndex);
      int fileNum=0;
      for (      final int transcriptIndex : transcriptIndices) {
        if (transcriptIndex2FileIndex.get(transcriptIndex) != -1) {
          LOG.warn("String_Node_Str" + transcriptIndex);
          continue;
        }
        final int maxEntriesPerFile=config.getMaxEntriesPerFile();
        final int numberOfEntriesInOriginalBucket=fileIndex2NumberOfEntries.get(fileNum);
        final int adjustedFileIndex=fileNum + initialNumberOfFiles * (numberOfEntriesInOriginalBucket / maxEntriesPerFile);
        transcriptIndex2FileIndex.put(transcriptIndex,adjustedFileIndex);
        fileIndex2NumberOfEntries.put(fileNum,fileIndex2NumberOfEntries.get(fileNum) + 1);
        final MutableString transcriptId=transcriptIndexToIdMap.get(transcriptIndex);
        configOutput.printf("String_Node_Str",geneId,transcriptId);
        fileNum++;
      }
    }
  }
  finally {
    IOUtils.closeQuietly(configOutput);
  }
  final int numFiles=getFileIndices(transcriptIndex2FileIndex).size();
  if (LOG.isInfoEnabled()) {
    LOG.info(NumberFormat.getInstance().format(entries) + "String_Node_Str" + numFiles+ "String_Node_Str");
    final int maxEntriesPerFile=config.getMaxEntriesPerFile();
    if (maxEntriesPerFile < Integer.MAX_VALUE) {
      LOG.info("String_Node_Str" + maxEntriesPerFile + "String_Node_Str");
    }
  }
  final NumberFormat fileNumberFormatter=getNumberFormatter(numFiles - 1);
  final ProgressLogger progressLogger=new ProgressLogger();
  progressLogger.expectedUpdates=entries;
  progressLogger.itemsName="String_Node_Str";
  progressLogger.start();
  for (  final int fileIndex : getFileIndices(transcriptIndex2FileIndex)) {
    final String filename=config.getOutputBase() + "String_Node_Str" + fileNumberFormatter.format(fileIndex)+ "String_Node_Str";
    PrintStream printStream=null;
    try {
      printStream=new PrintStream(new GZIPOutputStream(new FileOutputStream(filename)));
      for (      final FastXEntry entry : new FastXReader(config.getInputFile())) {
        parseHeader(entry.getEntryHeader());
        final MutableString transcriptId=transcriptHeader.get("String_Node_Str");
        final MutableString geneId=transcriptHeader.get("String_Node_Str");
        final int transcriptIndex=transcriptIdents.getInt(transcriptId);
        final int transcriptFileIndex=transcriptIndex2FileIndex.get(transcriptIndex);
        if (transcriptFileIndex == fileIndex) {
          printStream.print(entry.getHeaderSymbol());
          printStream.print(transcriptId);
          printStream.print("String_Node_Str");
          printStream.println(geneId);
          printStream.println(entry.getEntrySansHeader());
          progressLogger.lightUpdate();
        }
      }
    }
  finally {
      IOUtils.closeQuietly(printStream);
    }
  }
  progressLogger.done();
}

Fixed version (ground truth):
/** 
 * Perform the split transcripts mode.
 * @throws IOException error reading / writing
 */
@Override public void execute() throws IOException {
  if (!config.validate()) {
    throw new IOException("String_Node_Str");
  }
  final GeneTranscriptRelationships gtr=new GeneTranscriptRelationships();
  final IndexedIdentifier transcriptIdents=new IndexedIdentifier();
  final Int2ObjectMap<MutableString> transcriptIndexToIdMap=new Int2ObjectOpenHashMap<MutableString>();
  int entries=0;
  for (  final FastXEntry entry : new FastXReader(config.getInputFile())) {
    entries++;
    parseHeader(entry.getEntryHeader());
    final MutableString transcriptId=transcriptHeader.get("String_Node_Str");
    final MutableString geneId=transcriptHeader.get("String_Node_Str");
    final int transcriptIndex=transcriptIdents.registerIdentifier(transcriptId);
    gtr.addRelationship(geneId,transcriptIndex);
    transcriptIndexToIdMap.put(transcriptIndex,transcriptId);
  }
  LOG.info("String_Node_Str");
  final Int2IntMap transcriptIndex2FileIndex=new Int2IntOpenHashMap();
  final String configOutputFilename=config.getOutputBase() + "String_Node_Str";
  final String configOutputPath=FilenameUtils.getFullPath(configOutputFilename);
  if (StringUtils.isNotBlank(configOutputPath)) {
    LOG.info("String_Node_Str" + configOutputPath);
    FileUtils.forceMkdir(new File(configOutputPath));
  }
  PrintWriter configOutput=null;
  try {
    configOutput=new PrintWriter(configOutputFilename);
    configOutput.println("String_Node_Str");
    final Int2IntMap fileIndex2NumberOfEntries=new Int2IntOpenHashMap();
    fileIndex2NumberOfEntries.defaultReturnValue(0);
    transcriptIndex2FileIndex.defaultReturnValue(-1);
    final int initialNumberOfFiles=getNumberOfFiles(gtr,transcriptIndex2FileIndex);
    for (int geneIndex=0; geneIndex < gtr.getNumberOfGenes(); geneIndex++) {
      final MutableString geneId=gtr.getGeneId(geneIndex);
      final IntSet transcriptIndices=gtr.getTranscriptSet(geneIndex);
      int fileNum=0;
      for (      final int transcriptIndex : transcriptIndices) {
        if (transcriptIndex2FileIndex.get(transcriptIndex) != -1) {
          LOG.warn("String_Node_Str" + transcriptIndex);
          continue;
        }
        final int maxEntriesPerFile=config.getMaxEntriesPerFile();
        final int numberOfEntriesInOriginalBucket=fileIndex2NumberOfEntries.get(fileNum);
        final int adjustedFileIndex=fileNum + initialNumberOfFiles * (numberOfEntriesInOriginalBucket / maxEntriesPerFile);
        transcriptIndex2FileIndex.put(transcriptIndex,adjustedFileIndex);
        fileIndex2NumberOfEntries.put(fileNum,fileIndex2NumberOfEntries.get(fileNum) + 1);
        final MutableString transcriptId=transcriptIndexToIdMap.get(transcriptIndex);
        configOutput.printf("String_Node_Str",geneId,transcriptId);
        fileNum++;
      }
    }
  }
  finally {
    IOUtils.closeQuietly(configOutput);
  }
  final int numFiles=getFileIndices(transcriptIndex2FileIndex).size();
  if (LOG.isInfoEnabled()) {
    LOG.info(NumberFormat.getInstance().format(entries) + "String_Node_Str" + numFiles+ "String_Node_Str");
    final int maxEntriesPerFile=config.getMaxEntriesPerFile();
    if (maxEntriesPerFile < Integer.MAX_VALUE) {
      LOG.info("String_Node_Str" + maxEntriesPerFile + "String_Node_Str");
    }
  }
  final NumberFormat fileNumberFormatter=getNumberFormatter(numFiles - 1);
  final ProgressLogger progressLogger=new ProgressLogger();
  progressLogger.expectedUpdates=entries;
  progressLogger.itemsName="String_Node_Str";
  progressLogger.start();
  for (  final int fileIndex : getFileIndices(transcriptIndex2FileIndex)) {
    final String filename=config.getOutputBase() + "String_Node_Str" + fileNumberFormatter.format(fileIndex)+ "String_Node_Str";
    PrintStream printStream=null;
    try {
      printStream=new PrintStream(new GZIPOutputStream(new FileOutputStream(filename)));
      for (      final FastXEntry entry : new FastXReader(config.getInputFile())) {
        parseHeader(entry.getEntryHeader());
        final MutableString transcriptId=transcriptHeader.get("String_Node_Str");
        final MutableString geneId=transcriptHeader.get("String_Node_Str");
        final int transcriptIndex=transcriptIdents.getInt(transcriptId);
        final int transcriptFileIndex=transcriptIndex2FileIndex.get(transcriptIndex);
        if (transcriptFileIndex == fileIndex) {
          printStream.print(entry.getHeaderSymbol());
          printStream.print(transcriptId);
          printStream.print("String_Node_Str");
          printStream.println(geneId);
          printStream.println(entry.getEntrySansHeader());
          progressLogger.lightUpdate();
        }
      }
    }
  finally {
      IOUtils.closeQuietly(printStream);
    }
  }
  progressLogger.done();
}