nus-yam/ex-repair huggingface dataset:
Program: 50329
Project: 50329
Buggy source:
private void applyMd(){
  if (debug && LOG.isDebugEnabled()) {
    LOG.debug(String.format("String_Node_Str",md));
  }
  int position=numLeftClipped;
  Matcher matcher=MD_REGEX.matcher(md);
  while (matcher.find()) {
    String mdPart=matcher.group();
    if (NUMERIC_REGEX.matcher(mdPart).matches()) {
      int length=Integer.parseInt(mdPart);
      position+=length;
    }
 else     if (mdPart.charAt(0) == '^') {
      for (int i=1; i < mdPart.length(); i++) {
        ref.setCharAt(position++,mdPart.charAt(i));
      }
    }
 else {
      for (int i=0; i < mdPart.length(); i++) {
        ref.setCharAt(position++,Character.toLowerCase(mdPart.charAt(i)));
        numMisMatches++;
      }
    }
  }
}

Fixed version (ground truth):
private void applyMd(){
  if (debug && LOG.isDebugEnabled()) {
    LOG.debug(String.format("String_Node_Str",md));
  }
  int position=numLeftClipped;
  final Matcher matcher=MD_REGEX.matcher(md);
  while (matcher.find()) {
    final String mdPart=matcher.group();
    if (NUMERIC_REGEX.matcher(mdPart).matches()) {
      try {
        final int length=Integer.parseInt(mdPart);
        position+=length;
      }
 catch (      NumberFormatException e) {
        System.out.println("String_Node_Str");
      }
    }
 else     if (mdPart.charAt(0) == '^') {
      for (int i=1; i < mdPart.length(); i++) {
        ref.setCharAt(position++,mdPart.charAt(i));
      }
    }
 else {
      for (int i=0; i < mdPart.length(); i++) {
        ref.setCharAt(position++,Character.toLowerCase(mdPart.charAt(i)));
        numMisMatches++;
      }
    }
  }
}
Program: 50330
Project: 50330
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':
positionInRead+=readBasesLength;
position+=readBasesLength;
break;
case 'D':
for (int j=0; j < readBasesLength; j++) {
refSequence.insert(position - initialRefPosition,'?');
}
break;
case 'S':
try {
for (int j=0; j < readBasesLength; j++) {
final int index=position - initialRefPosition;
if (index >= refSequence.length()) break;
refSequence.insert(index,'-');
}
}
 catch (StringIndexOutOfBoundsException e) {
System.out.println("String_Node_Str");
}
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':
positionInRead+=readBasesLength;
position+=readBasesLength;
break;
case 'D':
insertSomeInRef(position,initialRefPosition,readBasesLength);
break;
case 'S':
insertSomeInRef(position,initialRefPosition,readBasesLength);
break;
default :
positionInRead+=readBasesLength;
position+=readBasesLength;
break;
}
cigarIndex+=cigarLength;
}
list.add(new Limits(previousPosition,previousCigarIndex,cigarIndex,previousPositionInRead,positionInRead,previousPosition,position));
}
Program: 50331
Project: 50331
Buggy source:
/** 
 * Configure.
 * @param args command line arguments
 * @return this object for chaining
 * @throws java.io.IOException error parsing
 * @throws com.martiansoftware.jsap.JSAPException error parsing
 */
@Override public AbstractCommandLineMode configure(final String[] args) throws IOException, JSAPException {
  super.configure(args);
  final JSAPResult jsapResult=parseJsapArguments(args);
  bsmap=jsapResult.getBoolean("String_Node_Str");
  String genomeFilename=jsapResult.getString("String_Node_Str");
  if (genomeFilename != null) {
    System.err.println("String_Node_Str" + genomeFilename);
    genome=new DualRandomAccessSequenceCache();
    try {
      genome.load(genomeFilename);
    }
 catch (    ClassNotFoundException e) {
      System.err.println("String_Node_Str");
      System.exit(1);
    }
    System.err.println("String_Node_Str");
  }
  numberOfReadsFromCommandLine=jsapResult.getInt("String_Node_Str");
  qualityEncoding=QualityEncoding.valueOf(jsapResult.getString("String_Node_Str").toUpperCase());
  sortedInput=jsapResult.getBoolean("String_Node_Str");
  this.largestQueryIndex=numberOfReadsFromCommandLine;
  this.smallestQueryIndex=0;
  debug=Util.log4JIsConfigured();
  DynamicOptionRegistry.register(MessageChunksWriter.doc());
  DynamicOptionRegistry.register(AlignmentWriter.doc());
  DynamicOptionRegistry.register(QueryIndexPermutation.doc());
  return this;
}

Fixed version (ground truth):
/** 
 * Configure.
 * @param args command line arguments
 * @return this object for chaining
 * @throws java.io.IOException error parsing
 * @throws com.martiansoftware.jsap.JSAPException error parsing
 */
