nus-yam/ex-repair huggingface dataset:
Program: 30576
Project: 30576
Buggy source:
@Test public void testNonLazyInstance(){
  final List<RelativeIso8601Date> testDates=Arrays.<RelativeIso8601Date>asList(new RelativeIso8601Date(new Date()),new RelativeIso8601Date(new Iso8601Date(new Date()).toString()));
  for (  final RelativeIso8601Date nonLazy : testDates) {
    Assert.assertFalse(nonLazy.toString().equals(RelativeIso8601Date.LAZY_NOW_LABEL));
    Assert.assertEquals((double)nonLazy.getTime(),(double)System.currentTimeMillis(),1d);
    new RelativeIso8601Date(nonLazy.toString());
  }
}

Fixed version (ground truth):
@Test public void testNonLazyInstance(){
  final long time=new Iso8601Date(new Date(System.currentTimeMillis())).getTime();
  final List<RelativeIso8601Date> testDates=Arrays.<RelativeIso8601Date>asList(new RelativeIso8601Date(new Date(time)),new RelativeIso8601Date(new Iso8601Date(new Date(time)).toString()));
  for (  final RelativeIso8601Date nonLazy : testDates) {
    Assert.assertFalse(nonLazy.toString().equals(RelativeIso8601Date.LAZY_NOW_LABEL));
    Assert.assertEquals((double)nonLazy.getTime(),(double)time);
    new RelativeIso8601Date(nonLazy.toString());
  }
}
Program: 30577
Project: 30577
Buggy source:
/** 
 * Attempts to load a class, taking into account that some classes have "migrated" from the broad to sf. 
 */
private Class<?> loadClass(final String className,final boolean tryOtherPackages) throws ClassNotFoundException {
  final String[] packages=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  try {
    return Class.forName(className);
  }
 catch (  ClassNotFoundException cnfe) {
    if (tryOtherPackages) {
      for (      final String p : packages) {
        try {
          return loadClass(p + className.substring(className.lastIndexOf("String_Node_Str")),false);
        }
 catch (        ClassNotFoundException cnf2) {
        }
        if (className.indexOf("String_Node_Str") > -1) {
          try {
            return loadClass(p + "String_Node_Str" + className.substring(className.lastIndexOf("String_Node_Str") + 1),false);
          }
 catch (          ClassNotFoundException cnf2) {
          }
        }
      }
    }
    throw cnfe;
  }
}

Fixed version (ground truth):
/** 
 * Attempts to load a class, taking into account that some classes have "migrated" from the broad to sf. 
 */
private Class<?> loadClass(final String className,final boolean tryOtherPackages) throws ClassNotFoundException {
  final String[] packages=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  try {
    return Class.forName(className);
  }
 catch (  ClassNotFoundException cnfe) {
    if (tryOtherPackages) {
      for (      final String p : packages) {
        try {
          return loadClass(p + className.substring(className.lastIndexOf("String_Node_Str")),false);
        }
 catch (        ClassNotFoundException cnf2) {
        }
        if (className.indexOf("String_Node_Str") > -1) {
          try {
            return loadClass(p + "String_Node_Str" + className.substring(className.lastIndexOf("String_Node_Str") + 1),false);
          }
 catch (          ClassNotFoundException cnf2) {
          }
        }
      }
    }
    throw cnfe;
  }
}
Program: 30579
Project: 30579
Buggy source:
private OptionDefinition(final Field field,final String name,final String shortName,final String doc,final boolean optional,final boolean collection,final int minElements,final int maxElements,final Object defaultValue,final boolean isCommon,final String[] mutuallyExclusive){
  this.field=field;
  this.name=name.toUpperCase();
  this.shortName=shortName.toUpperCase();
  this.doc=doc;
  this.optional=optional;
  isCollection=collection;
  this.minElements=minElements;
  this.maxElements=maxElements;
  if (defaultValue != null) {
    if (isCollection && ((Collection)defaultValue).isEmpty()) {
      this.defaultValue="String_Node_Str";
    }
 else     if (defaultValue.getClass().isEnum()) {
      this.defaultValue=((Enum)defaultValue).name();
    }
 else {
      this.defaultValue=defaultValue.toString();
    }
  }
 else {
    this.defaultValue="String_Node_Str";
  }
  this.isCommon=isCommon;
  this.mutuallyExclusive=new HashSet<String>(Arrays.asList(mutuallyExclusive));
}

Fixed version (ground truth):
private OptionDefinition(final Field field,final String name,final String shortName,final String doc,final boolean optional,final boolean collection,final int minElements,final int maxElements,final Object defaultValue,final boolean isCommon,final String[] mutuallyExclusive){
  this.field=field;
  this.name=name.toUpperCase();
  this.shortName=shortName.toUpperCase();
  this.doc=doc;
  this.optional=optional;
  isCollection=collection;
  this.minElements=minElements;
  this.maxElements=maxElements;
  if (defaultValue != null) {
    if (isCollection && ((Collection)defaultValue).isEmpty()) {
      this.defaultValue="String_Node_Str";
    }
 else {
      this.defaultValue=defaultValue.toString();
    }
  }
 else {
    this.defaultValue="String_Node_Str";
  }
  this.isCommon=isCommon;
  this.mutuallyExclusive=new HashSet<String>(Arrays.asList(mutuallyExclusive));
}
Program: 30580
Project: 30580
Buggy source:
/** 
 * Run all validations of the mate's CIGAR.  These include validation that the CIGAR makes sense independent of placement, plus validation that CIGAR + placement yields all bases with M operator within the range of the reference.
 * @return List of errors, or null if no errors.
 * @param cigar The cigar containing the alignment information
 * @param referenceIndex The reference index
 * @param alignmentBlocks The alignment blocks (parsed from the cigar)
 * @param recordNumber For error reporting.  -1 if not known.
 * @param cigarTypeName For error reporting.  "Read CIGAR" or "Mate Cigar"
 * @return
 */
