nus-yam/ex-repair huggingface dataset:
Program: 50295
Project: 50295
Buggy source:
/** 
 * Record all the between-group sample pairs that exist for the given group comparison.
 * @param comparison group comparison of interest.
 */
public void recordPairForGroupComparison(final GroupComparison comparison){
  samplePairsForGroupComparisons[comparison.index]=new ObjectArrayList<SamplePair>();
  final IntSet sampleIndicesInGroup1=new IntAVLTreeSet();
  final IntSet sampleIndicesInGroup2=new IntAVLTreeSet();
  for (int sampleIndex=0; sampleIndex < numSamples; sampleIndex++) {
    if (sampleIndexToGroupIndex[sampleIndex] == comparison.indexGroup1) {
      sampleIndicesInGroup1.add(sampleIndex);
    }
  }
  for (int sampleIndex=0; sampleIndex < numSamples; sampleIndex++) {
    if (sampleIndexToGroupIndex[sampleIndex] == comparison.indexGroup2) {
      sampleIndicesInGroup2.add(sampleIndex);
    }
  }
  for (  final int sampleIndexA : sampleIndicesInGroup1) {
    for (    final int sampleIndexB : sampleIndicesInGroup2) {
      if (sampleIndexA < sampleIndexB) {
        samplePairsForGroupComparisons[comparison.index].add(new SamplePair(sampleIndexA,sampleIndexB));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Record all the between-group sample pairs that exist for the given group comparison.
 * @param comparison group comparison of interest.
 */
public void recordPairForGroupComparison(final GroupComparison comparison){
  samplePairsForGroupComparisons[comparison.index]=new ObjectArrayList<SamplePair>();
  final IntSet sampleIndicesInGroup1=new IntAVLTreeSet();
  final IntSet sampleIndicesInGroup2=new IntAVLTreeSet();
  for (int sampleIndex=0; sampleIndex < numSamples; sampleIndex++) {
    if (sampleIndexToGroupIndex[sampleIndex] == comparison.indexGroup1) {
      sampleIndicesInGroup1.add(sampleIndex);
    }
  }
  for (int sampleIndex=0; sampleIndex < numSamples; sampleIndex++) {
    if (sampleIndexToGroupIndex[sampleIndex] == comparison.indexGroup2) {
      sampleIndicesInGroup2.add(sampleIndex);
    }
  }
  if (comparison.index == 2) {
    System.out.println("String_Node_Str");
  }
  final ObjectArraySet<SamplePair> set=new ObjectArraySet<SamplePair>();
  for (  final int sampleIndexA : sampleIndicesInGroup1) {
    for (    final int sampleIndexB : sampleIndicesInGroup2) {
      set.add(new SamplePair(sampleIndexA,sampleIndexB));
    }
  }
  samplePairsForGroupComparisons[comparison.index].addAll(set);
}
Program: 50296
Project: 50296
Buggy source:
/** 
 * Construct a sample pair enumerator.
 * @param sampleIndexToGroupIndex the mapping between sample indices and group indices.
 * @param numSamples The number of samples under study.
 * @param numGroups  The number of groups under study.
 * @param numPairComparisons The maximum number of between group comparisons to consider.
 */
public SamplePairEnumerator(final int[] sampleIndexToGroupIndex,int numSamples,int numGroups,int numPairComparisons){
  samplePairsForGroup=new ObjectArrayList[numGroups];
  this.sampleIndexToGroupIndex=sampleIndexToGroupIndex;
  this.numSamples=numSamples;
  this.numGroups=numGroups;
  this.samplePairsForGroupComparisons=new ObjectArrayList[numPairComparisons];
}

Fixed version (ground truth):
/** 
 * Construct a sample pair enumerator.
 * @param sampleIndexToGroupIndex the mapping between sample indices and group indices.
 * @param numSamples              The number of samples under study.
 * @param numGroups               The number of groups under study.
 * @param numPairComparisons      The maximum number of between group comparisons to consider.
 */
public SamplePairEnumerator(final int[] sampleIndexToGroupIndex,int numSamples,int numGroups,int numPairComparisons){
  samplePairsForGroup=new ObjectArrayList[numGroups];
  this.sampleIndexToGroupIndex=sampleIndexToGroupIndex;
  this.numSamples=numSamples;
  this.numGroups=numGroups;
  this.samplePairsForGroupComparisons=new ObjectArrayList[numPairComparisons];
}
Program: 50297
Project: 50297
Buggy source:
private void write(ObjectArrayList<String> elementIds){
  outputWriter.print(label);
  outputWriter.print("String_Node_Str");
  boolean stop=false;
  for (  final String elementId : elementIds) {
    outputWriter.print('\t');
    outputWriter.print(elementId);
  }
  if (elementIds.get(5).equals("String_Node_Str")) {
    System.out.println(elementIds);
  }
  final double p=estimator.estimateEmpiricalPValue(valuesACollector.toArray(new IntArrayList[valuesACollector.size()]),valuesBCollector.toArray(new IntArrayList[valuesBCollector.size()]),covariatesACollector.toArray(new IntArrayList[covariatesACollector.size()]),covariatesBCollector.toArray(new IntArrayList[covariatesBCollector.size()]));
  if (index < 1000) {
    if (p > 0.05) {
      numFN++;
    }
 else {
      numTP++;
    }
  }
  if (index >= 1000) {
    if (p <= 0.05) {
      numFP++;
    }
 else {
      numTN++;
    }
    numOther++;
  }
  index++;
  outputWriter.printf("String_Node_Str",p);
}

Fixed version (ground truth):
private void write(ObjectArrayList<String> elementIds){
  outputWriter.print(label);
  outputWriter.print("String_Node_Str");
  boolean stop=false;
  for (  final String elementId : elementIds) {
    outputWriter.print('\t');
    outputWriter.print(elementId);
  }
  if (elementIds.get(5).equals("String_Node_Str")) {
    System.out.println(elementIds);
  }
  final double p=estimator.estimateEmpiricalPValue(valuesACollector.toArray(new IntArrayList[valuesACollector.size()]),valuesBCollector.toArray(new IntArrayList[valuesBCollector.size()]),covariatesACollector.toArray(new IntArrayList[covariatesACollector.size()]),covariatesBCollector.toArray(new IntArrayList[covariatesBCollector.size()]));
  final double alpha=0.05;
  if (index < 1000) {
    if (p > alpha) {
      numFN++;
    }
 else {
      numTP++;
    }
  }
  if (index >= 1000) {
    if (p <= alpha) {
      numFP++;
    }
 else {
      numTN++;
    }
    numOther++;
  }
  index++;
  outputWriter.printf("String_Node_Str",p);
}
Program: 50299
Project: 50299
Buggy source:
private synchronized void writeStats() throws IOException {
  if (!statsWritten) {
    stats.put("String_Node_Str",FilenameUtils.getBaseName(basename));
    stats.put("String_Node_Str",Integer.toString(permutator.getBiggestSmallIndex()));
    stats.put("String_Node_Str",Integer.toString(permutator.getSmallestIndex()));
    stats.put("String_Node_Str",Integer.toString(getNumQueries()));
    stats.put("String_Node_Str",basename);
    stats.put("String_Node_Str",Integer.toString(numberOfAlignedReads));
    stats.store(statsWriter,"String_Node_Str");
    statsWritten=true;
  }
}

Fixed version (ground truth):
private synchronized void writeStats() throws IOException {
  if (!statsWritten) {
    stats.put("String_Node_Str",FilenameUtils.getName(basename));
    stats.put("String_Node_Str",Integer.toString(permutator.getBiggestSmallIndex()));
    stats.put("String_Node_Str",Integer.toString(permutator.getSmallestIndex()));
    stats.put("String_Node_Str",Integer.toString(getNumQueries()));
    stats.put("String_Node_Str",basename);
    stats.put("String_Node_Str",Integer.toString(numberOfAlignedReads));
    stats.store(statsWriter,"String_Node_Str");
    statsWritten=true;
  }
}
Program: 50300
Project: 50300
Buggy source:
public void finish(RandomAccessSequenceCache randomAccessGenome,AlignmentToPileupMode.OutputFormat outputFormat){
  if (randomAccessGenome != null) {
    Sequence seq=new Sequence();
    MutableString clippedBases=new MutableString();
    for (int position=startPosition - maxVariationLength; position <= endPosition + 50; position++) {
      final String targetId=getReferenceId(startReferenceIndex).toString();
      clippedBases.append(randomAccessGenome.get(targetId,position));
    }
    seq.basename="String_Node_Str" + randomAccessGenome.getBasename() + "String_Node_Str";
    writeSequence(outputFormat,seq,seq.basename,clippedBases);
  }
  for (  String basename : basenameIds) {
    int i=0;
    for (    Sequence seq : sequenceBuffers) {
      if (seq.basename.equals(basename)) {
        final MutableString bases=sequenceBuffers.get(i).bases;
        if (bases.length() > startFlapStart) {
          final String shortBasename=FilenameUtils.getBaseName(AlignmentReaderImpl.getBasename(seq.basename));
          final MutableString clippedBases=bases.substring(Math.max(0,startFlapStart - maxVariationLength));
          writeSequence(outputFormat,seq,shortBasename,clippedBases);
        }
      }
      i++;
    }
  }
}

Fixed version (ground truth):
public void finish(RandomAccessSequenceCache randomAccessGenome,AlignmentToPileupMode.OutputFormat outputFormat){
  if (randomAccessGenome != null) {
    Sequence seq=new Sequence();
    MutableString clippedBases=new MutableString();
    for (int position=startPosition - maxVariationLength; position <= endPosition + 50; position++) {
      final String targetId=getReferenceId(startReferenceIndex).toString();
      clippedBases.append(randomAccessGenome.get(targetId,position));
    }
    seq.basename="String_Node_Str" + randomAccessGenome.getBasename() + "String_Node_Str";
    writeSequence(outputFormat,seq,seq.basename,clippedBases);
  }
  for (  String basename : basenameIds) {
    int i=0;
    for (    Sequence seq : sequenceBuffers) {
      if (seq.basename.equals(basename)) {
        final MutableString bases=sequenceBuffers.get(i).bases;
        if (bases.length() > startFlapStart) {
          final String shortBasename=FilenameUtils.getName(AlignmentReaderImpl.getBasename(seq.basename));
          final MutableString clippedBases=bases.substring(Math.max(0,startFlapStart - maxVariationLength));
          writeSequence(outputFormat,seq,shortBasename,clippedBases);
        }
      }
      i++;
    }
  }
}
Program: 50301
Project: 50301
Buggy source:
public void write(final AlignmentWriterImpl writer) throws IOException {
  try {
    writer.setTargetIdentifiers(alignmentReader.getTargetIdentifiers());
    writer.setQueryIdentifiers(alignmentReader.getQueryIdentifiers());
    final int[] targetLengths=alignmentReader.getTargetLength();
    if (targetLengths != null) {
      writer.setTargetLengths(targetLengths);
    }
    writer.setLargestSplitQueryIndex(alignmentReader.getLargestSplitQueryIndex());
    writer.setSmallestSplitQueryIndex(alignmentReader.getSmallestSplitQueryIndex());
    writer.setSorted(true);
    writer.setAlignerName(alignmentReader.getAlignerName());
    writer.setAlignerVersion(alignmentReader.getAlignerVersion());
    writer.setStatistics(alignmentReader.getStatistics());
    writer.putStatistic("String_Node_Str",FilenameUtils.getBaseName(basename));
    writer.putStatistic("String_Node_Str",basename);
    for (    final Alignments.AlignmentEntry entry : entries) {
      writer.appendEntry(entry);
    }
  }
  finally {
    writer.close();
  }
}

Fixed version (ground truth):
public void write(final AlignmentWriterImpl writer) throws IOException {
  try {
    writer.setTargetIdentifiers(alignmentReader.getTargetIdentifiers());
    writer.setQueryIdentifiers(alignmentReader.getQueryIdentifiers());
    final int[] targetLengths=alignmentReader.getTargetLength();
    if (targetLengths != null) {
      writer.setTargetLengths(targetLengths);
    }
    writer.setLargestSplitQueryIndex(alignmentReader.getLargestSplitQueryIndex());
    writer.setSmallestSplitQueryIndex(alignmentReader.getSmallestSplitQueryIndex());
    writer.setSorted(true);
    writer.setAlignerName(alignmentReader.getAlignerName());
    writer.setAlignerVersion(alignmentReader.getAlignerVersion());
    writer.setStatistics(alignmentReader.getStatistics());
    writer.putStatistic("String_Node_Str",FilenameUtils.getName(basename));
    writer.putStatistic("String_Node_Str",basename);
    for (    final Alignments.AlignmentEntry entry : entries) {
      writer.appendEntry(entry);
    }
  }
  finally {
    writer.close();
  }
}
Program: 50302
Project: 50302
Buggy source:
/** 
 * Determine if an sampleId is provided on the command line.
 * @param inputFilenames
 * @param sampleId
 * @return
 */
private boolean isInputFilename(String[] inputFilenames,String sampleId){
  for (  final String input : inputFilenames) {
    String commandLineBasename=FilenameUtils.getBaseName(input);
    if (commandLineBasename.equals(FilenameUtils.getBaseName(sampleId))) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Determine if a sampleId is provided on the command line.
 * @param inputFilenames
 * @param sampleId
 * @return
 */
private boolean isInputFilename(String[] inputFilenames,String sampleId){
  for (  final String input : inputFilenames) {
    String commandLineBasename=FilenameUtils.getName(AlignmentReaderImpl.getBasename(input));
    if (commandLineBasename.equals(FilenameUtils.getName(AlignmentReaderImpl.getBasename(sampleId)))) {
      return true;
    }
  }
  return false;
}
Program: 50303
Project: 50303
Buggy source:
public String[] getSamples(){
  if (readIndexStats != null) {
    int numberOfSamples=readIndexStats.size();
    samples=new String[numberOfSamples];
    if (readIndexStats.size() == 0) {
      System.err.println("String_Node_Str");
      System.exit(1);
    }
    for (    ReadIndexStats stat : readIndexStats) {
      samples[stat.readerIndex]=stat.basename;
    }
    return samples;
  }
 else {
    samples=AlignmentReaderImpl.getBasenames(inputFilenames);
    for (int i=0; i < samples.length; i++) {
      samples[i]=FilenameUtils.getBaseName(samples[i]);
    }
    return samples;
  }
}

Fixed version (ground truth):
public String[] getSamples(){
  if (readIndexStats != null) {
    int numberOfSamples=readIndexStats.size();
    samples=new String[numberOfSamples];
    if (readIndexStats.size() == 0) {
      System.err.println("String_Node_Str");
      System.exit(1);
    }
    for (    ReadIndexStats stat : readIndexStats) {
      samples[stat.readerIndex]=stat.basename;
    }
    return samples;
  }
 else {
    samples=AlignmentReaderImpl.getBasenames(inputFilenames);
    for (int i=0; i < samples.length; i++) {
      samples[i]=FilenameUtils.getName(samples[i]);
    }
    return samples;
  }
}
Program: 50306
Project: 50306
Buggy source:
private void analyzeCigar(int position,String cigar,ObjectArrayList<Limits> list){
  Matcher matcher=CIGAR_REGEX.matcher(cigar);
  int previousCigarIndex=0;
  int cigarIndex=0;
  int previousPosition=position;
  int previousPositionInRead=0;
  int positionInRead=0;
  int initialRefPosition=position;
  while (matcher.find()) {
    final int cigarLength=matcher.group(1).length() + matcher.group(2).length();
    final int readBasesLength=Integer.parseInt(matcher.group(1));
    final char op=matcher.group(2).charAt(0);
switch (op) {
case 'N':
      list.add(new Limits(previousPosition,previousCigarIndex,cigarIndex,previousPositionInRead,positionInRead,previousPosition,position));
    previousCigarIndex=cigarIndex + cigarLength;
  previousPositionInRead=positionInRead;
position+=readBasesLength;
previousPosition=position;
break;
case 'I':
if (usingGenome) {
positionInRead+=readBasesLength;
position+=readBasesLength;
}
break;
case 'D':
if (usingGenome) {
insertSomeInRef(position,initialRefPosition,readBasesLength);
}
break;
case 'S':
if (usingGenome) {
insertSomeInRef(position,initialRefPosition,readBasesLength);
}
break;
default :
positionInRead+=readBasesLength;
position+=readBasesLength;
break;
}
cigarIndex+=cigarLength;
}
list.add(new Limits(previousPosition,previousCigarIndex,cigarIndex,previousPositionInRead,positionInRead,previousPosition,position));
}

Fixed version (ground truth):
private void analyzeCigar(int position,String cigar,ObjectArrayList<Limits> list){
  Matcher matcher=CIGAR_REGEX.matcher(cigar);
  int previousCigarIndex=0;
  int cigarIndex=0;
  int previousPosition=position;
  int previousPositionInRead=0;
  int positionInRead=0;
  int initialRefPosition=position;
  while (matcher.find()) {
    final int cigarLength=matcher.group(1).length() + matcher.group(2).length();
    final int readBasesLength=Integer.parseInt(matcher.group(1));
    final char op=matcher.group(2).charAt(0);
switch (op) {
case 'N':
      list.add(new Limits(previousPosition,previousCigarIndex,cigarIndex,previousPositionInRead,positionInRead,previousPosition,position));
    previousCigarIndex=cigarIndex + cigarLength;
  previousPositionInRead=positionInRead;
position+=readBasesLength;
previousPosition=position;
break;
case 'I':
if (usingGenome) {
positionInRead+=readBasesLength;
position+=readBasesLength;
}
break;
case 'D':
if (usingGenome) {
insertSomeInRef(position,initialRefPosition,readBasesLength);
}
break;
case 'S':
if (usingGenome) {
insertSomeInRef(position,initialRefPosition,readBasesLength);
}
positionInRead+=readBasesLength;
previousPositionInRead+=readBasesLength;
break;
default :
positionInRead+=readBasesLength;
position+=readBasesLength;
break;
}
cigarIndex+=cigarLength;
}
list.add(new Limits(previousPosition,previousCigarIndex,cigarIndex,previousPositionInRead,positionInRead,previousPosition,position));
}
Program: 50308
Project: 50308
Buggy source:
private void readMinimalUnary(final String label,final int numEntriesInChunk,final InputBitStream bitInput,final IntList list) throws IOException {
  final int size=bitInput.readNibble();
  if (size == 0) {
    return;
  }
  final int min=bitInput.readNibble();
  final int max=bitInput.readNibble();
  final int b=max - min + 1;
  final int log2b=Math.max(1,Fast.mostSignificantBit(b));
  for (int i=0; i < size; i++) {
    final int reducedReadIndex=bitInput.readMinimalBinary(max - min + 1,log2b);
    list.add(reducedReadIndex + min);
  }
}

Fixed version (ground truth):
private void readMinimalUnary(final String label,final int numEntriesInChunk,final InputBitStream bitInput,final IntList list) throws IOException {
  final int size=bitInput.readNibble();
  if (size == 0) {
    return;
  }
  final int min=bitInput.readNibble();
  final int max=bitInput.readNibble();
  final int b=max - min + 1;
  final int log2b=Fast.mostSignificantBit(b);
  for (int i=0; i < size; i++) {
    final int reducedReadIndex=bitInput.readMinimalBinary(max - min + 1,log2b);
    list.add(reducedReadIndex + min);
  }
}
Program: 50309
Project: 50309
Buggy source:
private void writeQueryIndices(final String label,final IntList list,final OutputBitStream out) throws IOException {
  boolean success=tryWriteDeltas(label,list,out);
  if (success) {
    return;
  }
 else {
    out.writeDelta(MINIMAL_BINARY_ENCODING_SCHEME);
  }
  int min=Integer.MAX_VALUE;
  int max=Integer.MIN_VALUE;
  final int size=list.size();
  for (  final int value : list) {
    min=Math.min(value,min);
    max=Math.max(value,max);
  }
  out.writeNibble(size);
  if (size == 0) {
    return;
  }
  out.writeNibble(min);
  out.writeNibble(max);
  final long writtenStart=out.writtenBits();
  final int b=max - min + 1;
  final int log2b=Math.max(1,Fast.mostSignificantBit(b));
  for (  final int value : list) {
    out.writeMinimalBinary(value - min,b,log2b);
  }
  if (debug(1)) {
    final long writtenStop=out.writtenBits();
    final long written=writtenStop - writtenStart;
    recordStats(label,list,written);
  }
}

Fixed version (ground truth):
private void writeQueryIndices(final String label,final IntList list,final OutputBitStream out) throws IOException {
  boolean success=tryWriteDeltas(label,list,out);
  if (success) {
    return;
  }
 else {
    out.writeDelta(MINIMAL_BINARY_ENCODING_SCHEME);
  }
  int min=Integer.MAX_VALUE;
  int max=Integer.MIN_VALUE;
  final int size=list.size();
  for (  final int value : list) {
    min=Math.min(value,min);
    max=Math.max(value,max);
  }
  out.writeNibble(size);
  if (size == 0) {
    return;
  }
  out.writeNibble(min);
  out.writeNibble(max);
  final long writtenStart=out.writtenBits();
  final int b=max - min + 1;
  final int log2b=Fast.mostSignificantBit(b);
  for (  final int value : list) {
    out.writeMinimalBinary(value - min,b,log2b);
  }
  if (debug(1)) {
    final long writtenStop=out.writtenBits();
    final long written=writtenStop - writtenStart;
    recordStats(label,list,written);
  }
}
Program: 50310
Project: 50310
Buggy source:
private void readAsDeltas(String label,int numEntriesInChunk,InputBitStream bitInput,IntList list) throws IOException {
  IntArrayList deltas=new IntArrayList();
  int previous=bitInput.readNibble();
  list.add(previous);
  decodeArithmetic(label,numEntriesInChunk - 1,bitInput,deltas);
  for (  int delta : deltas) {
    final int newValue=Fast.nat2int(delta) + previous;
    list.add(newValue);
    previous=newValue;
  }
}

Fixed version (ground truth):
private void readAsDeltas(String label,int numEntriesInChunk,InputBitStream bitInput,IntList list) throws IOException {
  IntArrayList deltas=new IntArrayList();
  int previous=bitInput.readNibble();
  decodeArithmetic(label,numEntriesInChunk - 1,bitInput,deltas);
  list.add(previous);
  for (  int delta : deltas) {
    final int newValue=Fast.nat2int(delta) + previous;
    list.add(newValue);
    previous=newValue;
  }
}
Program: 50311
Project: 50311
Buggy source:
protected final void decodeArithmetic(final String label,final int numEntriesInChunk,final InputBitStream bitInput,final IntList list) throws IOException {
  if (debug(2)) {
    System.err.flush();
    System.err.println("String_Node_Str" + label + "String_Node_Str"+ bitInput.available());
    System.err.flush();
  }
  if (numEntriesInChunk == 0) {
    return;
  }
  final int size=bitInput.readNibble();
  if (size == 0) {
    return;
  }
  final boolean hasNegatives=bitInput.readBit() == 1;
  final int numTokens=bitInput.readNibble();
  final int[] distinctvalue=new int[numTokens];
  for (int i=0; i < numTokens; i++) {
    final int token=bitInput.readNibble();
    final int anInt=hasNegatives ? Fast.nat2int(token) : token - 1;
    distinctvalue[i]=anInt;
  }
  if (hasNegatives) {
    Arrays.sort(distinctvalue);
  }
  final FastArithmeticDecoder decoder=new FastArithmeticDecoder(numTokens);
  for (int i=0; i < size; i++) {
    final int tokenValue=distinctvalue[decoder.decode(bitInput)];
    list.add(tokenValue);
  }
  decoder.reposition(bitInput);
}

Fixed version (ground truth):
protected final void decodeArithmetic(final String label,final int numEntriesInChunk,final InputBitStream bitInput,final IntList list) throws IOException {
  if (debug(2)) {
    System.err.flush();
    System.err.println("String_Node_Str" + label + "String_Node_Str"+ bitInput.available());
    System.err.flush();
  }
  final int size=bitInput.readNibble();
  if (size == 0) {
    return;
  }
  final boolean hasNegatives=bitInput.readBit() == 1;
  final int numTokens=bitInput.readNibble();
  final int[] distinctvalue=new int[numTokens];
  for (int i=0; i < numTokens; i++) {
    final int token=bitInput.readNibble();
    final int anInt=hasNegatives ? Fast.nat2int(token) : token - 1;
    distinctvalue[i]=anInt;
  }
  if (hasNegatives) {
    Arrays.sort(distinctvalue);
  }
  final FastArithmeticDecoder decoder=new FastArithmeticDecoder(numTokens);
  for (int i=0; i < size; i++) {
    final int tokenValue=distinctvalue[decoder.decode(bitInput)];
    list.add(tokenValue);
  }
  decoder.reposition(bitInput);
}
Program: 50312
Project: 50312
Buggy source:
private void readMinimalUnary(final String label,final int numEntriesInChunk,final InputBitStream bitInput,final IntList list) throws IOException {
  final int size=bitInput.readNibble();
  if (size == 0) {
    return;
  }
  final int min=bitInput.readNibble();
  final int max=bitInput.readNibble();
  for (int i=0; i < size; i++) {
    final int reducedReadIndex=bitInput.readMinimalBinary(max - min + 1);
    list.add(reducedReadIndex + min);
  }
}

Fixed version (ground truth):
private void readMinimalUnary(final String label,final int numEntriesInChunk,final InputBitStream bitInput,final IntList list) throws IOException {
  final int size=bitInput.readNibble();
  if (size == 0) {
    return;
  }
  final int min=bitInput.readNibble();
  final int max=bitInput.readNibble();
  final int b=max - min + 1;
  final int log2b=Math.max(1,Fast.mostSignificantBit(b));
  for (int i=0; i < size; i++) {
    final int reducedReadIndex=bitInput.readMinimalBinary(max - min + 1,log2b);
    list.add(reducedReadIndex + min);
  }
}
Program: 50313
Project: 50313
Buggy source:
private void writeQueryIndices(final String label,final IntList list,final OutputBitStream out) throws IOException {
  boolean success=tryWriteDeltas(label,list,out);
  if (success) {
    return;
  }
 else {
    out.writeDelta(MINIMAL_BINARY_ENCODING_SCHEME);
  }
  int min=Integer.MAX_VALUE;
  int max=Integer.MIN_VALUE;
  final int size=list.size();
  for (  final int value : list) {
    min=Math.min(value,min);
    max=Math.max(value,max);
  }
  out.writeNibble(size);
  if (size == 0) {
    return;
  }
  out.writeNibble(min);
  out.writeNibble(max);
  final long writtenStart=out.writtenBits();
  final int b=max - min + 1;
  final int log2b=Fast.mostSignificantBit(b);
  for (  final int value : list) {
    out.writeMinimalBinary(value - min,b,log2b);
  }
  if (debug(1)) {
    final long writtenStop=out.writtenBits();
    final long written=writtenStop - writtenStart;
    recordStats(label,list,written);
  }
}

Fixed version (ground truth):
private void writeQueryIndices(final String label,final IntList list,final OutputBitStream out) throws IOException {
  boolean success=tryWriteDeltas(label,list,out);
  if (success) {
    return;
  }
 else {
    out.writeDelta(MINIMAL_BINARY_ENCODING_SCHEME);
  }
  int min=Integer.MAX_VALUE;
  int max=Integer.MIN_VALUE;
  final int size=list.size();
  for (  final int value : list) {
    min=Math.min(value,min);
    max=Math.max(value,max);
  }
  out.writeNibble(size);
  if (size == 0) {
    return;
  }
  out.writeNibble(min);
  out.writeNibble(max);
  final long writtenStart=out.writtenBits();
  final int b=max - min + 1;
  final int log2b=Math.max(1,Fast.mostSignificantBit(b));
  for (  final int value : list) {
    out.writeMinimalBinary(value - min,b,log2b);
  }
  if (debug(1)) {
    final long writtenStop=out.writtenBits();
    final long written=writtenStop - writtenStart;
    recordStats(label,list,written);
  }
}
Program: 50314
Project: 50314
Buggy source:
public void roundTripBug() throws IOException {
  final HybridChunkCodec1 codec=new HybridChunkCodec1();
  codec.setHandler(new AlignmentCollectionHandler());
  Alignments.AlignmentCollection.Builder collection=loadCollection("String_Node_Str",10000 * 117 - 5000,10000);
  assertRoundTripMatchExpected(codec,collection);
}

Fixed version (ground truth):
@Test public void roundTripBug() throws IOException {
  final HybridChunkCodec1 codec=new HybridChunkCodec1();
  codec.setHandler(new AlignmentCollectionHandler());
  Alignments.AlignmentCollection.Builder collection=loadCollection("String_Node_Str",10000 * 117 - 5000,10000);
  assertRoundTripMatchExpected(codec,collection);
}
Program: 50315
Project: 50315
Buggy source:
public void roundTripLarge() throws IOException {
  final HybridChunkCodec1 codec=new HybridChunkCodec1();
  codec.setHandler(new AlignmentCollectionHandler());
  Alignments.AlignmentCollection.Builder collection=loadCollection("String_Node_Str",0,100);
  assertRoundTripMatchExpected(codec,collection,false);
}

Fixed version (ground truth):
@Test public void roundTripLarge() throws IOException {
  final HybridChunkCodec1 codec=new HybridChunkCodec1();
  codec.setHandler(new AlignmentCollectionHandler());
  Alignments.AlignmentCollection.Builder collection=loadCollection("String_Node_Str",0,100);
  assertRoundTripMatchExpected(codec,collection,false);
}
Program: 50316
Project: 50316
Buggy source:
@Override public Message decompressCollection(Message reducedCollection,byte[] compressedBytes) throws IOException {
  reset();
  byte[] moreRoom=new byte[compressedBytes.length + 100];
  System.arraycopy(compressedBytes,0,moreRoom,0,compressedBytes.length);
  final Alignments.AlignmentCollection alignmentCollection=(Alignments.AlignmentCollection)reducedCollection;
  final Alignments.AlignmentCollection.Builder result=Alignments.AlignmentCollection.newBuilder();
  final InputBitStream bitInput=new InputBitStream(new FastByteArrayInputStream(moreRoom));
  final int numEntriesInChunk=alignmentCollection.getAlignmentEntriesCount();
  final int streamVersion=decompressBits(bitInput,numEntriesInChunk);
  int originalIndex=0;
  for (int templateIndex=0; templateIndex < numEntriesInChunk; templateIndex++) {
    final int templatePositionIndex=varPositionIndex;
    final int templateVarFromToIndex=varFromToIndex;
    final int templateVarHasToQualsIndex=varToQualsLength;
    while (multiplicities.get(templateIndex) >= 1) {
      result.addAlignmentEntries(andBack(templateIndex,originalIndex,alignmentCollection.getAlignmentEntries(templateIndex),streamVersion));
      if (multiplicities.get(templateIndex) >= 1) {
        varPositionIndex=templatePositionIndex;
        varFromToIndex=templateVarFromToIndex;
        varToQualsLength=templateVarHasToQualsIndex;
      }
      originalIndex++;
    }
  }
  ++chunkIndex;
  return result.build();
}

Fixed version (ground truth):
@Override public Message decompressCollection(Message reducedCollection,byte[] compressedBytes) throws IOException {
  reset();
  byte[] moreRoom=new byte[compressedBytes.length + 100];
  System.arraycopy(compressedBytes,0,moreRoom,0,compressedBytes.length);
  final Alignments.AlignmentCollection alignmentCollection=(Alignments.AlignmentCollection)reducedCollection;
  final Alignments.AlignmentCollection.Builder result=Alignments.AlignmentCollection.newBuilder();
  final InputBitStream bitInput=new InputBitStream(new FastByteArrayInputStream(moreRoom));
  final int numEntriesInChunk=alignmentCollection.getAlignmentEntriesCount();
  final int streamVersion=decompressBits(bitInput,numEntriesInChunk);
  int originalIndex=0;
  for (int templateIndex=0; templateIndex < numEntriesInChunk; templateIndex++) {
    final int templatePositionIndex=varPositionIndex;
    final int templateVarFromToIndex=varFromToIndex;
    final int templateVarHasToQualsIndex=varToQualLengthIndex;
    while (multiplicities.get(templateIndex) >= 1) {
      result.addAlignmentEntries(andBack(templateIndex,originalIndex,alignmentCollection.getAlignmentEntries(templateIndex),streamVersion));
      if (multiplicities.get(templateIndex) >= 1) {
        varPositionIndex=templatePositionIndex;
        varFromToIndex=templateVarFromToIndex;
      }
      originalIndex++;
    }
  }
  ++chunkIndex;
  return result.build();
}
Program: 50319
Project: 50319
Buggy source:
private void recordVariationQualitiesAndClear(Alignments.AlignmentEntry.Builder result,List<Alignments.SequenceVariation> sequenceVariationsList){
  int index=0;
  for (  final Alignments.SequenceVariation seqVar : sequenceVariationsList) {
    final String from=seqVar.getFrom();
    final ByteString toQualities=seqVar.getToQuality();
    final boolean hasToQuals=seqVar.hasToQuality();
    final int toQualSize=toQualities.size();
    varToQualLength.add(toQualSize);
    final int toQualsLength=hasToQuals ? seqVar.getToQuality().size() : 0;
    for (int i=0; i < toQualsLength; i++) {
      if (hasToQuals && i < toQualSize) {
        varQuals.add(toQualities.byteAt(i));
      }
    }
    Alignments.SequenceVariation.Builder varBuilder=Alignments.SequenceVariation.newBuilder(seqVar);
    varBuilder.clearToQuality();
    result.setSequenceVariations(index,varBuilder.buildPartial());
    index++;
  }
}

Fixed version (ground truth):
private void recordVariationQualitiesAndClear(Alignments.AlignmentEntry source,Alignments.AlignmentEntry.Builder result,List<Alignments.SequenceVariation> sequenceVariationsList){
  int index=0;
  for (  final Alignments.SequenceVariation seqVar : sequenceVariationsList) {
    final String from=seqVar.getFrom();
    final ByteString toQualities=seqVar.getToQuality();
    final boolean hasToQuals=seqVar.hasToQuality();
    final int toQualSize=hasToQuals ? toQualities.size() : 0;
    varToQualLength.add(toQualSize);
    for (int i=0; i < toQualSize; i++) {
      varQuals.add(toQualities.byteAt(i));
    }
    Alignments.SequenceVariation.Builder varBuilder=Alignments.SequenceVariation.newBuilder(seqVar);
    varBuilder.clearToQuality();
    result.setSequenceVariations(index,varBuilder.buildPartial());
    index++;
  }
}
Program: 50320
Project: 50320
Buggy source:
private void encodeVar(boolean entryOnReverseStrand,int queryLenth,final Alignments.SequenceVariation seqVar){
  final String from=seqVar.getFrom();
  final String to=seqVar.getTo();
  final ByteString toQualities=seqVar.getToQuality();
  final int fromLength=from.length();
  final int toLength=to.length();
  final boolean hasToQuals=seqVar.hasToQuality();
  final int position=seqVar.getPosition();
  varPositions.add(position);
  final int readIndex=seqVar.getReadIndex();
  final int recodedReadIndex=entryOnReverseStrand ? readIndex - (queryLenth - position) + 5 : 5 + position - readIndex;
  varReadIndex.add(recodedReadIndex);
  fromLengths.add(fromLength);
  toLengths.add(toLength);
  final int maxLength=Math.max(fromLength,toLength);
  for (int i=0; i < maxLength; i++) {
    final char baseFrom=i < fromLength ? from.charAt(i) : '\0';
    final char baseTo=i < toLength ? to.charAt(i) : '\0';
    final byte byteFrom=(byte)baseFrom;
    final byte byteTo=(byte)baseTo;
    varFromTo.add(byteFrom << 8 | byteTo);
  }
}

Fixed version (ground truth):
private void encodeVar(boolean entryOnReverseStrand,int queryLenth,final Alignments.SequenceVariation seqVar){
  final String from=seqVar.getFrom();
  final String to=seqVar.getTo();
  final int fromLength=from.length();
  final int toLength=to.length();
  final int position=seqVar.getPosition();
  varPositions.add(position);
  final int readIndex=seqVar.getReadIndex();
  final int recodedReadIndex=entryOnReverseStrand ? readIndex - (queryLenth - position) + 5 : 5 + position - readIndex;
  varReadIndex.add(recodedReadIndex);
  fromLengths.add(fromLength);
  toLengths.add(toLength);
  final int maxLength=Math.max(fromLength,toLength);
  for (int i=0; i < maxLength; i++) {
    final char baseFrom=i < fromLength ? from.charAt(i) : '\0';
    final char baseTo=i < toLength ? to.charAt(i) : '\0';
    final byte byteFrom=(byte)baseFrom;
    final byte byteTo=(byte)baseTo;
    varFromTo.add(byteFrom << 8 | byteTo);
  }
}
Program: 50321
Project: 50321
Buggy source:
private void reset(){
  multiplicityFieldsAllMissing=true;
  previousPosition=-1;
  previousTargetIndex=-1;
  deltaPositions.clear();
  deltaTargetIndices.clear();
  queryLengths.clear();
  mappingQualities.clear();
  matchingReverseStrand.clear();
  multiplicity.clear();
  numberOfIndels.clear();
  queryAlignedLengths.clear();
  targetAlignedLengths.clear();
  numberOfMismatches.clear();
  insertSizes.clear();
  queryIndices.clear();
  queryPositions.clear();
  fragmentIndices.clear();
  queryIndices.clear();
  variationCount.clear();
  varPositions.clear();
  fromLengths.clear();
  toLengths.clear();
  varReadIndex.clear();
  varFromTo.clear();
  varQuals.clear();
  varQualIndex=0;
  varPositionIndex=0;
  varFromToIndex=0;
  varToQualLength.clear();
  varToQualsLength=0;
  multiplicities.clear();
  countAggregatedWithMultiplicity=0;
  previousPartial=null;
  deltaPosIndex=0;
  pairLinks.reset();
  forwardSpliceLinks.reset();
  backwardSpliceLinks.reset();
  qualScoreIndex=0;
  numReadQualityScores.clear();
  allReadQualityScores.clear();
  sampleIndices.clear();
  readOriginIndices.clear();
  pairFlags.clear();
  scores.clear();
}

Fixed version (ground truth):
private void reset(){
  multiplicityFieldsAllMissing=true;
  previousPosition=-1;
  previousTargetIndex=-1;
  deltaPositions.clear();
  deltaTargetIndices.clear();
  queryLengths.clear();
  mappingQualities.clear();
  matchingReverseStrand.clear();
  multiplicity.clear();
  numberOfIndels.clear();
  queryAlignedLengths.clear();
  targetAlignedLengths.clear();
  numberOfMismatches.clear();
  insertSizes.clear();
  queryIndices.clear();
  queryPositions.clear();
  fragmentIndices.clear();
  queryIndices.clear();
  variationCount.clear();
  varPositions.clear();
  fromLengths.clear();
  toLengths.clear();
  varReadIndex.clear();
  varFromTo.clear();
  varQuals.clear();
  varQualIndex=0;
  varPositionIndex=0;
  varFromToIndex=0;
  varToQualLength.clear();
  varToQualLengthIndex=0;
  multiplicities.clear();
  countAggregatedWithMultiplicity=0;
  previousPartial=null;
  deltaPosIndex=0;
  pairLinks.reset();
  forwardSpliceLinks.reset();
  backwardSpliceLinks.reset();
  qualScoreIndex=0;
  numReadQualityScores.clear();
  allReadQualityScores.clear();
  sampleIndices.clear();
  readOriginIndices.clear();
  pairFlags.clear();
  scores.clear();
}
Program: 50322
Project: 50322
Buggy source:
protected final void decodeArithmetic(final String label,final int numEntriesInChunk,final InputBitStream bitInput,final IntList list) throws IOException {
  if (debug(2)) {
    System.err.flush();
    System.err.println("String_Node_Str" + label + "String_Node_Str"+ bitInput.available());
    System.err.flush();
  }
  if (numEntriesInChunk == 0) {
    return;
  }
  final int size=bitInput.readNibble();
  if (size == 0) {
    return;
  }
  final boolean hasNegatives=bitInput.readBit() == 1;
  final int numTokens=bitInput.readNibble();
  final int[] distinctvalue=new int[numTokens];
  for (int i=0; i < numTokens; i++) {
    final int nat=bitInput.readNibble() - 1;
    final int anInt=hasNegatives ? Fast.nat2int(nat) : nat;
    distinctvalue[i]=anInt;
  }
  final FastArithmeticDecoder decoder=new FastArithmeticDecoder(numTokens);
  for (int i=0; i < size; i++) {
    final int tokenValue=distinctvalue[decoder.decode(bitInput)];
    list.add(tokenValue);
  }
  decoder.reposition(bitInput);
}

Fixed version (ground truth):
protected final void decodeArithmetic(final String label,final int numEntriesInChunk,final InputBitStream bitInput,final IntList list) throws IOException {
  if (debug(2)) {
    System.err.flush();
    System.err.println("String_Node_Str" + label + "String_Node_Str"+ bitInput.available());
    System.err.flush();
  }
  if (numEntriesInChunk == 0) {
    return;
  }
  final int size=bitInput.readNibble();
  if (size == 0) {
    return;
  }
  final boolean hasNegatives=bitInput.readBit() == 1;
  final int numTokens=bitInput.readNibble();
  final int[] distinctvalue=new int[numTokens];
  for (int i=0; i < numTokens; i++) {
    final int token=bitInput.readNibble();
    final int anInt=hasNegatives ? Fast.nat2int(token) : token - 1;
    distinctvalue[i]=anInt;
  }
  if (hasNegatives) {
    Arrays.sort(distinctvalue);
  }
  final FastArithmeticDecoder decoder=new FastArithmeticDecoder(numTokens);
  for (int i=0; i < size; i++) {
    final int tokenValue=distinctvalue[decoder.decode(bitInput)];
    list.add(tokenValue);
  }
  decoder.reposition(bitInput);
}
Program: 50325
Project: 50325
Buggy source:
private void encodeVar(final Alignments.SequenceVariation seqVar){
  final String from=seqVar.getFrom();
  final String to=seqVar.getTo();
  final ByteString toQualities=seqVar.getToQuality();
  final int fromLength=from.length();
  final int toLength=to.length();
  final boolean hasToQuals=seqVar.hasToQuality();
  varPositions.add(seqVar.getPosition());
  varReadIndex.add(seqVar.getReadIndex());
  fromLengths.add(fromLength);
  toLengths.add(toLength);
  final int maxLength=Math.max(fromLength,toLength);
  for (int i=0; i < maxLength; i++) {
    final char baseFrom=i < fromLength ? from.charAt(i) : '\0';
    final char baseTo=i < toLength ? to.charAt(i) : '\0';
    final byte byteFrom=(byte)baseFrom;
    final byte byteTo=(byte)baseTo;
    varFromTo.add(byteFrom << 8 | byteTo);
  }
}

Fixed version (ground truth):
private void encodeVar(boolean entryOnReverseStrand,int queryLenth,final Alignments.SequenceVariation seqVar){
  final String from=seqVar.getFrom();
  final String to=seqVar.getTo();
  final ByteString toQualities=seqVar.getToQuality();
  final int fromLength=from.length();
  final int toLength=to.length();
  final boolean hasToQuals=seqVar.hasToQuality();
  final int position=seqVar.getPosition();
  varPositions.add(position);
  final int readIndex=seqVar.getReadIndex();
  final int recodedReadIndex=entryOnReverseStrand ? readIndex - (queryLenth - position) + 5 : 5 + position - readIndex;
  varReadIndex.add(recodedReadIndex);
  fromLengths.add(fromLength);
  toLengths.add(toLength);
  final int maxLength=Math.max(fromLength,toLength);
  for (int i=0; i < maxLength; i++) {
    final char baseFrom=i < fromLength ? from.charAt(i) : '\0';
    final char baseTo=i < toLength ? to.charAt(i) : '\0';
    final byte byteFrom=(byte)baseFrom;
    final byte byteTo=(byte)baseTo;
    varFromTo.add(byteFrom << 8 | byteTo);
  }
}
Program: 50326
Project: 50326
Buggy source:
private ObjectArrayList<Alignments.AlignmentEntry.Builder> buildEntriesCollection(AlignmentExample[] examples){
  ObjectArrayList<Alignments.AlignmentEntry.Builder> list=new ObjectArrayList<Alignments.AlignmentEntry.Builder>();
  for (  AlignmentExample entry : examples) {
    Alignments.AlignmentEntry.Builder alignmentBuilder=Alignments.AlignmentEntry.newBuilder();
    alignmentBuilder.setPosition(entry.position);
    alignmentBuilder.setMappingQuality(entry.mappingQuality);
    alignmentBuilder.setQueryIndex(entry.query_index);
    alignmentBuilder.setMatchingReverseStrand(true);
    alignmentBuilder.setTargetIndex(entry.targetIndex);
    Alignments.SequenceVariation.Builder sequenceVariation1=Alignments.SequenceVariation.newBuilder();
    sequenceVariation1.setFrom(entry.var1_from);
    sequenceVariation1.setTo(entry.var1_to);
    sequenceVariation1.setPosition(entry.var1_position);
    sequenceVariation1.setReadIndex(entry.var1_readIndex);
    alignmentBuilder.addSequenceVariations(sequenceVariation1.build());
    Alignments.SequenceVariation.Builder sequenceVariation2=Alignments.SequenceVariation.newBuilder();
    sequenceVariation2.setFrom(entry.var2_from);
    sequenceVariation2.setTo(entry.var2_to);
    sequenceVariation2.setPosition(entry.var2_position);
    sequenceVariation2.setReadIndex(entry.var2_readIndex);
    alignmentBuilder.addSequenceVariations(sequenceVariation2.build());
    list.add(alignmentBuilder);
  }
  return list;
}

Fixed version (ground truth):
private ObjectArrayList<Alignments.AlignmentEntry.Builder> buildEntriesCollection(AlignmentExample[] examples){
  ObjectArrayList<Alignments.AlignmentEntry.Builder> list=new ObjectArrayList<Alignments.AlignmentEntry.Builder>();
  for (  AlignmentExample entry : examples) {
    Alignments.AlignmentEntry.Builder alignmentBuilder=Alignments.AlignmentEntry.newBuilder();
    alignmentBuilder.setPosition(entry.position);
    alignmentBuilder.setMappingQuality(entry.mappingQuality);
    alignmentBuilder.setQueryIndex(entry.query_index);
    alignmentBuilder.setMatchingReverseStrand(true);
    alignmentBuilder.setTargetIndex(entry.targetIndex);
    alignmentBuilder.setQueryLength(1003);
    Alignments.SequenceVariation.Builder sequenceVariation1=Alignments.SequenceVariation.newBuilder();
    sequenceVariation1.setFrom(entry.var1_from);
    sequenceVariation1.setTo(entry.var1_to);
    sequenceVariation1.setPosition(entry.var1_position);
    sequenceVariation1.setReadIndex(entry.var1_readIndex);
    alignmentBuilder.addSequenceVariations(sequenceVariation1.build());
    Alignments.SequenceVariation.Builder sequenceVariation2=Alignments.SequenceVariation.newBuilder();
    sequenceVariation2.setFrom(entry.var2_from);
    sequenceVariation2.setTo(entry.var2_to);
    sequenceVariation2.setPosition(entry.var2_position);
    sequenceVariation2.setReadIndex(entry.var2_readIndex);
    alignmentBuilder.addSequenceVariations(sequenceVariation2.build());
    list.add(alignmentBuilder);
  }
  return list;
}
Program: 50327
Project: 50327
Buggy source:
private void importReadGroups(SAMFileHeader samHeader,IndexedIdentifier readGroups){
  if (samHeader.getReadGroups().size() > 0) {
    for (    SAMReadGroupRecord rg : samHeader.getReadGroups()) {
      String sample=rg.getSample();
      String library=rg.getLibrary();
      String platform=rg.getPlatform();
      String platformUnit=rg.getPlatformUnit();
      String id=rg.getId();
      int readGroupIndex=readGroups.registerIdentifier(new MutableString(id));
      Alignments.ReadOriginInfo.Builder roi=Alignments.ReadOriginInfo.newBuilder();
      roi.setOriginIndex(readGroupIndex);
      if (library != null) {
        roi.setLibrary(library);
      }
      if (platform != null) {
        roi.setPlatform(platform);
      }
      if (platformUnit != null) {
        roi.setPlatformUnit(platformUnit);
      }
      if (sample != null) {
        roi.setSample(sample);
      }
      readOriginInfoBuilderList.add(roi);
    }
  }
}

Fixed version (ground truth):
private void importReadGroups(SAMFileHeader samHeader,IndexedIdentifier readGroups){
  if (samHeader.getReadGroups().size() > 0) {
    for (    SAMReadGroupRecord rg : samHeader.getReadGroups()) {
      String sample=rg.getSample();
      String library=rg.getLibrary();
      String platform=rg.getPlatform();
      String platformUnit=rg.getPlatformUnit();
      String id=rg.getId();
      int readGroupIndex=readGroups.registerIdentifier(new MutableString(id));
      Alignments.ReadOriginInfo.Builder roi=Alignments.ReadOriginInfo.newBuilder();
      roi.setOriginIndex(readGroupIndex);
      roi.setOriginId(id);
      if (library != null) {
        roi.setLibrary(library);
      }
      if (platform != null) {
        roi.setPlatform(platform);
      }
      if (platformUnit != null) {
        roi.setPlatformUnit(platformUnit);
      }
      if (sample != null) {
        roi.setSample(sample);
      }
      readOriginInfoBuilderList.add(roi);
    }
  }
}
Program: 50328
Project: 50328
Buggy source:
public void setSource(final int queryIndex,final CharSequence sourceQuery,final CharSequence sourceQual,final CharSequence cigar,final CharSequence md,final int position,final boolean reverseStrand,int readLength){
  this.queryLength=readLength;
  if (debug && LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str");
    LOG.debug("String_Node_Str" + (position - 1));
    LOG.debug("String_Node_Str" + queryIndex);
  }
  reset();
  this.queryIndex=queryIndex;
  this.sourceQuery.setLength(0);
  if (sourceQuery != null) {
    this.sourceQuery.append(sourceQuery);
    queryLength=sourceQuery.length();
  }
  this.sourceQual.setLength(0);
  if (sourceQual != null) {
    this.sourceQual.append(sourceQual);
  }
  this.cigar.setLength(0);
  if (cigar != null) {
    this.cigar.append(cigar);
  }
  this.md.setLength(0);
  if (md != null) {
    this.md.append(md);
  }
  this.position=position - 1;
  this.reverseStrand=reverseStrand;
  constructRefAndQuery();
  findSequenceVariations();
  SamSequenceVariation.merge(sequenceVariations);
}

Fixed version (ground truth):
public void setSource(final int queryIndex,final CharSequence sourceQuery,final CharSequence sourceQual,final CharSequence cigar,final CharSequence md,final int position,final boolean reverseStrand,int readLength){
  this.queryLength=readLength;
  if (debug && LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str");
    LOG.debug("String_Node_Str" + (position - 1));
    LOG.debug("String_Node_Str" + queryIndex);
  }
  reset();
  this.queryIndex=queryIndex;
  this.sourceQuery.setLength(0);
  if (sourceQuery != null) {
    this.sourceQuery.append(sourceQuery);
    queryLength=sourceQuery.length();
  }
  this.sourceQual.setLength(0);
  if (sourceQual != null) {
    this.sourceQual.append(sourceQual);
  }
  this.cigar.setLength(0);
  if (cigar != null) {
    this.cigar.append(cigar);
  }
  this.md.setLength(0);
  if (md != null) {
    this.md.append(md);
    this.md.toUpperCase();
  }
  this.position=position - 1;
  this.reverseStrand=reverseStrand;
  constructRefAndQuery();
  findSequenceVariations();
  SamSequenceVariation.merge(sequenceVariations);
}