@Override public AbstractCommandLineMode configure(final String[] args) throws IOException, JSAPException {
  super.configure(args);
  final JSAPResult jsapResult=parseJsapArguments(args);
  bsmap=jsapResult.getBoolean("String_Node_Str");
  String genomeFilename=jsapResult.getString("String_Node_Str");
  if (genomeFilename != null) {
    System.err.println("String_Node_Str" + genomeFilename);
    DualRandomAccessSequenceCache aGenome=new DualRandomAccessSequenceCache();
    try {
      aGenome.load(genomeFilename);
      genome=aGenome;
    }
 catch (    ClassNotFoundException e) {
      System.err.println("String_Node_Str");
      System.exit(1);
    }
    System.err.println("String_Node_Str");
  }
  numberOfReadsFromCommandLine=jsapResult.getInt("String_Node_Str");
  qualityEncoding=QualityEncoding.valueOf(jsapResult.getString("String_Node_Str").toUpperCase());
  sortedInput=jsapResult.getBoolean("String_Node_Str");
  this.largestQueryIndex=numberOfReadsFromCommandLine;
  this.smallestQueryIndex=0;
  debug=Util.log4JIsConfigured();
  DynamicOptionRegistry.register(MessageChunksWriter.doc());
  DynamicOptionRegistry.register(AlignmentWriter.doc());
  DynamicOptionRegistry.register(QueryIndexPermutation.doc());
  return this;
}
Program: 50332
Project: 50332
Buggy source:
/** 
 * Adjust reference names to match genome.
 * @param genome
 * @param referenceName
 * @return
 */
private final String map(DualRandomAccessSequenceCache genome,final String referenceName){
  if (genome.getReferenceIndex(referenceName) == -1) {
    if (referenceName.contentEquals("String_Node_Str")) {
      return "String_Node_Str";
    }
    if (referenceName.startsWith("String_Node_Str")) {
      return referenceName.substring(3);
    }
 else {
      return referenceName;
    }
  }
 else {
    return referenceName;
  }
}

Fixed version (ground truth):
/** 
 * Adjust reference names to match genome.
 * @param genome
 * @param referenceName
 * @return
 */
private final String map(RandomAccessSequenceInterface genome,final String referenceName){
  if (genome.getReferenceIndex(referenceName) == -1) {
    if (referenceName.contentEquals("String_Node_Str")) {
      return "String_Node_Str";
    }
    if (referenceName.startsWith("String_Node_Str")) {
      return referenceName.substring(3);
    }
 else {
      return referenceName;
    }
  }
 else {
    return referenceName;
  }
}
Program: 50334
Project: 50334
Buggy source:
/** 
 * @param queryIndex
 * @param sourceQuery
 * @param sourceQual
 * @param cigar
 * @param md
 * @param position      one-based position
 * @param reverseStrand
 */