private List<SAMValidationError> validateCigar(final Cigar cigar,final Integer referenceIndex,final List<AlignmentBlock> alignmentBlocks,final long recordNumber,final String cigarTypeName){
  List<SAMValidationError> ret=cigar.isValid(getReadName(),recordNumber);
  if (referenceIndex != NO_ALIGNMENT_REFERENCE_INDEX) {
    final SAMSequenceRecord sequence=getHeader().getSequence(getReferenceIndex());
    final int referenceSequenceLength=sequence.getSequenceLength();
    for (    final AlignmentBlock alignmentBlock : alignmentBlocks) {
      if (alignmentBlock.getReferenceStart() + alignmentBlock.getLength() - 1 > referenceSequenceLength) {
        if (ret == null)         ret=new ArrayList<SAMValidationError>();
        ret.add(new SAMValidationError(SAMValidationError.Type.CIGAR_MAPS_OFF_REFERENCE,cigarTypeName + "String_Node_Str",getReadName(),recordNumber));
        break;
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Run all validations of the mate's CIGAR.  These include validation that the CIGAR makes sense independent of placement, plus validation that CIGAR + placement yields all bases with M operator within the range of the reference.
 * @return List of errors, or null if no errors.
 * @param cigar The cigar containing the alignment information
 * @param referenceIndex The reference index
 * @param alignmentBlocks The alignment blocks (parsed from the cigar)
 * @param recordNumber For error reporting.  -1 if not known.
 * @param cigarTypeName For error reporting.  "Read CIGAR" or "Mate Cigar"
 * @return
 */
private List<SAMValidationError> validateCigar(final Cigar cigar,final Integer referenceIndex,final List<AlignmentBlock> alignmentBlocks,final long recordNumber,final String cigarTypeName){
  List<SAMValidationError> ret=cigar.isValid(getReadName(),recordNumber);
  if (referenceIndex != NO_ALIGNMENT_REFERENCE_INDEX) {
    final SAMSequenceRecord sequence=getHeader().getSequence(referenceIndex);
    final int referenceSequenceLength=sequence.getSequenceLength();
    for (    final AlignmentBlock alignmentBlock : alignmentBlocks) {
      if (alignmentBlock.getReferenceStart() + alignmentBlock.getLength() - 1 > referenceSequenceLength) {
        if (ret == null)         ret=new ArrayList<SAMValidationError>();
        ret.add(new SAMValidationError(SAMValidationError.Type.CIGAR_MAPS_OFF_REFERENCE,cigarTypeName + "String_Node_Str",getReadName(),recordNumber));
        break;
      }
    }
  }
  return ret;
}
Program: 30581
Project: 30581
Buggy source:
@Override public void run(){
  try {
    for (; ; ) {
      final String line=bufferedReader.readLine();
      if (line == null) {
        eofReached=true;
        break;
      }
 else {
        try {
          lineQueue.put(line);
        }
 catch (        InterruptedException e) {
          break;
        }
      }
    }
  }
 catch (  Exception e) {
    AsynchronousLineReader.this.workerException=e;
  }
 finally {
    CloserUtil.close(AsynchronousLineReader.this.bufferedReader);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    for (; ; ) {
      final String line=bufferedReader.readLine();
      if (line == null) {
        eofReached=true;
        break;
      }
 else {
        try {
          lineQueue.put(line);
        }
 catch (        final InterruptedException e) {
          break;
        }
      }
    }
  }
 catch (  final Throwable e) {
    AsynchronousLineReader.this.workerException=e;
  }
 finally {
    CloserUtil.close(AsynchronousLineReader.this.bufferedReader);
  }
}
Program: 30582
Project: 30582
Buggy source:
@Override public String readLine(){
  try {
    for (; ; ) {
      checkAndThrowIfWorkerException();
      final String pollResult=this.lineQueue.poll(100,TimeUnit.MILLISECONDS);
      if (pollResult == null) {
        if (eofReached) {
          checkAndThrowIfWorkerException();
          return lineQueue.poll();
        }
      }
 else {
        return pollResult;
      }
    }
  }
 catch (  InterruptedException e) {
    throw new TribbleException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public String readLine(){
  try {
    for (; ; ) {
      checkAndThrowIfWorkerException();
      final String pollResult=this.lineQueue.poll(100,TimeUnit.MILLISECONDS);
      if (pollResult == null) {
        if (eofReached) {
          checkAndThrowIfWorkerException();
          return lineQueue.poll();
        }
      }
 else {
        return pollResult;
      }
    }
  }
 catch (  final InterruptedException e) {
    throw new TribbleException("String_Node_Str",e);
  }
}
Program: 30583
Project: 30583
Buggy source:
private IntervalComparison compareIntervalToRecord(final SAMFileReader.QueryInterval interval,final SAMRecord record){
  final int intervalEnd=(interval.end <= 0 ? Integer.MAX_VALUE : interval.end);
  if (interval.referenceIndex < record.getReferenceIndex())   return IntervalComparison.BEFORE;
 else   if (interval.referenceIndex > record.getReferenceIndex())   return IntervalComparison.AFTER;
 else   if (intervalEnd < record.getAlignmentStart())   return IntervalComparison.BEFORE;
 else   if (record.getAlignmentEnd() < interval.start)   return IntervalComparison.AFTER;
 else   if (CoordMath.encloses(interval.start,intervalEnd,record.getAlignmentStart(),record.getAlignmentEnd())) {
    return IntervalComparison.CONTAINED;
  }
 else   return IntervalComparison.OVERLAPPING;
}

Fixed version (ground truth):
private IntervalComparison compareIntervalToRecord(final SAMFileReader.QueryInterval interval,final SAMRecord record){
  final int intervalEnd=(interval.end <= 0 ? Integer.MAX_VALUE : interval.end);
  final int alignmentEnd;
  if (record.getReadUnmappedFlag() && record.getAlignmentStart() != SAMRecord.NO_ALIGNMENT_START) {
    alignmentEnd=record.getAlignmentStart();
  }
 else {
    alignmentEnd=record.getAlignmentEnd();
  }
  if (interval.referenceIndex < record.getReferenceIndex())   return IntervalComparison.BEFORE;
 else   if (interval.referenceIndex > record.getReferenceIndex())   return IntervalComparison.AFTER;
 else   if (intervalEnd < record.getAlignmentStart())   return IntervalComparison.BEFORE;
 else   if (alignmentEnd < interval.start)   return IntervalComparison.AFTER;
 else   if (CoordMath.encloses(interval.start,intervalEnd,record.getAlignmentStart(),alignmentEnd)) {
    return IntervalComparison.CONTAINED;
  }
 else   return IntervalComparison.OVERLAPPING;
}
Program: 30584
Project: 30584
Buggy source:
private int countElements(final CloseableIterator<SAMRecord> it){
  int num;
  for (num=0; it.hasNext(); ++num, it.next()) {
  }
  return num;
}

Fixed version (ground truth):
private int countElements(final CloseableIterator<SAMRecord> it){
  int num;
  for (num=0; it.hasNext(); ++num, it.next()) {
  }
  it.close();
  return num;
}
Program: 30585
Project: 30585
Buggy source:
/** 
 * @return true if there are more aligned reads in the SAM file, LocusInfos in some stage of accumulation,or loci in the target mask that have yet to be covered.
 */
public boolean hasNext(){
  while (complete.isEmpty() && ((!accumulator.isEmpty()) || samHasMore() || hasRemainingMaskBases())) {
    final LocusInfo locusInfo=next();
    if (locusInfo != null) {
      complete.addFirst(locusInfo);
    }
  }
  return !complete.isEmpty();
}

Fixed version (ground truth):
/** 
 * @return true if there are more aligned reads in the SAM file, LocusInfos in some stage of accumulation,or loci in the target mask that have yet to be covered.
 */
public boolean hasNext(){
  if (this.samIterator == null) {
    iterator();
  }
  while (complete.isEmpty() && ((!accumulator.isEmpty()) || samHasMore() || hasRemainingMaskBases())) {
    final LocusInfo locusInfo=next();
    if (locusInfo != null) {
      complete.addFirst(locusInfo);
    }
  }
  return !complete.isEmpty();
}
Program: 30586
Project: 30586
Buggy source:
public static File getTempDirecory(final String prefix,final String suffix){
  final File tempDirectory;
  try {
    tempDirectory=File.createTempFile(prefix,suffix);
  }
 catch (  IOException e) {
    throw new SAMException("String_Node_Str",e);
  }
  if (!tempDirectory.delete())   throw new SAMException("String_Node_Str" + tempDirectory);
  if (!tempDirectory.mkdir())   throw new SAMException("String_Node_Str" + tempDirectory);
  tempDirectory.deleteOnExit();
  return tempDirectory;
}

Fixed version (ground truth):
/** 
 * @deprecated Use properly spelled method.
 */
public static File getTempDirecory(final String prefix,final String suffix){
  return getTempDirectory(prefix,suffix);
}
Program: 30587
Project: 30587
Buggy source:
@Test(enabled=true) public void TestWritingLargeVCF() throws FileNotFoundException, InterruptedException {
  Set<VCFHeaderLine> metaData=new HashSet<VCFHeaderLine>();
  final Set<String> Columns=new HashSet<String>();
  for (int i=0; i < 123; i++) {
    Columns.add(String.format("String_Node_Str",i));
  }
  final VCFHeader header=createFakeHeader(metaData,Columns);
  final EnumSet<Options> options=EnumSet.of(Options.ALLOW_MISSING_FIELDS_IN_HEADER,Options.INDEX_ON_THE_FLY);
  final File tempDir=TestUtil.getTempDirecory("String_Node_Str","String_Node_Str");
  tempDir.deleteOnExit();
  final File vcf=new File(tempDir,"String_Node_Str");
  final File vcfIndex=new File(tempDir,"String_Node_Str");
  final SAMSequenceDictionary dict=createArtificialSequenceDictionary();
  for (int count=1; count < 2; count++) {
    final VariantContextWriter writer=VariantContextWriterFactory.create(vcf,dict,options);
    writer.writeHeader(header);
    for (int i=1; i < 17; i++) {
      for (int j=1; j < 10; j++) {
        writer.add(createVCGeneral(header,String.format("String_Node_Str",i),j * 100));
      }
    }
    writer.close();
    Assert.assertTrue(vcf.lastModified() <= vcfIndex.lastModified());
  }
}

Fixed version (ground truth):
@Test(enabled=true) public void TestWritingLargeVCF() throws FileNotFoundException, InterruptedException {
  Set<VCFHeaderLine> metaData=new HashSet<VCFHeaderLine>();
  final Set<String> Columns=new HashSet<String>();
  for (int i=0; i < 123; i++) {
    Columns.add(String.format("String_Node_Str",i));
  }
  final VCFHeader header=createFakeHeader(metaData,Columns);
  final EnumSet<Options> options=EnumSet.of(Options.ALLOW_MISSING_FIELDS_IN_HEADER,Options.INDEX_ON_THE_FLY);
  final File tempDir=TestUtil.getTempDirectory("String_Node_Str","String_Node_Str");
  tempDir.deleteOnExit();
  final File vcf=new File(tempDir,"String_Node_Str");
  final File vcfIndex=new File(tempDir,"String_Node_Str");
  final SAMSequenceDictionary dict=createArtificialSequenceDictionary();
  for (int count=1; count < 2; count++) {
    final VariantContextWriter writer=VariantContextWriterFactory.create(vcf,dict,options);
    writer.writeHeader(header);
    for (int i=1; i < 17; i++) {
      for (int j=1; j < 10; j++) {
        writer.add(createVCGeneral(header,String.format("String_Node_Str",i),j * 100));
      }
    }
    writer.close();
    Assert.assertTrue(vcf.lastModified() <= vcfIndex.lastModified());
  }
}
Program: 30588
Project: 30588
Buggy source:
public String toString(){
  return String.format("String_Node_Str",getSource(),contig + "String_Node_Str" + (start - stop == 0 ? start : start + "String_Node_Str" + stop),hasLog10PError() ? String.format("String_Node_Str",getPhredScaledQual()) : "String_Node_Str",this.getType(),ParsingUtils.sortList(this.getAlleles()),ParsingUtils.sortedString(this.getAttributes()),this.getGenotypes());
}

Fixed version (ground truth):
public String toString(){
  return genotypes.isLazyWithData() ? toStringUnparsedGenotypes() : toStringDecodeGenotypes();
}
Program: 30589
Project: 30589
Buggy source:
private final static int[] decodeInts(final String string){
  final int nValues=ParsingUtils.split(string,INT_DECODE_ARRAY,',');
  final int[] values=new int[nValues];
  try {
    for (int i=0; i < nValues; i++)     values[i]=Integer.valueOf(INT_DECODE_ARRAY[i]);
  }
 catch (  final NumberFormatException e) {
    return null;
  }
  return values;
}

Fixed version (ground truth):
private final int[] decodeInts(final String string){
  final int nValues=ParsingUtils.split(string,INT_DECODE_ARRAY,',');
  final int[] values=new int[nValues];
  try {
    for (int i=0; i < nValues; i++)     values[i]=Integer.valueOf(INT_DECODE_ARRAY[i]);
  }
 catch (  final NumberFormatException e) {
    return null;
  }
  return values;
}
Program: 30591
Project: 30591
Buggy source:
/** 
 * Reads all of the stream into a String, decoding with the provided   {@link Charset} then closes the stream quietly. 
 */
public static String slurp(final InputStream is,final Charset charSet){
  return CollectionUtil.getSoleElement(tokenSlurp(is,charSet,"String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Reads all of the stream into a String, decoding with the provided   {@link Charset} then closes the stream quietly. 
 */
public static String slurp(final InputStream is,final Charset charSet){
  final List<String> tokenOrEmpty=tokenSlurp(is,charSet,"String_Node_Str");
  return tokenOrEmpty.isEmpty() ? StringUtil.EMPTY_STRING : CollectionUtil.getSoleElement(tokenOrEmpty);
}
Program: 30592
Project: 30592
Buggy source:
@Override protected int doWork(){
  IoUtil.assertFileIsReadable(INPUT);
  IoUtil.assertFileIsReadable(SEQUENCE_DICTIONARY);
  IoUtil.assertFileIsWritable(OUTPUT);
  final VCFFileReader reader=new VCFFileReader(INPUT);
  final VCFHeader header=new VCFHeader(reader.getFileHeader());
  final SAMSequenceDictionary sequenceDictionary=SEQUENCE_DICTIONARY != null ? SAMFileReader.getSequenceDictionary(SEQUENCE_DICTIONARY) : header.getSequenceDictionary();
  if (CREATE_INDEX && sequenceDictionary == null) {
    throw new PicardException("String_Node_Str");
  }
  final EnumSet<Options> options=CREATE_INDEX ? EnumSet.of(Options.INDEX_ON_THE_FLY) : EnumSet.noneOf(Options.class);
  final VariantContextWriter writer=VariantContextWriterFactory.create(OUTPUT,sequenceDictionary,options);
  writer.writeHeader(header);
  final ProgressLogger progress=new ProgressLogger(Log.getInstance(MakeSitesOnlyVcf.class),10000);
  final CloseableIterator<VariantContext> iterator=reader.iterator();
  while (iterator.hasNext()) {
    final VariantContext context=iterator.next();
    writer.add(context.subContextFromSamples(NO_SAMPLES,false));
    progress.record(context.getChr(),context.getStart());
  }
  CloserUtil.close(iterator);
  CloserUtil.close(reader);
  writer.close();
  return 0;
}

Fixed version (ground truth):
@Override protected int doWork(){
  IoUtil.assertFileIsReadable(INPUT);
  if (SEQUENCE_DICTIONARY != null)   IoUtil.assertFileIsReadable(SEQUENCE_DICTIONARY);
  IoUtil.assertFileIsWritable(OUTPUT);
  final VCFFileReader reader=new VCFFileReader(INPUT);
  final VCFHeader header=new VCFHeader(reader.getFileHeader());
  final SAMSequenceDictionary sequenceDictionary=SEQUENCE_DICTIONARY != null ? SAMFileReader.getSequenceDictionary(SEQUENCE_DICTIONARY) : header.getSequenceDictionary();
  if (CREATE_INDEX && sequenceDictionary == null) {
    throw new PicardException("String_Node_Str");
  }
  final EnumSet<Options> options=CREATE_INDEX ? EnumSet.of(Options.INDEX_ON_THE_FLY) : EnumSet.noneOf(Options.class);
  final VariantContextWriter writer=VariantContextWriterFactory.create(OUTPUT,sequenceDictionary,options);
  writer.writeHeader(header);
  final ProgressLogger progress=new ProgressLogger(Log.getInstance(MakeSitesOnlyVcf.class),10000);
  final CloseableIterator<VariantContext> iterator=reader.iterator();
  while (iterator.hasNext()) {
    final VariantContext context=iterator.next();
    writer.add(context.subContextFromSamples(NO_SAMPLES,false));
    progress.record(context.getChr(),context.getStart());
  }
  CloserUtil.close(iterator);
  CloserUtil.close(reader);
  writer.close();
  return 0;
}
Program: 30593
Project: 30593
Buggy source:
@Override protected int doWork(){
  IoUtil.assertFileIsReadable(INPUT);
  if (SEQUENCE_DICTIONARY != null)   IoUtil.assertFileIsReadable(SEQUENCE_DICTIONARY);
  IoUtil.assertFileIsWritable(OUTPUT);
  final VCFFileReader reader=new VCFFileReader(INPUT);
  final VCFHeader header=new VCFHeader(reader.getFileHeader());
  final SAMSequenceDictionary sequenceDictionary=SEQUENCE_DICTIONARY != null ? SAMFileReader.getSequenceDictionary(SEQUENCE_DICTIONARY) : header.getSequenceDictionary();
  if (CREATE_INDEX && sequenceDictionary == null) {
    throw new PicardException("String_Node_Str");
  }
  final EnumSet<Options> options=CREATE_INDEX ? EnumSet.of(Options.INDEX_ON_THE_FLY) : EnumSet.noneOf(Options.class);
  final VariantContextWriter writer=VariantContextWriterFactory.create(OUTPUT,sequenceDictionary,options);
  writer.writeHeader(header);
  final ProgressLogger progress=new ProgressLogger(Log.getInstance(MakeSitesOnlyVcf.class),10000);
  final CloseableIterator<VariantContext> iterator=reader.iterator();
  while (iterator.hasNext()) {
    final VariantContext context=iterator.next();
    writer.add(context.subContextFromSamples(NO_SAMPLES,false));
    progress.record(context.getChr(),context.getStart());
  }
  CloserUtil.close(iterator);
  CloserUtil.close(reader);
  writer.close();
  return 0;
}

Fixed version (ground truth):
@Override protected int doWork(){
  IoUtil.assertFileIsReadable(INPUT);
  if (SEQUENCE_DICTIONARY != null)   IoUtil.assertFileIsReadable(SEQUENCE_DICTIONARY);
  IoUtil.assertFileIsWritable(OUTPUT);
  final VCFFileReader reader=new VCFFileReader(INPUT);
  final VCFHeader header=new VCFHeader(reader.getFileHeader().getMetaDataInInputOrder());
  final SAMSequenceDictionary sequenceDictionary=SEQUENCE_DICTIONARY != null ? SAMFileReader.getSequenceDictionary(SEQUENCE_DICTIONARY) : header.getSequenceDictionary();
  if (CREATE_INDEX && sequenceDictionary == null) {
    throw new PicardException("String_Node_Str");
  }
  final EnumSet<Options> options=CREATE_INDEX ? EnumSet.of(Options.INDEX_ON_THE_FLY) : EnumSet.noneOf(Options.class);
  final VariantContextWriter writer=VariantContextWriterFactory.create(OUTPUT,sequenceDictionary,options);
  writer.writeHeader(header);
  final ProgressLogger progress=new ProgressLogger(Log.getInstance(MakeSitesOnlyVcf.class),10000);
  final CloseableIterator<VariantContext> iterator=reader.iterator();
  while (iterator.hasNext()) {
    final VariantContext context=iterator.next();
    writer.add(context.subContextFromSamples(NO_SAMPLES,false));
    progress.record(context.getChr(),context.getStart());
  }
  CloserUtil.close(iterator);
  CloserUtil.close(reader);
  writer.close();
  return 0;
}
Program: 30594
Project: 30594
Buggy source:
public Map.Entry<Interval,T> next(){
  if (!hasNext()) {
    throw new NoSuchElementException("String_Node_Str");
  }
  final IntervalTree.Node<T> node=mTreeIterator.next();
  if (!mTreeIterator.hasNext()) {
    advanceSequence();
  }
  final Interval key=new Interval(mSequence,node.getStart(),node.getEnd());
  final T value=node.getValue();
  return new MapEntry(key,value);
}

Fixed version (ground truth):
public Map.Entry<Interval,T> next(){
  if (!hasNext()) {
    throw new NoSuchElementException("String_Node_Str");
  }
  final IntervalTree.Node<T> node=mTreeIterator.next();
  final String sequence=mSequence;
  if (!mTreeIterator.hasNext()) {
    advanceSequence();
  }
  final Interval key=new Interval(sequence,node.getStart(),node.getEnd());
  final T value=node.getValue();
  return new MapEntry(key,value);
}
Program: 30595
Project: 30595
Buggy source:
Histogram<Integer> getMeanQualityHistogram(){
  final String label=useOriginalQualities ? "String_Node_Str" : "String_Node_Str";
  final Histogram<Integer> meanQualities=new Histogram<Integer>("String_Node_Str",label);
  int firstReadLength=0;
  for (int cycle=0; cycle < firstReadTotalsByCycle.length; ++cycle) {
    if (firstReadTotalsByCycle[cycle] > 0) {
      meanQualities.increment(cycle,firstReadTotalsByCycle[cycle] / firstReadCountsByCycle[cycle]);
      firstReadLength=cycle;
    }
  }
  for (int i=0; i < secondReadTotalsByCycle.length; ++i) {
    final int cycle=firstReadLength + i;
    if (secondReadCountsByCycle[i] > 0) {
      meanQualities.increment(cycle,secondReadTotalsByCycle[i] / firstReadCountsByCycle[i]);
    }
  }
  return meanQualities;
}

Fixed version (ground truth):
Histogram<Integer> getMeanQualityHistogram(){
  final String label=useOriginalQualities ? "String_Node_Str" : "String_Node_Str";
  final Histogram<Integer> meanQualities=new Histogram<Integer>("String_Node_Str",label);
  int firstReadLength=0;
  for (int cycle=0; cycle < firstReadTotalsByCycle.length; ++cycle) {
    if (firstReadTotalsByCycle[cycle] > 0) {
      meanQualities.increment(cycle,firstReadTotalsByCycle[cycle] / firstReadCountsByCycle[cycle]);
      firstReadLength=cycle;
    }
  }
  for (int i=0; i < secondReadTotalsByCycle.length; ++i) {
    if (secondReadCountsByCycle[i] > 0) {
      final int cycle=firstReadLength + i;
      meanQualities.increment(cycle,secondReadTotalsByCycle[i] / secondReadCountsByCycle[i]);
    }
  }
  return meanQualities;
}
Program: 30597
Project: 30597
Buggy source:
@Test public void testNegative(){
  List<SAMValidationError> errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.INVALID_CIGAR);
  errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.INVALID_CIGAR);
  errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.INVALID_CIGAR);
  errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.INVALID_CIGAR);
}

Fixed version (ground truth):
@Test public void testNegative(){
  List<SAMValidationError> errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.ADJACENT_INDEL_IN_CIGAR);
  errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.INVALID_CIGAR);
  errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.INVALID_CIGAR);
  errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.INVALID_CIGAR);
}
Program: 30599
Project: 30599
Buggy source:
@Test public void testNegative(){
  List<SAMValidationError> errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.ADJACENT_INDEL_IN_CIGAR);
  errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.INVALID_CIGAR);
  errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.INVALID_CIGAR);
  errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.INVALID_CIGAR);
}