public void setSource(final int queryIndex,final CharSequence sourceQuery,final CharSequence sourceQual,final CharSequence cigar,final CharSequence md,final int position,final boolean reverseStrand){
  final String cigarString=cigar.toString();
  if (!cigarString.contains(N_STRING)) {
    numEntries=1;
    cursorIndex=0;
    initializeHelpers();
    helpers.get(0).setSource(queryIndex,sourceQuery,sourceQual,cigar,md,position,reverseStrand);
  }
 else {
    final Limits[] limits=getLimits(position,cigarString,md);
    numEntries=limits.length;
    initializeHelpers();
    for (int i=0; i < numEntries; i++) {
      final Limits limit=limits[i];
      helpers.get(i).setSource(queryIndex,sourceQuery.subSequence(limit.readStart,limit.readEnd),sourceQual.subSequence(limit.readStart,limit.readEnd),cigarString.substring(limit.cigarStart,limit.cigarEnd),limit.md,limit.position + 1,reverseStrand);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param queryIndex
 * @param sourceQuery
 * @param sourceQual
 * @param cigar
 * @param md
 * @param position      one-based position
 * @param reverseStrand
 */
public void setSource(final int queryIndex,final CharSequence sourceQuery,final CharSequence sourceQual,final CharSequence cigar,final CharSequence md,final int position,final boolean reverseStrand){
  final String cigarString=cigar.toString();
  if (!cigarString.contains(N_STRING)) {
    numEntries=1;
    cursorIndex=0;
    initializeHelpers();
    helpers.get(0).setSource(queryIndex,sourceQuery,sourceQual,cigar,md,position,reverseStrand);
  }
 else {
    final Limits[] limits=getLimits(position,cigarString,md);
    numEntries=limits.length;
    initializeHelpers();
    for (int i=0; i < numEntries; i++) {
      final Limits limit=limits[i];
      helpers.get(i).setSource(queryIndex,sourceQuery.subSequence(limit.readStart,limit.readEnd),sourceQual.subSequence(limit.readStart,limit.readEnd),cigarString.substring(limit.cigarStart,limit.cigarEnd),limit.md,limit.position,reverseStrand);
    }
  }
}
Program: 50335
Project: 50335
Buggy source:
public void setSourceWithReference(final int queryIndex,final SAMRecord samRecord,final String sourceReference){
  final String cigarString=samRecord.getCigarString();
  if (!cigarString.contains(N_STRING)) {
    numEntries=1;
    cursorIndex=0;
    initializeHelpers();
    helpers.get(0).setSourceWithReference(queryIndex,samRecord,sourceReference);
  }
 else {
    final CharSequence sourceQuery=samRecord.getReadString();
    final CharSequence sourceQual=samRecord.getBaseQualityString();
    final int position=samRecord.getAlignmentStart();
    final boolean reverseStrand=samRecord.getReadNegativeStrandFlag();
    refSequence.append(sourceReference);
    final Limits[] limits=getLimits(position,cigarString,"String_Node_Str");
    numEntries=limits.length;
    initializeHelpers();
    for (int i=0; i < numEntries; i++) {
      final Limits limit=limits[i];
      final int refStartIndex=limit.refStart - position;
      final int refEndIndex=refStartIndex + limit.refEnd - limit.refStart;
      try {
        helpers.get(i).setSourceWithReference(queryIndex,refSequence.subSequence(refStartIndex,Math.min(refEndIndex,sourceReference.length() - 1)),sourceQuery.subSequence(limit.readStart,limit.readEnd),sourceQual.subSequence(limit.readStart,limit.readEnd),limit.position + 1,reverseStrand);
      }
 catch (      IndexOutOfBoundsException e) {
        System.out.printf("String_Node_Str",refStartIndex,refEndIndex,sourceReference.length(),samRecord.getCigarString(),e);
      }
    }
  }
}

Fixed version (ground truth):
public void setSourceWithReference(final int queryIndex,final SAMRecord samRecord,final String sourceReference){
  final String cigarString=samRecord.getCigarString();
  final int position=samRecord.getAlignmentStart();
  refSequence.append(sourceReference);
  final Limits[] limits=getLimits(position,cigarString,null);
  final CharSequence sourceQuery=samRecord.getReadString();
  final CharSequence sourceQual=samRecord.getBaseQualityString();
  final boolean reverseStrand=samRecord.getReadNegativeStrandFlag();
  numEntries=limits.length;
  initializeHelpers();
  for (int i=0; i < numEntries; i++) {
    final Limits limit=limits[i];
    final int refStartIndex=limit.refStart - position;
    final int refEndIndex=refStartIndex + limit.refEnd - limit.refStart;
    try {
      final CharSequence sourceRef=refSequence.subSequence(refStartIndex,Math.min(refEndIndex,sourceReference.length() - 1));
      helpers.get(i).setSourceWithReference(queryIndex,sourceRef,sourceQuery.subSequence(limit.readStart,limit.readEnd),sourceQual.subSequence(limit.readStart,limit.readEnd),limit.position,reverseStrand);
    }
 catch (    IndexOutOfBoundsException e) {
      System.out.printf("String_Node_Str",refStartIndex,refEndIndex,sourceReference.length(),samRecord.getCigarString(),e);
    }
  }
}
Program: 50336
Project: 50336
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':
positionInRead+=readBasesLength;
position+=readBasesLength;
break;
case 'D':
positionInRead+=0;
position+=0;
break;
case 'S':
for (int j=0; j < readBasesLength; j++) {
refSequence.insert(position - initialRefPosition,'-');
}
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':
positionInRead+=readBasesLength;
position+=readBasesLength;
break;
case 'D':
for (int j=0; j < readBasesLength; j++) {
refSequence.insert(position - initialRefPosition,'?');
}
break;
case 'S':
try {
for (int j=0; j < readBasesLength; j++) {
final int index=position - initialRefPosition;
if (index >= refSequence.length()) break;
refSequence.insert(index,'-');
}
}
 catch (StringIndexOutOfBoundsException e) {
System.out.println("String_Node_Str");
}
break;
default :
positionInRead+=readBasesLength;
position+=readBasesLength;
break;
}
cigarIndex+=cigarLength;
}
list.add(new Limits(previousPosition,previousCigarIndex,cigarIndex,previousPositionInRead,positionInRead,previousPosition,position));
}
Program: 50337
Project: 50337
Buggy source:
private boolean isForward(final Alignments.AlignmentEntry.Builder entry,final Alignments.RelatedAlignmentEntry pairAlignmentLink){
  final int targetIndex=entry.getTargetIndex();
  final int position=entry.getPosition();
  final int linkedTargetIndex=pairAlignmentLink.getTargetIndex();
  final int linkedPosition=pairAlignmentLink.getPosition();
  if (linkedTargetIndex == targetIndex) {
    return linkedPosition > position;
  }
 else {
    return linkedTargetIndex > targetIndex;
  }
}

Fixed version (ground truth):
private boolean isForward(final Alignments.AlignmentEntry.Builder entry,final Alignments.RelatedAlignmentEntry pairAlignmentLink){
  final int targetIndex=entry.getTargetIndex();
  final int position=entry.getPosition();
  final int linkedTargetIndex=pairAlignmentLink.getTargetIndex();
  final int linkedPosition=pairAlignmentLink.getPosition();
  if (linkedTargetIndex == targetIndex) {
    return linkedPosition >= position;
  }
 else {
    return linkedTargetIndex > targetIndex;
  }
}
Program: 50340
Project: 50340
Buggy source:
/** 
 * Main method.
 * @param args command line args.
 * @throws com.martiansoftware.jsap.JSAPException error parsing
 * @throws java.io.IOException error parsing or executing.
 */
public static void main(final String[] args) throws JSAPException, IOException {
  new SAMToCompactMode().configure(args).execute();
}

Fixed version (ground truth):
/** 
 * Main method.
 * @param args command line args.
 * @throws com.martiansoftware.jsap.JSAPException error parsing
 * @throws java.io.IOException error parsing or executing.
 */
public static void main(final String[] args) throws JSAPException, IOException {
  final SAMToCompactMode processor=new SAMToCompactMode();
  processor.configure(args);
  processor.runningFromCommandLine=true;
  processor.execute();
}
Program: 50343
Project: 50343
Buggy source:
public void setQueryIdentifiers(final IndexedIdentifier queryIdentifiers){
  this.queryIdentifiers=queryIdentifiers;
  for (  final int index : queryIdentifiers.values()) {
    int permIndex=permutator.permutate(index);
    maxQueryIndex=Math.max(maxQueryIndex,index);
  }
}

Fixed version (ground truth):
public void setQueryIdentifiers(final IndexedIdentifier queryIdentifiers){
  this.queryIdentifiers=queryIdentifiers;
  for (  final int index : queryIdentifiers.values()) {
    permutator.permutate(index,2);
  }
}
Program: 50344
Project: 50344
Buggy source:
public PermutationWriter(final String basename){
  this.basename=AlignmentReaderImpl.getBasename(basename);
  DataOutputStream o=null;
  try {
    o=new DataOutputStream(new FastBufferedOutputStream(new FileOutputStream(basename + "String_Node_Str")));
  }
 catch (  FileNotFoundException e) {
    LOG.error(e);
    o=null;
  }
  output=o;
}

Fixed version (ground truth):
public PermutationWriter(final String basename){
}
Program: 50346
Project: 50346
Buggy source:
public void setMinQualValue(final byte minQualValue){
  this.minQualValue=minQualValue;
}

Fixed version (ground truth):
public void setMinQualValue(final char minQualValue){
  this.minQualValue=(byte)minQualValue;
}
Program: 50349
Project: 50349
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 int length=from.length();
    final boolean hasToQuals=seqVar.hasToQuality();
    varHasToQuals.add(hasToQuals ? 1 : 0);
    for (int i=0; i < length; i++) {
      if (hasToQuals && i < toQualities.size()) {
        varQuals.add(toQualities.byteAt(i));
      }
 else {
        varQuals.add(NO_VALUE);
      }
    }
    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.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 int length=from.length();
    final boolean hasToQuals=seqVar.hasToQuality();
    varHasToQuals.add(hasToQuals ? 1 : 0);
    for (int i=0; i < length; i++) {
      if (hasToQuals && i < toQualities.size()) {
        varQuals.add(toQualities.byteAt(i));
      }
    }
    Alignments.SequenceVariation.Builder varBuilder=Alignments.SequenceVariation.newBuilder(seqVar);
    varBuilder.clearToQuality();
    result.setSequenceVariations(index,varBuilder.buildPartial());
    index++;
  }
}
Program: 50350
Project: 50350
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());
  varPositionIndex++;
  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(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);
  }
}
Program: 50351
Project: 50351
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();
  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;
  varHasToQuals.clear();
  multiplicities.clear();
  countAggregatedWithMultiplicity=0;
  previousPartial=null;
  deltaPosIndex=0;
  pairLinks.reset();
  forwardSpliceLinks.reset();
  backwardSpliceLinks.reset();
}

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();
  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;
  varHasToQuals.clear();
  varHasToQualsIndex=0;
  multiplicities.clear();
  countAggregatedWithMultiplicity=0;
  previousPartial=null;
  deltaPosIndex=0;
  pairLinks.reset();
  forwardSpliceLinks.reset();
  backwardSpliceLinks.reset();
}
Program: 50352
Project: 50352
Buggy source:
private Alignments.AlignmentCollection.Builder loadCollection(String filename,int firstElementToLoad,int maxElementsToLoad) throws IOException {
  final Alignments.AlignmentCollection.Builder collectionBuilder=Alignments.AlignmentCollection.newBuilder();
  AlignmentReaderImpl reader=new AlignmentReaderImpl(filename);
  QueryIndexPermutation permutator=new QueryIndexPermutationImpl();
  try {
    int counter=0;
    for (    Alignments.AlignmentEntry entry : reader) {
      if (counter >= firstElementToLoad) {
        collectionBuilder.addAlignmentEntries(permutator.makeSmallIndices(entry));
        if (counter++ > maxElementsToLoad) {
          break;
        }
      }
    }
    return collectionBuilder;
  }
  finally {
    reader.close();
  }
}