Fixed version (ground truth):
@Test public void testNegative(){
  List<SAMValidationError> errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.ADJACENT_INDEL_IN_CIGAR);
  errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.ADJACENT_INDEL_IN_CIGAR);
  errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.INVALID_CIGAR);
  errors=codec.decode("String_Node_Str").isValid(null,-1);
  Assert.assertEquals(errors.size(),1);
  Assert.assertEquals(errors.get(0).getType(),SAMValidationError.Type.INVALID_CIGAR);
}
Program: 30600
Project: 30600
Buggy source:
/** 
 * It is required that sequenceIndex is >= any previous sequenceIndex passed to this class.
 * @return the next pos on the given sequence >= position that is set, or -1 if there are no more set positions
 */
public int nextPosition(final int sequenceIndex,final int position){
  ensureSequenceLoaded(sequenceIndex);
  return currentBitSet.nextSetBit(position);
}

Fixed version (ground truth):
/** 
 * It is required that sequenceIndex is >= any previous sequenceIndex passed to this class.
 * @return the next pos on the given sequence >= position that is set, or -1 if there are no more set positions
 */
public int nextPosition(final int sequenceIndex,final int position){
  ensureSequenceLoaded(sequenceIndex);
  return currentBitSet.nextSetBit(position + 1);
}
Program: 30601
Project: 30601
Buggy source:
/** 
 * Create the next relevant zero-coverage LocusInfo
 * @param stopBeforeLocus don't go up to this sequence and position
 * @return a zero-coverage LocusInfo, or null if there is none before the stopBefore locus
 */