Fixed version (ground truth):
private Alignments.AlignmentCollection.Builder loadCollection(String filename,int firstElementToLoad,int maxElementsToLoad) throws IOException {
  final Alignments.AlignmentCollection.Builder collectionBuilder=Alignments.AlignmentCollection.newBuilder();
  AlignmentReaderImpl reader=new AlignmentReaderImpl(filename);
  QueryIndexPermutation permutator=new QueryIndexPermutationImpl();
  try {
    int counter=0;
    for (    Alignments.AlignmentEntry entry : reader) {
      if (counter >= firstElementToLoad) {
        collectionBuilder.addAlignmentEntries(permutator.makeSmallIndices(entry));
        if (counter > maxElementsToLoad) {
          break;
        }
      }
      counter++;
    }
    return collectionBuilder;
  }
  finally {
    reader.close();
  }
}
Program: 50353
Project: 50353
Buggy source:
public void roundTripPairedEnd() throws IOException {
  final AlignmentChunkCodec1 codec=new AlignmentChunkCodec1();
  codec.setHandler(new AlignmentCollectionHandler());
  Alignments.AlignmentCollection.Builder collection=loadCollection("String_Node_Str",0,1000);
  assertRoundTripMatchExpected(codec,collection);
}

Fixed version (ground truth):
public void roundTripPairedEnd() throws IOException {
  final AlignmentChunkCodec1 codec=new AlignmentChunkCodec1();
  codec.setHandler(new AlignmentCollectionHandler());
  Alignments.AlignmentCollection.Builder collection=loadCollection("String_Node_Str",600,700);
  assertRoundTripMatchExpected(codec,collection);
}
Program: 50354
Project: 50354
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();
  decompressBits(bitInput,numEntriesInChunk);
  int originalIndex=0;
  for (int templateIndex=0; templateIndex < numEntriesInChunk; templateIndex++) {
    final int templatePositionIndex=varPositionIndex;
    final int templateVarFromToIndex=varFromToIndex;
    while (multiplicities.get(templateIndex) >= 1) {
      result.addAlignmentEntries(andBack(templateIndex,originalIndex,alignmentCollection.getAlignmentEntries(templateIndex)));
      if (multiplicities.get(templateIndex) >= 1) {
        varPositionIndex=templatePositionIndex;
        varFromToIndex=templateVarFromToIndex;
      }
      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();
  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)));
      if (multiplicities.get(templateIndex) >= 1) {
        varPositionIndex=templatePositionIndex;
        varFromToIndex=templateVarFromToIndex;
        varToQualsLength=templateVarHasToQualsIndex;
      }
      originalIndex++;
    }
  }
  ++chunkIndex;
  return result.build();
}
Program: 50355
Project: 50355
Buggy source:
private void writeCompressed(final OutputBitStream out) throws IOException {
  out.writeBit(multiplicityFieldsAllMissing);
  writeArithmetic("String_Node_Str",deltaPositions,out);
  writeArithmetic("String_Node_Str",deltaTargetIndices,out);
  writeArithmetic("String_Node_Str",queryLengths,out);
  writeArithmetic("String_Node_Str",mappingQualities,out);
  writeArithmetic("String_Node_Str",matchingReverseStrand,out);
  writeArithmetic("String_Node_Str",numberOfIndels,out);
  writeArithmetic("String_Node_Str",numberOfMismatches,out);
  writeArithmetic("String_Node_Str",queryAlignedLengths,out);
  writeArithmetic("String_Node_Str",targetAlignedLengths,out);
  writeArithmetic("String_Node_Str",queryPositions,out);
  writeArithmetic("String_Node_Str",fragmentIndices,out);
  writeArithmetic("String_Node_Str",variationCount,out);
  writeArithmetic("String_Node_Str",varPositions,out);
  writeArithmetic("String_Node_Str",fromLengths,out);
  writeArithmetic("String_Node_Str",toLengths,out);
  writeArithmetic("String_Node_Str",varReadIndex,out);
  writeArithmetic("String_Node_Str",varFromTo,out);
  writeArithmetic("String_Node_Str",varQuals,out);
  writeArithmetic("String_Node_Str",varHasToQuals,out);
  writeArithmetic("String_Node_Str",multiplicities,out);
  pairLinks.write(out);
  forwardSpliceLinks.write(out);
  backwardSpliceLinks.write(out);
  writeQueryIndices("String_Node_Str",queryIndices,out);
}

Fixed version (ground truth):
private void writeCompressed(final OutputBitStream out) throws IOException {
  out.writeBit(multiplicityFieldsAllMissing);
  writeArithmetic("String_Node_Str",deltaPositions,out);
  writeArithmetic("String_Node_Str",deltaTargetIndices,out);
  writeArithmetic("String_Node_Str",queryLengths,out);
  writeArithmetic("String_Node_Str",mappingQualities,out);
  writeArithmetic("String_Node_Str",matchingReverseStrand,out);
  writeArithmetic("String_Node_Str",numberOfIndels,out);
  writeArithmetic("String_Node_Str",numberOfMismatches,out);
  writeArithmetic("String_Node_Str",queryAlignedLengths,out);
  writeArithmetic("String_Node_Str",targetAlignedLengths,out);
  writeArithmetic("String_Node_Str",queryPositions,out);
  writeArithmetic("String_Node_Str",fragmentIndices,out);
  writeArithmetic("String_Node_Str",variationCount,out);
  writeArithmetic("String_Node_Str",varPositions,out);
  writeArithmetic("String_Node_Str",fromLengths,out);
  writeArithmetic("String_Node_Str",toLengths,out);
  writeArithmetic("String_Node_Str",varReadIndex,out);
  writeArithmetic("String_Node_Str",varFromTo,out);
  writeArithmetic("String_Node_Str",varQuals,out);
  writeArithmetic("String_Node_Str",varToQualLength,out);
  writeArithmetic("String_Node_Str",multiplicities,out);
  pairLinks.write(out);
  forwardSpliceLinks.write(out);
  backwardSpliceLinks.write(out);
  writeQueryIndices("String_Node_Str",queryIndices,out);
}
Program: 50357
Project: 50357
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 int length=from.length();
    final boolean hasToQuals=seqVar.hasToQuality();
    varHasToQuals.add(hasToQuals ? 1 : 0);
    for (int i=0; i < length; i++) {
      if (hasToQuals && i < toQualities.size()) {
        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.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++;
  }
}
Program: 50358
Project: 50358
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();
  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;
  varHasToQuals.clear();
  varHasToQualsIndex=0;
  multiplicities.clear();
  countAggregatedWithMultiplicity=0;
  previousPartial=null;
  deltaPosIndex=0;
  pairLinks.reset();
  forwardSpliceLinks.reset();
  backwardSpliceLinks.reset();
}

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();
  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();
}
Program: 50361
Project: 50361
Buggy source:
private int writeFisherColumn(int i,int j,GroupComparison comparison,String context) throws IOException {
  StringBuilder comparisonName=new StringBuilder();
  comparisonName.append("String_Node_Str");
  comparisonName.append(comparison.nameGroup1);
  comparisonName.append("String_Node_Str");
  comparisonName.append(comparison.nameGroup2);
  comparisonName.append("String_Node_Str");
  if (!aggregateAllContexts) {
    comparisonName.append("String_Node_Str");
    comparisonName.append(context);
    comparisonName.append("String_Node_Str");
  }
  outputWriter.append(comparisonName.toString());
  if (i == groupComparisons.size() & j == contexts.length) {
    outputWriter.append('\n');
  }
 else {
    outputWriter.append('\t');
  }
  j++;
  return j;
}

Fixed version (ground truth):
private int writeFisherColumn(int i,int j,GroupComparison comparison,String context) throws IOException {
  StringBuilder comparisonName=new StringBuilder();
  comparisonName.append("String_Node_Str");
  comparisonName.append(comparison.nameGroup1);
  comparisonName.append("String_Node_Str");
  comparisonName.append(comparison.nameGroup2);
  comparisonName.append("String_Node_Str");
  if (!aggregateAllContexts) {
    comparisonName.append("String_Node_Str");
    comparisonName.append(context);
    comparisonName.append("String_Node_Str");
  }
  outputWriter.append(comparisonName.toString());
  if (i == groupComparisons.size() & j == contexts.length * groupComparisons.size()) {
    outputWriter.append('\n');
  }
 else {
    outputWriter.append('\t');
  }
  j++;
  return j;
}
Program: 50363
Project: 50363
Buggy source:
/** 
 * Load and sort annotations by their start position.
 * @param annotReader
 * @throws java.io.IOException
 */
public void loadAnnotations(final Reader annotReader) throws IOException {
  final ObjectArrayList<Annotation> result=new ObjectArrayList<Annotation>();
  final Object2ObjectMap<String,ObjectList<Annotation>> map=CompactAlignmentToAnnotationCountsMode.readAnnotations(annotReader);
  for (int referenceIndex=0; referenceIndex < genome.size(); referenceIndex++) {
    final ObjectList<Annotation> list=map.get(genome.getReferenceName(referenceIndex));
    Collections.sort(list,compareAnnotationStart);
    result.addAll(list);
  }
  annotations=new Annotation[result.size()];
  result.toArray(annotations);
}