private LocusInfo createNextUncoveredLocusInfo(final Locus stopBeforeLocus){
  while (lastReferenceSequence <= stopBeforeLocus.getSequenceIndex() && lastReferenceSequence <= referenceSequenceMask.getMaxSequenceIndex()) {
    if (lastReferenceSequence == stopBeforeLocus.getSequenceIndex() && lastPosition + 1 >= stopBeforeLocus.getPosition()) {
      return null;
    }
    final int nextbit=referenceSequenceMask.nextPosition(lastReferenceSequence,lastPosition + 1);
    if (nextbit == -1) {
      if (lastReferenceSequence == stopBeforeLocus.getSequenceIndex()) {
        lastPosition=stopBeforeLocus.getPosition();
        return null;
      }
      lastReferenceSequence++;
      lastPosition=0;
    }
 else     if (lastReferenceSequence < stopBeforeLocus.getSequenceIndex() || nextbit < stopBeforeLocus.getPosition()) {
      lastPosition=nextbit;
      return new LocusInfo(getReferenceSequence(lastReferenceSequence),lastPosition);
    }
 else     if (nextbit >= stopBeforeLocus.getPosition()) {
      return null;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Create the next relevant zero-coverage LocusInfo
 * @param stopBeforeLocus don't go up to this sequence and position
 * @return a zero-coverage LocusInfo, or null if there is none before the stopBefore locus
 */
private LocusInfo createNextUncoveredLocusInfo(final Locus stopBeforeLocus){
  while (lastReferenceSequence <= stopBeforeLocus.getSequenceIndex() && lastReferenceSequence <= referenceSequenceMask.getMaxSequenceIndex()) {
    if (lastReferenceSequence == stopBeforeLocus.getSequenceIndex() && lastPosition + 1 >= stopBeforeLocus.getPosition()) {
      return null;
    }
    final int nextbit=referenceSequenceMask.nextPosition(lastReferenceSequence,lastPosition);
    if (nextbit == -1) {
      if (lastReferenceSequence == stopBeforeLocus.getSequenceIndex()) {
        lastPosition=stopBeforeLocus.getPosition();
        return null;
      }
      lastReferenceSequence++;
      lastPosition=0;
    }
 else     if (lastReferenceSequence < stopBeforeLocus.getSequenceIndex() || nextbit < stopBeforeLocus.getPosition()) {
      lastPosition=nextbit;
      return new LocusInfo(getReferenceSequence(lastReferenceSequence),lastPosition);
    }
 else     if (nextbit >= stopBeforeLocus.getPosition()) {
      return null;
    }
  }
  return null;
}
Program: 30602
Project: 30602
Buggy source:
/** 
 * @return true if there are loci in the target mask that have yet to be covered by LocusInfos
 */
private boolean hasRemainingMaskBases(){
  if (!emitUncoveredLoci) {
    return false;
  }
  return (lastReferenceSequence < referenceSequenceMask.getMaxSequenceIndex() || (lastReferenceSequence == referenceSequenceMask.getMaxSequenceIndex() && lastPosition <= referenceSequenceMask.nextPosition(lastReferenceSequence,lastPosition + 1)));
}

Fixed version (ground truth):
/** 
 * @return true if there are loci in the target mask that have yet to be covered by LocusInfos
 */
private boolean hasRemainingMaskBases(){
  if (!emitUncoveredLoci) {
    return false;
  }
  return (lastReferenceSequence < referenceSequenceMask.getMaxSequenceIndex() || (lastReferenceSequence == referenceSequenceMask.getMaxSequenceIndex() && lastPosition < referenceSequenceMask.nextPosition(lastReferenceSequence,lastPosition)));
}
Program: 30603
Project: 30603
Buggy source:
@Test(groups={"String_Node_Str"}) public void testEmitUncoveredLoci(){
  final String sqHeader="String_Node_Str";
  final String seq1="String_Node_Str";
  final String qual1="String_Node_Str";
  final String s1="String_Node_Str" + seq1 + "String_Node_Str"+ qual1+ "String_Node_Str";
  final String exampleSam=sqHeader + s1 + s1;
  final SAMFileReader samReader=createSamFileReader(exampleSam);
  final SamLocusIterator sli=new SamLocusIterator(samReader);
  int pos=1;
  final int coveredStart=165;
  final int coveredEnd=CoordMath.getEnd(coveredStart,seq1.length());
  for (  final SamLocusIterator.LocusInfo li : sli) {
    Assert.assertEquals(li.getPosition(),pos++);
    final int expectedReads;
    if (li.getPosition() >= coveredStart && li.getPosition() <= coveredEnd) {
      expectedReads=2;
    }
 else {
      expectedReads=0;
    }
    Assert.assertEquals(li.getRecordAndPositions().size(),expectedReads);
  }
  Assert.assertEquals(pos,100001);
}

Fixed version (ground truth):
@Test public void testEmitUncoveredLoci(){
  final String sqHeader="String_Node_Str";
  final String seq1="String_Node_Str";
  final String qual1="String_Node_Str";
  final String s1="String_Node_Str" + seq1 + "String_Node_Str"+ qual1+ "String_Node_Str";
  final String exampleSam=sqHeader + s1 + s1;
  final SAMFileReader samReader=createSamFileReader(exampleSam);
  final SamLocusIterator sli=new SamLocusIterator(samReader);
  int pos=1;
  final int coveredStart=165;
  final int coveredEnd=CoordMath.getEnd(coveredStart,seq1.length());
  for (  final SamLocusIterator.LocusInfo li : sli) {
    Assert.assertEquals(li.getPosition(),pos++);
    final int expectedReads;
    if (li.getPosition() >= coveredStart && li.getPosition() <= coveredEnd) {
      expectedReads=2;
    }
 else {
      expectedReads=0;
    }
    Assert.assertEquals(li.getRecordAndPositions().size(),expectedReads);
  }
  Assert.assertEquals(pos,100001);
}
Program: 30604
Project: 30604
Buggy source:
/** 
 * Read a null terminated byte array and return result as a string
 * @return
 * @throws IOException
 */
public String readString() throws IOException {
  ByteArrayOutputStream bis=new ByteArrayOutputStream(100);
  byte b;
  while ((b=(byte)in.read()) != 0) {
    bis.write(b);
  }
  return new String(bis.toByteArray());
}

Fixed version (ground truth):
/** 
 * Read a null terminated byte array and return result as a string
 * @return
 * @throws IOException
 */
public String readString() throws IOException {
  ByteArrayOutputStream bis=new ByteArrayOutputStream(100);
  byte b;
  while ((b=(byte)in.read()) != 0) {
    if (b < 0) {
      throw new EOFException();
    }
    bis.write(b);
  }
  return new String(bis.toByteArray());
}
Program: 30605
Project: 30605
Buggy source:
@Test() public void testReadingBeyondIntSizedBlock() throws IOException {
  final Block block=new Block(0,((long)Integer.MAX_VALUE) * 2);
  final SeekableFileStream stream=new SeekableFileStream(new File("String_Node_Str"));
  final TribbleIndexedFeatureReader.BlockStreamWrapper blockStreamWrapper=new TribbleIndexedFeatureReader.BlockStreamWrapper(stream,block);
  final int chunkSize=100000;
  final int chunksToRead=(int)Math.ceil(block.getSize() / (chunkSize * 1.0));
  final byte[] bytes=new byte[chunkSize];
  long totalRead=0;
  for (int chunk=0; chunk < chunksToRead; chunk++) {
    final int nRead=blockStreamWrapper.read(bytes);
    Assert.assertTrue(nRead != -1,"String_Node_Str" + totalRead + "String_Node_Str");
    totalRead+=nRead;
  }
  Assert.assertEquals(totalRead,block.getSize(),"String_Node_Str" + block.getSize());
}

Fixed version (ground truth):
@Test(groups="String_Node_Str") public void testReadingBeyondIntSizedBlock() throws IOException {
  final Block block=new Block(0,((long)Integer.MAX_VALUE) * 2);
  final SeekableFileStream stream=new SeekableFileStream(new File("String_Node_Str"));
  final TribbleIndexedFeatureReader.BlockStreamWrapper blockStreamWrapper=new TribbleIndexedFeatureReader.BlockStreamWrapper(stream,block);
  final int chunkSize=100000;
  final int chunksToRead=(int)Math.ceil(block.getSize() / (chunkSize * 1.0));
  final byte[] bytes=new byte[chunkSize];
  long totalRead=0;
  for (int chunk=0; chunk < chunksToRead; chunk++) {
    final int nRead=blockStreamWrapper.read(bytes);
    Assert.assertTrue(nRead != -1,"String_Node_Str" + totalRead + "String_Node_Str");
    totalRead+=nRead;
  }
  Assert.assertEquals(totalRead,block.getSize(),"String_Node_Str" + block.getSize());
}
Program: 30609
Project: 30609
Buggy source:
private void initializeBAMWriter(final BAMFileWriter writer,final SAMFileHeader header,final boolean presorted,final boolean createIndex){
  writer.setSortOrder(header.getSortOrder(),presorted);
  writer.setHeader(header);
  if (createIndex && writer.getSortOrder().equals(SAMFileHeader.SortOrder.coordinate)) {
    writer.enableBamIndexConstruction();
  }
  if (maxRecordsInRam != null) {
    writer.setMaxRecordsInRam(maxRecordsInRam);
  }
}

Fixed version (ground truth):
private void initializeBAMWriter(final BAMFileWriter writer,final SAMFileHeader header,final boolean presorted,final boolean createIndex){
  writer.setSortOrder(header.getSortOrder(),presorted);
  if (maxRecordsInRam != null) {
    writer.setMaxRecordsInRam(maxRecordsInRam);
  }
  writer.setHeader(header);
  if (createIndex && writer.getSortOrder().equals(SAMFileHeader.SortOrder.coordinate)) {
    writer.enableBamIndexConstruction();
  }
}
Program: 30610
Project: 30610
Buggy source:
/** 
 * Returns the mapping of barcodes to records associated with them.
 */
public Map<String,SortingCollection<SAMRecord>> getBarcodeRecords(){
  return barcodeToRecordCollection;
}

Fixed version (ground truth):
/** 
 * Returns the mapping of barcodes to records associated with them.
 */
public synchronized Map<String,SortingCollection<SAMRecord>> getBarcodeRecords(){
  return barcodeToRecordCollection;
}
Program: 30611
Project: 30611
Buggy source:
/** 
 * Returns the distinct set of barcodes for which data has been collected in this record.
 * @return
 */
public Set<String> getBarcodes(){
  return this.getBarcodeRecords().keySet();
}

Fixed version (ground truth):
/** 
 * Returns the distinct set of barcodes for which data has been collected in this record.
 * @return
 */
public synchronized Set<String> getBarcodes(){
  return this.getBarcodeRecords().keySet();
}
Program: 30612
Project: 30612
Buggy source:
@Override protected int doWork(){
  initialize();
  doTileProcessing();
  finalise();
  return 0;
}

Fixed version (ground truth):
@Override protected int doWork(){
  initialize();
  try {
    doTileProcessing();
  }
  finally {
    finalise();
  }
  return 0;
}
Program: 30613
Project: 30613
Buggy source:
/** 
 * Returns the number of records read.
 */
public long getRecordCount(){
  return recordCount;
}

Fixed version (ground truth):
/** 
 * Returns the number of records read.
 */
public synchronized long getRecordCount(){
  return recordCount;
}
Program: 30614
Project: 30614
Buggy source:
/** 
 * Gets the state of the provided barcode's data's processing progress.  Only invoke this query if this tile is in a DONE_READING state.
 * @throws IllegalStateException When a barcode is queried before the tile is in the DONE_READING state
 */
public TileBarcodeProcessingState getBarcodeState(final String barcode){
  if (this.getState() == TileProcessingState.NOT_DONE_READING) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (this.barcodeToProcessingState.containsKey(barcode)) {
    return this.barcodeToProcessingState.get(barcode);
  }
 else {
    return TileBarcodeProcessingState.NA;
  }
}

Fixed version (ground truth):
/** 
 * Gets the state of the provided barcode's data's processing progress.  Only invoke this query if this tile is in a DONE_READING state.
 * @throws IllegalStateException When a barcode is queried before the tile is in the DONE_READING state
 */
public synchronized TileBarcodeProcessingState getBarcodeState(final String barcode){
  if (this.getState() == TileProcessingState.NOT_DONE_READING) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (this.barcodeToProcessingState.containsKey(barcode)) {
    return this.barcodeToProcessingState.get(barcode);
  }
 else {
    return TileBarcodeProcessingState.NA;
  }
}
Program: 30615
Project: 30615
Buggy source:
/** 
 * Reads the data from the appropriate IlluminaDataProvider and feeds it into the TileProcessingRecord for this tile.
 */
public void process(){
  final IlluminaDataProvider dataProvider=factory.makeDataProvider(Arrays.asList(this.tile.getNumber()));
  final SAMRecord[] recordContainer=new SAMRecord[converter.getNumRecordsPerCluster()];
  log.debug(String.format("String_Node_Str",tile.getNumber()));
  while (dataProvider.hasNext()) {
    final ClusterData cluster=dataProvider.next();
    final String barcode=cluster.getMatchedBarcode();
    converter.createSamRecords(cluster,null,recordContainer);
    for (    final SAMRecord record : recordContainer) {
      readProgressLogger.record(record);
      this.processingRecord.addRecord(barcode,record);
    }
  }
  this.handler.completeTile(this.tile);
}

Fixed version (ground truth):
/** 
 * Reads the data from the appropriate IlluminaDataProvider and feeds it into the TileProcessingRecord for this tile.
 */
public void process(){
  final IlluminaDataProvider dataProvider=factory.makeDataProvider(Arrays.asList(this.tile.getNumber()));
  final SAMRecord[] recordContainer=new SAMRecord[converter.getNumRecordsPerCluster()];
  log.debug(String.format("String_Node_Str",tile.getNumber()));
  while (dataProvider.hasNext()) {
    final ClusterData cluster=dataProvider.next();
    final String barcode=cluster.getMatchedBarcode();
    converter.createSamRecords(cluster,null,recordContainer);
    readProgressLogger.record(recordContainer);
    this.processingRecord.addRecord(barcode,recordContainer);
  }
  this.handler.completeTile(this.tile);
}
Program: 30616
Project: 30616
Buggy source:
/** 
 * Adds the provided recoded to this tile.
 */
public void addRecord(final String barcode,final SAMRecord... records){
  this.recordCount+=records.length;
  SortingCollection<SAMRecord> recordCollection=this.barcodeToRecordCollection.get(barcode);
  if (recordCollection == null) {
    recordCollection=this.newSortingCollection();
    this.barcodeToRecordCollection.put(barcode,recordCollection);
    this.barcodeToProcessingState.put(barcode,null);
  }
  for (  final SAMRecord record : records) {
    recordCollection.add(record);
  }
}

Fixed version (ground truth):
/** 
 * Adds the provided recoded to this tile.
 */
public synchronized void addRecord(final String barcode,final SAMRecord... records){
  this.recordCount+=records.length;
  SortingCollection<SAMRecord> recordCollection=this.barcodeToRecordCollection.get(barcode);
  if (recordCollection == null) {
    if (!IlluminaBasecallsToSam.this.barcodeSamWriterMap.containsKey(barcode))     throw new PicardException(String.format("String_Node_Str",barcode));
    recordCollection=this.newSortingCollection();
    this.barcodeToRecordCollection.put(barcode,recordCollection);
    this.barcodeToProcessingState.put(barcode,null);
  }
  for (  final SAMRecord record : records) {
    recordCollection.add(record);
  }
}
Program: 30617
Project: 30617
Buggy source:
/** 
 * Sets the processing state of the provided barcode in this record.
 * @throws NoSuchElementException When the provided barcode is not one associated with this record.
 */
public void setBarcodeState(final String barcode,final TileBarcodeProcessingState state){
  if (this.barcodeToProcessingState.containsKey(barcode)) {
    this.barcodeToProcessingState.put(barcode,state);
  }
 else {
    throw new NoSuchElementException(String.format("String_Node_Str",barcode));
  }
}

Fixed version (ground truth):
/** 
 * Sets the processing state of the provided barcode in this record.
 * @throws NoSuchElementException When the provided barcode is not one associated with this record.
 */
public synchronized void setBarcodeState(final String barcode,final TileBarcodeProcessingState state){
  if (this.barcodeToProcessingState.containsKey(barcode)) {
    this.barcodeToProcessingState.put(barcode,state);
  }
 else {
    throw new NoSuchElementException(String.format("String_Node_Str",barcode));
  }
}
Program: 30618
Project: 30618
Buggy source:
/** 
 * Returns the state of this tile's processing.
 */
public TileProcessingState getState(){
  return this.state;
}

Fixed version (ground truth):
/** 
 * Returns the state of this tile's processing.
 */
public synchronized TileProcessingState getState(){
  return this.state;
}
Program: 30619
Project: 30619
Buggy source:
/** 
 * Returns the number of unique barcodes read.
 */
public long getBarcodeCount(){
  return this.barcodeToRecordCollection.size();
}

Fixed version (ground truth):
/** 
 * Returns the number of unique barcodes read.
 */
public synchronized long getBarcodeCount(){
  return this.barcodeToRecordCollection.size();
}
Program: 30620
Project: 30620
Buggy source:
private SortingCollection<SAMRecord> newSortingCollection(){
  final int maxRecordsInRam=IlluminaBasecallsToSam.this.MAX_READS_IN_RAM_PER_TILE / IlluminaBasecallsToSam.this.barcodeSamWriterMap.size();
  return SortingCollection.newInstance(SAMRecord.class,new BAMRecordCodec(null),new SAMRecordQueryNameComparator(),maxRecordsInRam,IlluminaBasecallsToSam.this.TMP_DIR);
}

Fixed version (ground truth):
private synchronized SortingCollection<SAMRecord> newSortingCollection(){
  final int maxRecordsInRam=IlluminaBasecallsToSam.this.MAX_READS_IN_RAM_PER_TILE / IlluminaBasecallsToSam.this.barcodeSamWriterMap.size();
  return SortingCollection.newInstance(SAMRecord.class,new BAMRecordCodec(null),new SAMRecordQueryNameComparator(),maxRecordsInRam,IlluminaBasecallsToSam.this.TMP_DIR);
}