Fixed version (ground truth):
/** 
 * Load and sort annotations by their start position.
 * @param annotReader
 * @throws java.io.IOException
 */
public void loadAnnotations(final Reader annotReader) throws IOException {
  final ObjectArrayList<Annotation> result=new ObjectArrayList<Annotation>();
  final Object2ObjectMap<String,ObjectList<Annotation>> map=CompactAlignmentToAnnotationCountsMode.readAnnotations(annotReader);
  for (int referenceIndex=0; referenceIndex < genome.size(); referenceIndex++) {
    final ObjectList<Annotation> list=map.get(genome.getReferenceName(referenceIndex));
    if (list != null) {
      Collections.sort(list,compareAnnotationStart);
      result.addAll(list);
    }
  }
  annotations=new Annotation[result.size()];
  result.toArray(annotations);
}
Program: 50364
Project: 50364
Buggy source:
/** 
 * This method sets the annotationIndex to the index of the first occurrence of annotations on this chromosome
 * @param refIndex
 */
public void advanceToChromosome(int refIndex){
  while (hasMoreAnnotations()) {
    final Annotation ann=nextAnnotation();
    if (chromosome1StrictlyBefore2(genome.getReferenceIndex(ann.getChromosome()),refIndex)) {
      advanceToNextAnnotation();
    }
 else {
      if (chromosome1StrictlyBefore2(refIndex,genome.getReferenceIndex(ann.getChromosome()))) {
        annotationIndex-=1;
        break;
      }
 else {
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * This method sets the annotationIndex to the index of the first occurrence of annotations on this chromosome
 * @param refIndex
 */
public void advanceToChromosome(int refIndex){
  while (hasMoreAnnotations()) {
    final Annotation ann=nextAnnotation();
    if (chromosome1StrictlyBefore2(genome.getReferenceIndex(ann.getChromosome()),refIndex)) {
      advanceToNextAnnotation();
    }
 else {
      if (chromosome1StrictlyBefore2(refIndex,genome.getReferenceIndex(ann.getChromosome()))) {
        annotationIndex-=1;
        annotationIndex=Math.max(0,annotationIndex);
        break;
      }
 else {
        break;
      }
    }
  }
}
Program: 50366
Project: 50366
Buggy source:
private void methylFormat(MethylationRateVCFOutputFormat formatter){
  int tmp=minimumVariationSupport;
  this.minimumVariationSupport=-1;
  this.thresholdDistinctReadIndices=1;
  ((MethylationRateVCFOutputFormat)formatter).setMinimumEventThreshold(tmp);
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
private void methylFormat(MethylationFormat formatter){
  int tmp=minimumVariationSupport;
  this.minimumVariationSupport=-1;
  this.thresholdDistinctReadIndices=1;
  formatter.setMinimumEventThreshold(tmp);
  System.out.println("String_Node_Str");
}
Program: 50368
Project: 50368
Buggy source:
@Override public void writeRecord(final DiscoverVariantIterateSortedAlignments iterator,final SampleCountInfo[] sampleCounts,final int referenceIndex,int position,final ObjectArrayList<PositionBaseInfo> list,final int groupIndexA,final int groupIndexB){
  position=position + 1;
  fillVariantCountArrays(sampleCounts);
  CharSequence currentReferenceId=iterator.getReferenceId(referenceIndex);
  statsWriter.setId("String_Node_Str");
  statsWriter.setInfo(biomartFieldIndex,String.format("String_Node_Str",currentReferenceId,position,position));
  statsWriter.setChromosome(currentReferenceId);
  statsWriter.setPosition(position);
  writeGenotypes(statsWriter,sampleCounts,position);
  writeZygozity(sampleCounts);
  if (!alleleSet.isEmpty()) {
    statsWriter.writeRecord();
  }
}

Fixed version (ground truth):
@Override public void writeRecord(final DiscoverVariantIterateSortedAlignments iterator,final SampleCountInfo[] sampleCounts,final int referenceIndex,int position,final ObjectArrayList<PositionBaseInfo> list,final int groupIndexA,final int groupIndexB){
  position=position + 1;
  fillVariantCountArrays(sampleCounts);
  CharSequence currentReferenceId=iterator.getReferenceId(referenceIndex);
  statsWriter.setId("String_Node_Str");
  statsWriter.setInfo(biomartFieldIndex,String.format("String_Node_Str",currentReferenceId,position,position));
  statsWriter.setChromosome(currentReferenceId);
  statsWriter.setPosition(position);
  int location=8930369;
  if (position == location || position - 1 == location || position + 1 == location) {
    System.out.println("String_Node_Str");
  }
  writeGenotypes(statsWriter,sampleCounts,position);
  writeZygozity(sampleCounts);
  if (!alleleSet.isEmpty()) {
    statsWriter.writeRecord();
  }
}
Program: 50371
Project: 50371
Buggy source:
private String convertCode(String genotypeCode,VCFParser parser,String ref,String alts){
  String[] tokens=genotypeCode.split("String_Node_Str");
  buffer.setLength(0);
  String[] altArray=alts.split("String_Node_Str");
  list.clear();
  for (  String token : tokens) {
    try {
      if ("String_Node_Str".equals(token)) {
        return "String_Node_Str";
      }
      int index=Integer.parseInt(token);
      if (index == 0) {
        list.add("String_Node_Str");
      }
 else {
        list.add(altArray[index - 1]);
      }
    }
 catch (    NumberFormatException e) {
      LOG.info("String_Node_Str" + genotypeCode);
      return "String_Node_Str";
    }
  }
  Collections.sort(list);
  for (  String allele : list) {
    buffer.append(allele);
    buffer.append('/');
  }
  return buffer.toString();
}

Fixed version (ground truth):
private String convertCode(String genotypeCode,VCFParser parser,String ref,String alts){
  String[] tokens=genotypeCode.split("String_Node_Str");
  buffer.setLength(0);
  String[] altArray=alts.split("String_Node_Str");
  list.clear();
  for (  String token : tokens) {
    try {
      if ("String_Node_Str".equals(token)) {
        return "String_Node_Str";
      }
      int index=Integer.parseInt(token);
      if (index == 0) {
        list.add("String_Node_Str");
      }
 else {
        list.add(altArray[index - 1]);
      }
    }
 catch (    NumberFormatException e) {
      LOG.info("String_Node_Str" + genotypeCode);
      return "String_Node_Str" + genotypeCode;
    }
  }
  Collections.sort(list);
  for (  String allele : list) {
    buffer.append(allele);
    buffer.append('/');
  }
  return buffer.toString();
}
Program: 50373
Project: 50373
Buggy source:
public Alignments.AlignmentEntry skipTo(int targetIndex,int position) throws IOException {
  if (possibleEntry != null) {
    if (possibleEntry.getTargetIndex() >= targetIndex && possibleEntry.getPosition() >= position) {
      return possibleEntry;
    }
 else {
      possibleEntry=null;
    }
  }
  while (possibleEntry == null) {
    possibleEntry=delegate.skipTo(targetIndex,position);
    if (possibleEntry == null) {
      return null;
    }
    if (!ambiguousQueryIndices.get(possibleEntry.getQueryIndex())) {
      final Alignments.AlignmentEntry tmp=possibleEntry;
      possibleEntry=null;
      return tmp;
    }
  }
  return null;
}

Fixed version (ground truth):
public Alignments.AlignmentEntry skipTo(int targetIndex,int position) throws IOException {
  if (possibleEntry != null) {
    if (possibleEntry.getTargetIndex() >= targetIndex && possibleEntry.getPosition() >= position) {
      return possibleEntry;
    }
 else {
      possibleEntry=null;
    }
  }
  while (possibleEntry == null) {
    possibleEntry=delegate.skipTo(targetIndex,position);
    if (possibleEntry == null) {
      return null;
    }
    if (!ambiguousQueryIndices.get(possibleEntry.getQueryIndex())) {
      final Alignments.AlignmentEntry tmp=possibleEntry;
      possibleEntry=null;
      return tmp;
    }
 else {
      possibleEntry=null;
    }
  }
  return null;
}
Program: 50374
Project: 50374
Buggy source:
/** 
 * Return true if the basename is on the command line as an input basename.
 * @param basename
 * @return
 */
private boolean isInputBasename(final String basename,final String[] inputFilenames){
  for (  final String inputFilename : inputFilenames) {
    if (FilenameUtils.getBaseName(AlignmentReaderImpl.getBasename(inputFilename)).equals(basename)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Return true if the basename is on the command line as an input basename.
 * @param basename
 * @param inputFilenames
 * @return
 */
private boolean isInputBasename(final String basename,final String[] inputFilenames){
  for (  final String inputFilename : inputFilenames) {
    if (FilenameUtils.getBaseName(AlignmentReaderImpl.getBasename(inputFilename)).equals(basename)) {
      return true;
    }
  }
  return false;
}
Program: 50375
Project: 50375
Buggy source:
public String[] getGroupComparison(){
  String[] result=new String[2];
  GroupComparison val=groupComparisons.get(0);
  result[0]=val.nameGroup1;
  result[1]=val.nameGroup1;
  return result;
}

Fixed version (ground truth):
public String[] getGroupComparison(){
  String[] result=new String[2];
  GroupComparison val=groupComparisons.get(0);
  result[0]=val.nameGroup1;
  result[1]=val.nameGroup2;
  return result;
}