nus-yam/ex-repair huggingface dataset:
Program: 33501
Project: 33501
Buggy source:
@Override public RemoteWebDriver createNewDriver(){
  return new ChromeDriver();
}

Fixed version (ground truth):
@Override public ChromeDriver createNewDriver(){
  return new ChromeDriver();
}
Program: 33502
Project: 33502
Buggy source:
public PhantomJSDriver createNewDriver(){
  System.out.println("String_Node_Str");
  File phantomJsExe=null;
  IllegalStateException downloadError=null;
  for (int i=retryDownload; i >= 0; i--) {
    try {
      phantomJsExe=downloadAndExtract();
      break;
    }
 catch (    IllegalStateException e) {
      downloadError=e;
      if (i != 0) {
        System.err.println("String_Node_Str" + downloadError);
        pause(5);
      }
    }
  }
  if (phantomJsExe == null) {
    throw new IllegalStateException("String_Node_Str",downloadError);
  }
  UnreachableBrowserException connectError=null;
  for (int i=retryConnect; i >= 0; i--) {
    try {
      return createNewPhantomJsDriver(phantomJsExe);
    }
 catch (    UnreachableBrowserException e) {
      connectError=e;
      if (i != 0) {
        System.err.println("String_Node_Str" + connectError);
        pause(5);
      }
    }
  }
  throw new IllegalStateException("String_Node_Str",connectError);
}

Fixed version (ground truth):
public SeleniumDriver createNewDriver(){
  System.out.println("String_Node_Str");
  File phantomJsExe=null;
  IllegalStateException downloadError=null;
  for (int i=retryDownload; i >= 0; i--) {
    try {
      phantomJsExe=downloadAndExtract();
      break;
    }
 catch (    IllegalStateException e) {
      downloadError=e;
      if (i != 0) {
        System.err.println("String_Node_Str" + downloadError);
        pause(5);
      }
    }
  }
  if (phantomJsExe == null) {
    throw new IllegalStateException("String_Node_Str",downloadError);
  }
  UnreachableBrowserException connectError=null;
  for (int i=retryConnect; i >= 0; i--) {
    try {
      return createNewPhantomJsDriver(phantomJsExe);
    }
 catch (    UnreachableBrowserException e) {
      connectError=e;
      if (i != 0) {
        System.err.println("String_Node_Str" + connectError);
        pause(5);
      }
    }
  }
  throw new IllegalStateException("String_Node_Str",connectError);
}
Program: 33503
Project: 33503
Buggy source:
private <T>Should verify(String message,Supplier<T> target,Predicate<T> predicate){
  String verification="String_Node_Str" + toString(selector) + "String_Node_Str"+ message;
  System.out.println("String_Node_Str" + verification);
  Verification result=retry.verify(target,predicate);
  if (result == NOT_FOUND) {
    throw new AssertionError("String_Node_Str" + verification);
  }
  if ((not && (result != KO)) || (!not && (result != OK))) {
    throw new AssertionError("String_Node_Str" + verification);
  }
  return new Should(driver,selector,retry,false);
}

Fixed version (ground truth):
private <T>Should verify(String message,Supplier<T> target,Predicate<T> predicate){
  String verification="String_Node_Str" + toString(selector) + "String_Node_Str"+ message;
  System.out.println("String_Node_Str" + verification);
  Verification result=retry.verify(target,not ? predicate.negate() : predicate);
  if (result == NOT_FOUND) {
    throw new AssertionError("String_Node_Str" + verification);
  }
  if (result == KO) {
    throw new AssertionError("String_Node_Str" + verification);
  }
  return new Should(driver,selector,retry,false);
}
Program: 33504
Project: 33504
Buggy source:
private static void writeTerminatorBlock(final OutputStream out,final SAMFormat samOutputFormat) throws IOException {
  if (SAMFormat.CRAM == samOutputFormat) {
    CramIO.issueEOF(CramVersions.DEFAULT_CRAM_VERSION,out);
  }
 else {
    out.write(BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK);
  }
}

Fixed version (ground truth):
private static void writeTerminatorBlock(final OutputStream out,final SAMFormat samOutputFormat) throws IOException {
  if (SAMFormat.CRAM == samOutputFormat) {
    CramIO.issueEOF(CramVersions.DEFAULT_CRAM_VERSION,out);
  }
 else   if (SAMFormat.BAM == samOutputFormat) {
    out.write(BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK);
  }
}
Program: 33505
Project: 33505
Buggy source:
public long guessNextBGZFBlockStart(long beg,long end) throws IOException {
  byte[] arr=new byte[2 * 0xffff - 1];
  this.seekableInFile.seek(beg);
  int read=inFile.read(arr,0,Math.min((int)(end - beg),arr.length));
  if (read == -1) {
    return -1;
  }
  arr=Arrays.copyOf(arr,read);
  this.in=new ByteArraySeekableStream(arr);
  final BlockCompressedInputStream bgzf=new BlockCompressedInputStream(this.in);
  bgzf.setCheckCrcs(true);
  final int firstBGZFEnd=Math.min((int)(end - beg),0xffff);
  for (int pos=0; ; ) {
    pos=guessNextBGZFPos(pos,firstBGZFEnd);
    if (pos < 0)     return end;
    try {
      bgzf.seek((long)pos << 16);
    }
 catch (    Throwable e) {
      ++pos;
      continue;
    }
    return beg + pos;
  }
}

Fixed version (ground truth):
public long guessNextBGZFBlockStart(long beg,long end) throws IOException {
  byte[] arr=new byte[2 * 0xffff - 1];
  this.seekableInFile.seek(beg);
  int totalRead=0;
  for (int left=Math.min((int)(end - beg),arr.length); left > 0; ) {
    final int r=inFile.read(arr,totalRead,left);
    if (r < 0)     break;
    totalRead+=r;
    left-=r;
  }
  arr=Arrays.copyOf(arr,totalRead);
  this.in=new ByteArraySeekableStream(arr);
  final BlockCompressedInputStream bgzf=new BlockCompressedInputStream(this.in);
  bgzf.setCheckCrcs(true);
  final int firstBGZFEnd=Math.min((int)(end - beg),0xffff);
  for (int pos=0; ; ) {
    pos=guessNextBGZFPos(pos,firstBGZFEnd);
    if (pos < 0)     return end;
    try {
      bgzf.seek((long)pos << 16);
    }
 catch (    Throwable e) {
      ++pos;
      continue;
    }
    return beg + pos;
  }
}
Program: 33506
Project: 33506
Buggy source:
private void init(final OutputStream output,final SAMFileHeader header,final boolean writeHeader,final TaskAttemptContext ctx) throws IOException {
  origOutput=output;
  final URI referenceURI=URI.create(ctx.getConfiguration().get(CRAMInputFormat.REFERENCE_SOURCE_PATH_PROPERTY));
  refSource=new ReferenceSource(Paths.get(referenceURI));
  if (header != null) {
    cramContainerStream=new CRAMContainerStreamWriter(origOutput,null,refSource,header,HADOOP_BAM_PART_ID);
    if (writeHeader) {
      this.writeHeader(header);
    }
  }
}

Fixed version (ground truth):
private void init(final OutputStream output,final SAMFileHeader header,final boolean writeHeader,final TaskAttemptContext ctx) throws IOException {
  origOutput=output;
  this.writeHeader=writeHeader;
  final URI referenceURI=URI.create(ctx.getConfiguration().get(CRAMInputFormat.REFERENCE_SOURCE_PATH_PROPERTY));
  refSource=new ReferenceSource(Paths.get(referenceURI));
  if (header != null) {
    cramContainerStream=new CRAMContainerStreamWriter(origOutput,null,refSource,header,HADOOP_BAM_PART_ID);
    if (writeHeader) {
      this.writeHeader(header);
    }
  }
}
Program: 33507
Project: 33507
Buggy source:
protected void writeAlignment(final SAMRecord rec){
  if (null == cramContainerStream) {
    final SAMFileHeader header=rec.getHeader();
    if (header == null) {
      throw new RuntimeException("String_Node_Str");
    }
    cramContainerStream=new CRAMContainerStreamWriter(origOutput,null,refSource,header,HADOOP_BAM_PART_ID);
  }
  cramContainerStream.writeAlignment(rec);
}

Fixed version (ground truth):
protected void writeAlignment(final SAMRecord rec){
  if (null == cramContainerStream) {
    final SAMFileHeader header=rec.getHeader();
    if (header == null) {
      throw new RuntimeException("String_Node_Str");
    }
    if (writeHeader) {
      this.writeHeader(header);
    }
    cramContainerStream=new CRAMContainerStreamWriter(origOutput,null,refSource,header,HADOOP_BAM_PART_ID);
  }
  cramContainerStream.writeAlignment(rec);
}
Program: 33508
Project: 33508
Buggy source:
public void readSAMHeaderFrom(Path path,Configuration conf) throws IOException {
  this.header=SAMHeaderReader.readSAMHeaderFrom(path,conf);
}

Fixed version (ground truth):
public void readSAMHeaderFrom(InputStream in,Configuration conf){
  this.header=SAMHeaderReader.readSAMHeaderFrom(in,conf);
}
Program: 33509
Project: 33509
Buggy source:
public RecordWriter<K,SAMRecordWritable> getRecordWriter(TaskAttemptContext ctx,Path out) throws IOException {
  return new KeyIgnoringCRAMRecordWriter<K>(out,header,writeHeader,ctx);
}

Fixed version (ground truth):
public RecordWriter<K,SAMRecordWritable> getRecordWriter(TaskAttemptContext ctx,Path out) throws IOException {
  if (this.header == null)   throw new IOException("String_Node_Str");
  return new KeyIgnoringCRAMRecordWriter<K>(out,header,writeHeader,ctx);
}
Program: 33510
Project: 33510
Buggy source:
private int getCRAMRecordCount(final String cramFileName){
  final CRAMFileReader cramReader=new CRAMFileReader(new File(cramFileName),(File)null,testReferenceSource);
  final Iterator<SAMRecord> it=cramReader.getIterator();
  int recCount=0;
  while (it.hasNext()) {
    final SAMRecord rec=it.next();
    recCount++;
  }
  cramReader.close();
  return recCount;
}

Fixed version (ground truth):
private int getCRAMRecordCount(final String cramFileName){
  final CRAMFileReader cramReader=new CRAMFileReader(new File(cramFileName),(File)null,testReferenceSource);
  final Iterator<SAMRecord> it=cramReader.getIterator();
  int recCount=0;
  while (it.hasNext()) {
    it.next();
    recCount++;
  }
  cramReader.close();
  return recCount;
}
Program: 33511
Project: 33511
Buggy source:
private int verifyCRAMContainerStream(final File containerStreamFile,final SAMFileHeader header,final ReferenceSource refSource) throws IOException {
  final ByteArrayInputStream mergedStream=mergeCRAMContainerStream(containerStreamFile,header,refSource);
  final CRAMFileReader resultCRAMReader=new CRAMFileReader(mergedStream,(SeekableStream)null,refSource,ValidationStringency.DEFAULT_STRINGENCY);
  final Iterator<SAMRecord> it=resultCRAMReader.getIterator();
  int actualCount=0;
  while (it.hasNext()) {
    final SAMRecord rec=it.next();
    actualCount++;
  }
  return actualCount;
}

Fixed version (ground truth):
private int verifyCRAMContainerStream(final File containerStreamFile,final SAMFileHeader header,final ReferenceSource refSource,final boolean writeHeader) throws IOException {
  final ByteArrayInputStream mergedStream=mergeCRAMContainerStream(containerStreamFile,header,refSource,writeHeader);
  final CRAMFileReader resultCRAMReader=new CRAMFileReader(mergedStream,(SeekableStream)null,refSource,ValidationStringency.DEFAULT_STRINGENCY);
  final Iterator<SAMRecord> it=resultCRAMReader.getIterator();
  int actualCount=0;
  while (it.hasNext()) {
    it.next();
    actualCount++;
  }
  return actualCount;
}
Program: 33512
Project: 33512
Buggy source:
@Test public void testCRAMRoundTrip() throws Exception {
  Path outputPath=doMapReduce(testCRAMFileName);
  File containerStreamFile=new File(new File(outputPath.toUri()),"String_Node_Str");
  final ByteArrayInputStream cramStream=mergeCRAMContainerStream(containerStreamFile,samFileHeader,testReferenceSource);
  final File outFile=File.createTempFile("String_Node_Str","String_Node_Str");
  outFile.deleteOnExit();
  Files.copy(cramStream,outFile.toPath(),StandardCopyOption.REPLACE_EXISTING);
  outputPath=doMapReduce(outFile.getAbsolutePath());
  containerStreamFile=new File(new File(outputPath.toUri()),"String_Node_Str");
  final int actualCount=verifyCRAMContainerStream(containerStreamFile,samFileHeader,testReferenceSource);
  assertEquals(expectedRecordCount,actualCount);
}

Fixed version (ground truth):
@Test public void testCRAMRoundTrip() throws Exception {
  Path outputPath=doMapReduce(testCRAMFileName);
  File containerStreamFile=new File(new File(outputPath.toUri()),"String_Node_Str");
  final ByteArrayInputStream cramStream=mergeCRAMContainerStream(containerStreamFile,samFileHeader,testReferenceSource,true);
  final File outFile=File.createTempFile("String_Node_Str","String_Node_Str");
  outFile.deleteOnExit();
  Files.copy(cramStream,outFile.toPath(),StandardCopyOption.REPLACE_EXISTING);
  outputPath=doMapReduce(outFile.getAbsolutePath());
  containerStreamFile=new File(new File(outputPath.toUri()),"String_Node_Str");
  final int actualCount=verifyCRAMContainerStream(containerStreamFile,samFileHeader,testReferenceSource,true);
  assertEquals(expectedRecordCount,actualCount);
}
Program: 33513
Project: 33513
Buggy source:
private ByteArrayInputStream mergeCRAMContainerStream(final File containerStreamFile,final SAMFileHeader header,final ReferenceSource refSource) throws IOException {
  final ByteArrayOutputStream cramOutputStream=new ByteArrayOutputStream();
  new SAMOutputPreparer().prepareForRecords(cramOutputStream,SAMFormat.CRAM,header);
  final ByteArrayOutputStream containerOutputStream=new ByteArrayOutputStream();
  Files.copy(containerStreamFile.toPath(),containerOutputStream);
  containerOutputStream.writeTo(cramOutputStream);
  final CRAMContainerStreamWriter containerStreamWriter=new CRAMContainerStreamWriter(cramOutputStream,null,refSource,header,"String_Node_Str");
  containerStreamWriter.finish(true);
  cramOutputStream.close();
  return new ByteArrayInputStream(cramOutputStream.toByteArray());
}

Fixed version (ground truth):
private ByteArrayInputStream mergeCRAMContainerStream(final File containerStreamFile,final SAMFileHeader header,final ReferenceSource refSource,final boolean writeHeader) throws IOException {
  final ByteArrayOutputStream cramOutputStream=new ByteArrayOutputStream();
  if (writeHeader) {
    new SAMOutputPreparer().prepareForRecords(cramOutputStream,SAMFormat.CRAM,header);
  }
  final ByteArrayOutputStream containerOutputStream=new ByteArrayOutputStream();
  Files.copy(containerStreamFile.toPath(),containerOutputStream);
  containerOutputStream.writeTo(cramOutputStream);
  final CRAMContainerStreamWriter containerStreamWriter=new CRAMContainerStreamWriter(cramOutputStream,null,refSource,header,"String_Node_Str");
  containerStreamWriter.finish(true);
  cramOutputStream.close();
  return new ByteArrayInputStream(cramOutputStream.toByteArray());
}
Program: 33514
Project: 33514
Buggy source:
@Test public void testCRAMOutput() throws Exception {
  final Path outputPath=doMapReduce(testCRAMFileName);
  final File containerStreamFile=new File(new File(outputPath.toUri()),"String_Node_Str");
  final int actualCount=verifyCRAMContainerStream(containerStreamFile,samFileHeader,testReferenceSource);
  assertEquals(expectedRecordCount,actualCount);
}

Fixed version (ground truth):
@Test public void testCRAMOutput() throws Exception {
  final Path outputPath=doMapReduce(testCRAMFileName);
  final File containerStreamFile=new File(new File(outputPath.toUri()),"String_Node_Str");
  final int actualCount=verifyCRAMContainerStream(containerStreamFile,samFileHeader,testReferenceSource,true);
  assertEquals(expectedRecordCount,actualCount);
}
Program: 33515
Project: 33515
Buggy source:
private Path doMapReduce(final String inputFile) throws Exception {
  final FileSystem fileSystem=FileSystem.get(conf);
  final Path inputPath=new Path(inputFile);
  final Path outputPath=fileSystem.makeQualified(new Path("String_Node_Str"));
  fileSystem.delete(outputPath,true);
  final Job job=Job.getInstance(conf);
  FileInputFormat.setInputPaths(job,inputPath);
  job.setInputFormatClass(CRAMInputFormat.class);
  job.setMapOutputKeyClass(LongWritable.class);
  job.setMapOutputValueClass(SAMRecordWritable.class);
  job.setOutputFormatClass(KeyIgnoringCRAMOutputFormat.class);
  job.setOutputKeyClass(LongWritable.class);
  job.setOutputValueClass(SAMRecordWritable.class);
  job.setNumReduceTasks(0);
  FileOutputFormat.setOutputPath(job,outputPath);
  final boolean success=job.waitForCompletion(true);
  assertTrue(success);
  return outputPath;
}

Fixed version (ground truth):
private Path doMapReduce(final String inputFile) throws Exception {
  final FileSystem fileSystem=FileSystem.get(conf);
  final Path inputPath=new Path(inputFile);
  final Path outputPath=fileSystem.makeQualified(new Path("String_Node_Str"));
  fileSystem.delete(outputPath,true);
  final Job job=Job.getInstance(conf);
  FileInputFormat.setInputPaths(job,inputPath);
  job.setInputFormatClass(CRAMInputFormat.class);
  job.setMapOutputKeyClass(LongWritable.class);
  job.setMapOutputValueClass(SAMRecordWritable.class);
  conf.set(CRAMTestNoHeaderOutputFormat.READ_HEADER_FROM_FILE,inputFile);
  job.setOutputFormatClass(CRAMTestNoHeaderOutputFormat.class);
  job.setOutputKeyClass(LongWritable.class);
  job.setOutputValueClass(SAMRecordWritable.class);
  job.setNumReduceTasks(0);
  FileOutputFormat.setOutputPath(job,outputPath);
  final boolean success=job.waitForCompletion(true);
  assertTrue(success);
  return outputPath;
}
Program: 33516
Project: 33516
Buggy source:
@Override public boolean nextKeyValue() throws IOException {
  if (reader.getPosition() >= length)   return false;
  final String line=reader.readLine();
  if (line == null)   return false;
  final VariantContext v=codec.decode(line);
  Integer chromIdx=contigDict.get(v.getChr());
  if (chromIdx == null)   chromIdx=(int)MurmurHash3.murmurhash3(v.getChr(),0);
  key.set((long)chromIdx << 32 | (long)(v.getStart() - 1));
  vc.set(v);
  return true;
}

Fixed version (ground truth):
@Override public boolean nextKeyValue() throws IOException {
  if (!it.hasNext())   return false;
  final String line=it.next();
  final VariantContext v=codec.decode(line);
  Integer chromIdx=contigDict.get(v.getChr());
  if (chromIdx == null)   chromIdx=(int)MurmurHash3.murmurhash3(v.getChr(),0);
  key.set((long)chromIdx << 32 | (long)(v.getStart() - 1));
  vc.set(v);
  return true;
}
Program: 33517
Project: 33517
Buggy source:
@Override public void initialize(InputSplit spl,TaskAttemptContext ctx) throws IOException {
  final FileSplit split=(FileSplit)spl;
  this.length=split.getLength();
  final Path file=split.getPath();
  final FileSystem fs=file.getFileSystem(ContextUtil.getConfiguration(ctx));
  final FSDataInputStream ins=fs.open(file);
  reader=new AsciiLineReader(ins);
  final Object h=codec.readHeader(new AsciiLineReaderIterator(reader));
  if (!(h instanceof VCFHeader))   throw new IOException("String_Node_Str" + file);
  contigDict.clear();
  int i=0;
  for (  final VCFContigHeaderLine contig : ((VCFHeader)h).getContigLines())   contigDict.put(contig.getID(),i++);
  final long start=split.getStart();
  if (start != 0) {
    ins.seek(start - 1);
    reader=new AsciiLineReader(ins);
    reader.readLine();
  }
}

Fixed version (ground truth):
@Override public void initialize(InputSplit spl,TaskAttemptContext ctx) throws IOException {
  final FileSplit split=(FileSplit)spl;
  this.length=split.getLength();
  final Path file=split.getPath();
  final FileSystem fs=file.getFileSystem(ContextUtil.getConfiguration(ctx));
  final FSDataInputStream ins=fs.open(file);
  reader=new AsciiLineReader(ins);
  it=new AsciiLineReaderIterator(reader);
  final Object h=codec.readHeader(it);
  if (!(h instanceof FeatureCodecHeader) || !(((FeatureCodecHeader)h).getHeaderValue() instanceof VCFHeader))   throw new IOException("String_Node_Str" + file);
  final VCFHeader header=(VCFHeader)((FeatureCodecHeader)h).getHeaderValue();
  contigDict.clear();
  int i=0;
  for (  final VCFContigHeaderLine contig : header.getContigLines())   contigDict.put(contig.getID(),i++);
  final long start=split.getStart();
  if (start != 0) {
    ins.seek(start - 1);
    reader=new AsciiLineReader(ins);
    it=new AsciiLineReaderIterator(reader);
  }
 else {
    long current_pos=it.getPosition();
    ins.seek(0);
    reader=new AsciiLineReader(ins);
    it=new AsciiLineReaderIterator(reader);
    while (it.hasNext() && it.getPosition() <= current_pos && it.peek().startsWith("String_Node_Str")) {
      it.next();
    }
    if (!it.hasNext() || it.getPosition() > current_pos)     throw new IOException("String_Node_Str" + file);
  }
}
Program: 33518
Project: 33518
Buggy source:
public static VCFHeader readHeaderFrom(final SeekableStream in) throws IOException {
  Object header=null;
  final long initialPos=in.position();
  try {
    header=new VCFCodec().readHeader(new AsciiLineReaderIterator(new AsciiLineReader(in)));
  }
 catch (  TribbleException e) {
    System.err.println("String_Node_Str" + e.toString());
    in.seek(initialPos);
    InputStream bin=new BufferedInputStream(in);
    if (BlockCompressedInputStream.isValidFile(bin))     bin=new BlockCompressedInputStream(bin);
    header=new BCF2Codec().readHeader(new PositionalBufferedStream(bin)).getHeaderValue();
  }
  if (!(header instanceof VCFHeader))   throw new IOException("String_Node_Str");
  return (VCFHeader)header;
}

Fixed version (ground truth):
public static VCFHeader readHeaderFrom(final SeekableStream in) throws IOException {
  Object headerCodec=null;
  Object header=null;
  final long initialPos=in.position();
  try {
    headerCodec=new VCFCodec().readHeader(new AsciiLineReaderIterator(new AsciiLineReader(in)));
  }
 catch (  TribbleException e) {
    System.err.println("String_Node_Str" + e.toString());
    in.seek(initialPos);
    InputStream bin=new BufferedInputStream(in);
    if (BlockCompressedInputStream.isValidFile(bin))     bin=new BlockCompressedInputStream(bin);
    headerCodec=new BCF2Codec().readHeader(new PositionalBufferedStream(bin));
  }
  if (!(headerCodec instanceof FeatureCodecHeader))   throw new IOException("String_Node_Str");
  header=((FeatureCodecHeader)headerCodec).getHeaderValue();
  return (VCFHeader)header;
}
Program: 33523
Project: 33523
Buggy source:
@Test public void testVerifyQualitySangerOutOfRange(){
  frag.setSequence(new Text("String_Node_Str"));
  frag.setQuality(new Text("String_Node_Str"));
  assertEquals(3,SequencedFragment.verifyQuality(frag.getQuality(),FormatConstants.BaseQualityEncoding.Sanger));
  frag.setQuality(new Text("String_Node_Str"));
  assertEquals(5,SequencedFragment.verifyQuality(frag.getQuality(),FormatConstants.BaseQualityEncoding.Sanger));
}

Fixed version (ground truth):
@Test public void testVerifyQualitySangerOutOfRange(){
  frag.setSequence(new Text("String_Node_Str"));
  frag.setQuality(new Text("String_Node_Str" + Character.toString((char)127)));
  assertEquals(29,SequencedFragment.verifyQuality(frag.getQuality(),FormatConstants.BaseQualityEncoding.Sanger));
  frag.setQuality(new Text("String_Node_Str"));
  assertEquals(5,SequencedFragment.verifyQuality(frag.getQuality(),FormatConstants.BaseQualityEncoding.Sanger));
}
Program: 33524
Project: 33524
Buggy source:
@Override public int read(byte[] buf,int off,int len) throws IOException {
  if (headerRemaining) {
    final int h=headerStream.read(buf,off,len);
    if (h != -1)     return h + Math.max(0,streamRead(buf,off + h,len - h));
    headerRemaining=false;
    headerStream.close();
  }
  return streamRead(buf,off,len);
}

Fixed version (ground truth):
@Override public int read(byte[] buf,int off,int len) throws IOException {
  if (headerRemaining) {
    final int h=headerStream.read(buf,off,len);
    if (h < headerLength && h != -1) {
      headerLength-=h;
      return h;
    }
    headerRemaining=false;
    headerStream.close();
    int s=streamRead(buf,off + h,len - h);
    for (int i=0; s > 0 && buf[off + h + i++] == '@'; --s) {
    }
    return h + Math.max(0,s);
  }
  return streamRead(buf,off,len);
}
Program: 33525
Project: 33525
Buggy source:
@Override public void initialize(InputSplit spl,TaskAttemptContext ctx) throws IOException {
  final FileSplit split=(FileSplit)spl;
  this.start=split.getStart();
  this.end=start + split.getLength();
  final Configuration conf=ctx.getConfiguration();
  final Path file=split.getPath();
  final FileSystem fs=file.getFileSystem(conf);
  input=fs.open(file);
  final SAMFileHeader header=new SAMFileReader(input,false).getFileHeader();
  waInput=new WorkaroundingStream(input,header);
  final boolean firstSplit=this.start == 0;
  if (firstSplit) {
    final int headerLength=waInput.getHeaderLength();
    input.seek(headerLength);
    this.start+=headerLength;
  }
 else   input.seek(--this.start);
  waInput.setLength(this.end - this.start);
  iterator=new SAMFileReader(waInput,false).iterator();
  if (!firstSplit) {
    try {
      if (iterator.hasNext())       iterator.next();
    }
 catch (    SAMFormatException e) {
    }
  }
}

Fixed version (ground truth):
@Override public void initialize(InputSplit spl,TaskAttemptContext ctx) throws IOException {
  final FileSplit split=(FileSplit)spl;
  this.start=split.getStart();
  this.end=start + split.getLength();
  final Configuration conf=ctx.getConfiguration();
  final Path file=split.getPath();
  final FileSystem fs=file.getFileSystem(conf);
  input=fs.open(file);
  final SAMFileHeader header=new SAMFileReader(input,false).getFileHeader();
  waInput=new WorkaroundingStream(input,header);
  final boolean firstSplit=this.start == 0;
  if (firstSplit) {
    final int headerLength=waInput.getRemainingHeaderLength();
    input.seek(headerLength);
    this.start+=headerLength;
  }
 else   input.seek(--this.start);
  waInput.setLength(this.end - this.start);
  iterator=new SAMFileReader(waInput,false).iterator();
  if (!firstSplit) {
    try {
      if (iterator.hasNext())       iterator.next();
    }
 catch (    SAMFormatException e) {
    }
  }
}
Program: 33527
Project: 33527
Buggy source:
private int addProbabilisticSplits(List<InputSplit> splits,int i,List<InputSplit> newSplits,Configuration cfg) throws IOException {
  final Path path=((FileSplit)splits.get(i)).getPath();
  final SeekableStream sin=WrapSeekable.openPath(path.getFileSystem(cfg),path);
  final BAMSplitGuesser guesser=new BAMSplitGuesser(sin);
  FileSplit fspl;
  do {
    fspl=(FileSplit)splits.get(i);
    long beg=fspl.getStart();
    long end=beg + fspl.getLength();
    long alignedBeg=guesser.guessNextBAMRecordStart(beg,end);
    newSplits.add(new FileVirtualSplit(path,alignedBeg,end << 16,fspl.getLocations()));
    ++i;
  }
 while (i < splits.size() && fspl.getPath().equals(path));
  sin.close();
  return i;
}

Fixed version (ground truth):
private int addProbabilisticSplits(List<InputSplit> splits,int i,List<InputSplit> newSplits,Configuration cfg) throws IOException {
  final Path path=((FileSplit)splits.get(i)).getPath();
  final SeekableStream sin=WrapSeekable.openPath(path.getFileSystem(cfg),path);
  final BAMSplitGuesser guesser=new BAMSplitGuesser(sin);
  for (; i < splits.size(); ++i) {
    FileSplit fspl=(FileSplit)splits.get(i);
    if (!fspl.getPath().equals(path))     break;
    long beg=fspl.getStart();
    long end=beg + fspl.getLength();
    long alignedBeg=guesser.guessNextBAMRecordStart(beg,end);
    long alignedEnd=end << 16 | 0xffff;
    newSplits.add(new FileVirtualSplit(path,alignedBeg,alignedEnd,fspl.getLocations()));
  }
  sin.close();
  return i;
}
Program: 33528
Project: 33528
Buggy source:
private int addIndexedSplits(List<InputSplit> splits,int i,List<InputSplit> newSplits,Configuration cfg) throws IOException {
  final Path file=((FileSplit)splits.get(i)).getPath();
  final SplittingBAMIndex idx=new SplittingBAMIndex(file.getFileSystem(cfg).open(getIdxPath(file)));
  int splitsEnd=splits.size();
  for (int j=i; j < splitsEnd; ++j)   if (!file.equals(((FileSplit)splits.get(j)).getPath()))   splitsEnd=j;
  for (int j=i; j < splitsEnd; ++j) {
    final FileSplit fileSplit=(FileSplit)splits.get(j);
    final long start=fileSplit.getStart();
    final long end=start + fileSplit.getLength();
    final Long blockStart=j == i ? idx.nextAlignment(0) : idx.prevAlignment(start);
    final Long blockEnd=j == splitsEnd - 1 ? idx.prevAlignment(end) : idx.nextAlignment(end);
    if (blockStart == null)     throw new RuntimeException("String_Node_Str" + start);
    if (blockEnd == null)     throw new RuntimeException("String_Node_Str" + end);
    newSplits.add(new FileVirtualSplit(file,blockStart,blockEnd,fileSplit.getLocations()));
  }
  return splitsEnd;
}

Fixed version (ground truth):
private int addIndexedSplits(List<InputSplit> splits,int i,List<InputSplit> newSplits,Configuration cfg) throws IOException {
  final Path file=((FileSplit)splits.get(i)).getPath();
  final SplittingBAMIndex idx=new SplittingBAMIndex(file.getFileSystem(cfg).open(getIdxPath(file)));
  int splitsEnd=splits.size();
  for (int j=i; j < splitsEnd; ++j)   if (!file.equals(((FileSplit)splits.get(j)).getPath()))   splitsEnd=j;
  for (int j=i; j < splitsEnd; ++j) {
    final FileSplit fileSplit=(FileSplit)splits.get(j);
    final long start=fileSplit.getStart();
    final long end=start + fileSplit.getLength();
    final Long blockStart=idx.nextAlignment(start);
    final Long blockEnd=j == splitsEnd - 1 ? idx.prevAlignment(end) | 0xffff : idx.nextAlignment(end);
    if (blockStart == null)     throw new RuntimeException("String_Node_Str" + start);
    if (blockEnd == null)     throw new RuntimeException("String_Node_Str" + end);
    newSplits.add(new FileVirtualSplit(file,blockStart,blockEnd,fileSplit.getLocations()));
  }
  return splitsEnd;
}
Program: 33529
Project: 33529
Buggy source:
private void mergeOutputs(Path outPath,boolean forceLocal) throws IOException {
  System.out.println("String_Node_Str");
  t.start();
  final Configuration conf=getConf();
  final FileSystem srcFS=wrkDirPath.getFileSystem(conf);
  FileSystem dstFS=outPath.getFileSystem(conf);
  if (forceLocal)   dstFS=FileSystem.getLocal(conf).getRaw();
  final Timer tl=new Timer();
  for (  String lvl : levels) {
    tl.start();
    final String lvlName=getSummaryName(lvl);
    final OutputStream outs=dstFS.create(new Path(outPath,lvlName));
    final FileStatus[] parts=srcFS.globStatus(new Path(wrkDirPath,lvlName + "String_Node_Str"));
    for (    final FileStatus part : parts) {
      final InputStream ins=srcFS.open(part.getPath());
      IOUtils.copyBytes(ins,outs,conf,false);
      ins.close();
    }
    for (    final FileStatus part : parts)     srcFS.delete(part.getPath(),false);
    outs.write(BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK);
    outs.close();
    System.out.printf("String_Node_Str",lvl,tl.stopS(),tl.fms());
  }
  System.out.printf("String_Node_Str",t.stopS(),t.fms());
}

Fixed version (ground truth):
private void mergeOutputs(Path outPath,boolean forceLocal) throws IOException {
  System.out.println("String_Node_Str");
  t.start();
  final Configuration conf=getConf();
  final FileSystem srcFS=wrkDir.getFileSystem(conf);
  FileSystem dstFS=outPath.getFileSystem(conf);
  if (forceLocal)   dstFS=FileSystem.getLocal(conf).getRaw();
  final Timer tl=new Timer();
  for (  String lvl : levels) {
    tl.start();
    final String lvlName=getSummaryName(lvl);
    final OutputStream outs=dstFS.create(new Path(outPath,lvlName));
    final FileStatus[] parts=srcFS.globStatus(new Path(sorted ? getSortOutputDir(level) : wrkDir,lvlName + "String_Node_Str"));
    for (    final FileStatus part : parts) {
      final InputStream ins=srcFS.open(part.getPath());
      IOUtils.copyBytes(ins,outs,conf,false);
      ins.close();
    }
    for (    final FileStatus part : parts)     srcFS.delete(part.getPath(),false);
    outs.write(BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK);
    outs.close();
    System.out.printf("String_Node_Str",lvl,tl.stopS(),tl.fms());
  }
  System.out.printf("String_Node_Str",t.stopS(),t.fms());
}
Program: 33530
Project: 33530
Buggy source:
private Job sortMerged(String lvl,Path mergedTmp) throws IOException, ClassNotFoundException, InterruptedException {
  final Configuration conf=getConf();
  conf.set(SortOutputFormat.OUTPUT_NAME_PROP,mergedTmp.getName());
  setSamplingConf(mergedTmp,conf);
  final Job job=new Job(conf);
  job.setJarByClass(Summarize.class);
  job.setMapperClass(Mapper.class);
  job.setReducerClass(SortReducer.class);
  job.setMapOutputKeyClass(LongWritable.class);
  job.setOutputKeyClass(NullWritable.class);
  job.setOutputValueClass(Text.class);
  job.setInputFormatClass(SortInputFormat.class);
  job.setOutputFormatClass(SortOutputFormat.class);
  FileInputFormat.setInputPaths(job,mergedTmp);
  FileOutputFormat.setOutputPath(job,wrkDirPath);
  job.setPartitionerClass(TotalOrderPartitioner.class);
  System.out.printf("String_Node_Str",lvl);
  t.start();
  InputSampler.<LongWritable,Text>writePartitionFile(job,new InputSampler.SplitSampler<LongWritable,Text>(1 << 16,10));
  System.out.printf("String_Node_Str",t.stopS(),t.fms());
  job.submit();
  return job;
}

Fixed version (ground truth):
private Job sortMerged(String lvl,Path mergedTmp) throws IOException, ClassNotFoundException, InterruptedException {
  final Configuration conf=getConf();
  conf.set(SortOutputFormat.OUTPUT_NAME_PROP,mergedTmp.getName());
  setSamplingConf(mergedTmp,conf);
  final Job job=new Job(conf);
  job.setJarByClass(Summarize.class);
  job.setMapperClass(Mapper.class);
  job.setReducerClass(SortReducer.class);
  job.setMapOutputKeyClass(LongWritable.class);
  job.setOutputKeyClass(NullWritable.class);
  job.setOutputValueClass(Text.class);
  job.setInputFormatClass(SortInputFormat.class);
  job.setOutputFormatClass(SortOutputFormat.class);
  FileInputFormat.setInputPaths(job,mergedTmp);
  FileOutputFormat.setOutputPath(job,getSortOutputDir(lvl));
  job.setPartitionerClass(TotalOrderPartitioner.class);
  System.out.printf("String_Node_Str",lvl);
  t.start();
  InputSampler.<LongWritable,Text>writePartitionFile(job,new InputSampler.SplitSampler<LongWritable,Text>(1 << 16,10));
  System.out.printf("String_Node_Str",t.stopS(),t.fms());
  job.submit();
  return job;
}
Program: 33532
Project: 33532
Buggy source:
private boolean doSorting(Path sortedTmpDir) throws ClassNotFoundException, InterruptedException {
  final Configuration conf=getConf();
  final Job[] jobs=new Job[levels.length];
  boolean errors=false;
  for (int i=0; i < levels.length; ++i) {
    final String l=levels[i];
    try {
      jobs[i]=sortMerged(l,new Path(sortedTmpDir,getSummaryName(l)));
    }
 catch (    IOException e) {
      System.err.printf("String_Node_Str",l,e);
      if (i == 0)       return false;
 else       errors=true;
    }
  }
  System.out.println("String_Node_Str");
  t.start();
  for (int i=levels.length; i-- > 0; ) {
    boolean success;
    try {
      success=jobs[i].waitForCompletion(verbose);
    }
 catch (    IOException e) {
      success=false;
    }
    final String l=levels[i];
    if (!success) {
      System.err.printf("String_Node_Str",l);
      errors=true;
      continue;
    }
    System.out.printf("String_Node_Str",l);
    final Path mergedTmp=FileInputFormat.getInputPaths(jobs[i])[0];
    try {
      mergedTmp.getFileSystem(conf).delete(mergedTmp,false);
    }
 catch (    IOException e) {
      System.err.printf("String_Node_Str",mergedTmp);
    }
  }
  if (errors)   return false;
  System.out.printf("String_Node_Str",t.stopS(),t.fms());
  return true;
}

Fixed version (ground truth):
private boolean doSorting(Path inputDir) throws ClassNotFoundException, InterruptedException {
  final Configuration conf=getConf();
  final Job[] jobs=new Job[levels.length];
  boolean errors=false;
  for (int i=0; i < levels.length; ++i) {
    final String lvl=levels[i];
    try {
      jobs[i]=sortMerged(lvl,new Path(inputDir,getSummaryName(lvl)));
    }
 catch (    IOException e) {
      System.err.printf("String_Node_Str",lvl,e);
      if (i == 0)       return false;
 else       errors=true;
    }
  }
  System.out.println("String_Node_Str");
  t.start();
  for (int i=levels.length; i-- > 0; ) {
    boolean success;
    try {
      success=jobs[i].waitForCompletion(verbose);
    }
 catch (    IOException e) {
      success=false;
    }
    final String l=levels[i];
    if (!success) {
      System.err.printf("String_Node_Str",l);
      errors=true;
      continue;
    }
    System.out.printf("String_Node_Str",l);
  }
  if (errors)   return false;
  System.out.printf("String_Node_Str",t.stopS(),t.fms());
  return true;
}
Program: 33533
Project: 33533
Buggy source:
private boolean runSummary(Path bamPath) throws IOException, ClassNotFoundException, InterruptedException {
  final Configuration conf=getConf();
  setSamplingConf(bamPath,conf);
  final Job job=new Job(conf);
  job.setJarByClass(Summarize.class);
  job.setMapperClass(Mapper.class);
  job.setReducerClass(SummarizeReducer.class);
  job.setMapOutputKeyClass(LongWritable.class);
  job.setMapOutputValueClass(Range.class);
  job.setOutputKeyClass(NullWritable.class);
  job.setOutputValueClass(RangeCount.class);
  job.setInputFormatClass(SummarizeInputFormat.class);
  job.setOutputFormatClass(SummarizeOutputFormat.class);
  FileInputFormat.setInputPaths(job,bamPath);
  FileOutputFormat.setOutputPath(job,wrkDirPath);
  job.setPartitionerClass(TotalOrderPartitioner.class);
  System.out.println("String_Node_Str");
  t.start();
  InputSampler.<LongWritable,Range>writePartitionFile(job,new InputSampler.SplitSampler<LongWritable,Range>(1 << 16,10));
  System.out.printf("String_Node_Str",t.stopS(),t.fms());
  for (  String lvl : levels)   MultipleOutputs.addNamedOutput(job,"String_Node_Str" + lvl,SummarizeOutputFormat.class,NullWritable.class,Range.class);
  job.submit();
  System.out.println("String_Node_Str");
  t.start();
  if (!job.waitForCompletion(verbose)) {
    System.err.println("String_Node_Str");
    return false;
  }
  System.out.printf("String_Node_Str",t.stopS(),t.fms());
  return true;
}

Fixed version (ground truth):
private boolean runSummary(Path bamPath) throws IOException, ClassNotFoundException, InterruptedException {
  final Configuration conf=getConf();
  setSamplingConf(bamPath,conf);
  final Job job=new Job(conf);
  job.setJarByClass(Summarize.class);
  job.setMapperClass(Mapper.class);
  job.setReducerClass(SummarizeReducer.class);
  job.setMapOutputKeyClass(LongWritable.class);
  job.setMapOutputValueClass(Range.class);
  job.setOutputKeyClass(NullWritable.class);
  job.setOutputValueClass(RangeCount.class);
  job.setInputFormatClass(SummarizeInputFormat.class);
  job.setOutputFormatClass(SummarizeOutputFormat.class);
  FileInputFormat.setInputPaths(job,bamPath);
  FileOutputFormat.setOutputPath(job,wrkDir);
  job.setPartitionerClass(TotalOrderPartitioner.class);
  System.out.println("String_Node_Str");
  t.start();
  InputSampler.<LongWritable,Range>writePartitionFile(job,new InputSampler.SplitSampler<LongWritable,Range>(1 << 16,10));
  System.out.printf("String_Node_Str",t.stopS(),t.fms());
  for (  String lvl : levels)   MultipleOutputs.addNamedOutput(job,"String_Node_Str" + lvl,SummarizeOutputFormat.class,NullWritable.class,Range.class);
  job.submit();
  System.out.println("String_Node_Str");
  t.start();
  if (!job.waitForCompletion(verbose)) {
    System.err.println("String_Node_Str");
    return false;
  }
  System.out.printf("String_Node_Str",t.stopS(),t.fms());
  return true;
}
Program: 33534
Project: 33534
Buggy source:
public static void usage(PrintStream out,Map<String,CLIPlugin> plugins){
  out.printf("String_Node_Str",VERSION_MAJOR,VERSION_MINOR);
  out.printf("String_Node_Str",Utils.getArgv0());
  int cmdLen=0;
  for (  final String cmd : plugins.keySet())   cmdLen=Math.max(cmdLen,cmd.length());
  final String cmdFmt="String_Node_Str" + cmdLen + "String_Node_Str";
  out.print("String_Node_Str");
  final int descPos="String_Node_Str".length() + 2;
  boolean first=true;
  for (  Map.Entry<String,CLIPlugin> entry : plugins.entrySet()) {
    if (first)     first=false;
 else     for (int i=descPos; i-- > 0; )     out.print(' ');
    out.printf(cmdFmt,entry.getKey());
    Utils.printWrapped(out,entry.getValue().getDescription(),descPos);
  }
}

Fixed version (ground truth):
public static void usage(PrintStream out,Map<String,CLIPlugin> plugins){
  out.printf("String_Node_Str",VERSION_MAJOR,VERSION_MINOR);
  out.printf("String_Node_Str",Utils.getArgv0());
  int cmdLen=0;
  for (  final String cmd : plugins.keySet())   cmdLen=Math.max(cmdLen,cmd.length());
  final String cmdFmt="String_Node_Str" + cmdLen + "String_Node_Str";
  out.print("String_Node_Str");
  final int cmdPos="String_Node_Str".length(), descPos=cmdPos + cmdLen + 2;
  boolean first=true;
  for (  Map.Entry<String,CLIPlugin> entry : plugins.entrySet()) {
    if (first)     first=false;
 else     for (int i=cmdPos; i-- > 0; )     out.print(' ');
    out.printf(cmdFmt,entry.getKey());
    Utils.printWrapped(out,entry.getValue().getDescription(),descPos);
  }
}
Program: 33536
Project: 33536
Buggy source:
@Override public IMessage onMessage(MessageJetpackSync msg,MessageContext ctx){
  Entity entity=FMLClientHandler.instance().getClient().theWorld.getEntityByID(msg.entityId);
  if (entity != null && entity instanceof EntityLivingBase) {
    if (msg.particleId >= 0) {
      JetpackParticleType particle=JetpackParticleType.values()[msg.particleId];
      SyncTracker.processJetpackUpdate(msg.entityId,particle);
    }
 else {
      SyncTracker.processJetpackUpdate(msg.entityId,null);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public IMessage onMessage(MessageJetpackSync msg,MessageContext ctx){
  Entity entity=FMLClientHandler.instance().getClient().theWorld.getEntityByID(msg.entityId);
  if (entity != null && entity instanceof EntityLivingBase && entity != FMLClientHandler.instance().getClient().thePlayer) {
    if (msg.particleId >= 0) {
      JetpackParticleType particle=JetpackParticleType.values()[msg.particleId];
      SyncTracker.processJetpackUpdate(msg.entityId,particle);
    }
 else {
      SyncTracker.processJetpackUpdate(msg.entityId,null);
    }
  }
  return null;
}
Program: 33537
Project: 33537
Buggy source:
@SubscribeEvent public void mobUseJetpack(LivingUpdateEvent evt){
  if (evt.entityLiving instanceof EntityMob) {
    ItemStack armor=evt.entityLiving.getEquipmentInSlot(3);
    if (armor != null && armor.getItem() instanceof ItemJetpack) {
      ItemJetpack jetpackItem=(ItemJetpack)armor.getItem();
      Jetpack jetpack=jetpackItem.getJetpack(armor);
      if (jetpack != null) {
        if (jetpack instanceof JetpackPotato || rand.nextInt(3) == 0) {
          jetpack.setMobMode(armor);
          jetpack.useJetpack(evt.entityLiving,armor,jetpackItem,false);
        }
      }
      if (evt.entityLiving.posY > evt.entityLiving.worldObj.getActualHeight() + 10) {
        evt.entityLiving.attackEntityFrom(DamageSource.generic,80);
      }
    }
  }
}

Fixed version (ground truth):
@SubscribeEvent public void mobUseJetpack(LivingUpdateEvent evt){
  if (!evt.entityLiving.worldObj.isRemote && evt.entityLiving instanceof EntityMob) {
    ItemStack armor=evt.entityLiving.getEquipmentInSlot(3);
    if (armor != null && armor.getItem() instanceof ItemJetpack) {
      ItemJetpack jetpackItem=(ItemJetpack)armor.getItem();
      Jetpack jetpack=jetpackItem.getJetpack(armor);
      if (jetpack != null) {
        if (jetpack instanceof JetpackPotato || rand.nextInt(3) == 0) {
          jetpack.setMobMode(armor);
          jetpack.useJetpack(evt.entityLiving,armor,jetpackItem,false);
        }
      }
      if (evt.entityLiving.posY > evt.entityLiving.worldObj.getActualHeight() + 10) {
        evt.entityLiving.attackEntityFrom(DamageSource.generic,80);
      }
    }
  }
}
Program: 33540
Project: 33540
Buggy source:
@Override public ArmorProperties getProperties(EntityLivingBase player,ItemStack armor,DamageSource source,double damage,int slot){
  int maxAbsorbed=this.getEnergyStored(armor) / this.energyPerDamage * 100;
  return new ArmorProperties(0,this.armorAbsorption,maxAbsorbed);
}

Fixed version (ground truth):
@Override public ArmorProperties getProperties(EntityLivingBase player,ItemStack armor,DamageSource source,double damage,int slot){
  if (this.energyPerDamage != 0) {
    int maxAbsorbed=this.getEnergyStored(armor) / this.energyPerDamage * 100;
    return new ArmorProperties(0,this.armorAbsorption,maxAbsorbed);
  }
 else {
    int maxAbsorbed=12500000;
    return new ArmorProperties(0,this.armorAbsorption,maxAbsorbed);
  }
}
Program: 33541
Project: 33541
Buggy source:
/** 
 * Determines whether this instance contains the given character.
 * @param c the character to check for
 * @return true if this instance contains c
 */
public boolean contains(final char c){
  final int index=Arrays.binarySearch(chars,c);
  return (index == -1) == subtractive;
}

Fixed version (ground truth):
/** 
 * Determines whether this instance contains the given character.
 * @param c the character to check for
 * @return true if this instance contains c
 */
public boolean contains(final char c){
  final int index=Arrays.binarySearch(chars,c);
  return index < 0 == subtractive;
}
Program: 33542
Project: 33542
Buggy source:
/** 
 * Kickstart a   {@code join} rule<p>Like  {@link #join(Object)}, except that several rules are accepted as arguments.</p>
 * @param rule first rule
 * @param rule2 second rule
 * @param moreRules other rules
 * @return a {@link JoinMatcherBootstrap}
 * @see #sequence(Object,Object,Object)
 */
public final JoinMatcherBootstrap<V,BaseParser<V>> join(final Object rule,final Object rule2,final Object moreRules){
  Objects.requireNonNull(moreRules);
  return join(sequence(rule,rule2,moreRules));
}

Fixed version (ground truth):
/** 
 * Kickstart a   {@code join} rule<p>Like  {@link #join(Object)}, except that several rules are accepted as arguments.</p>
 * @param rule first rule
 * @param rule2 second rule
 * @param moreRules other rules
 * @return a {@link JoinMatcherBootstrap}
 * @see #sequence(Object,Object,Object)
 */
public final JoinMatcherBootstrap<V,BaseParser<V>> join(final Object rule,final Object rule2,final Object... moreRules){
  Objects.requireNonNull(moreRules);
  return join(sequence(rule,rule2,moreRules));
}
Program: 33543
Project: 33543
Buggy source:
/** 
 * Core search method <p>This method uses a   {@link CharBuffer} to perform searches, and changesthis buffer's position as the match progresses. The two other arguments are the depth of the current search (ie the number of nodes visited since root) and the index of the last node where a match was found (ie the last node where  {@link #fullWord} was true.</p>
 * @param buffer the charbuffer
 * @param matchedLength the last matched length (-1 if no match yet)
 * @param currentLength the current length walked by the trie
 * @return the length of the match found, -1 otherwise
 */
private int doSearch(final CharBuffer buffer,final int matchedLength,final int currentLength,final boolean ignoreCase){
  final int nextLength=fullWord ? currentLength : matchedLength;
  if (!buffer.hasRemaining())   return nextLength;
  char c=buffer.get();
  int index=Arrays.binarySearch(nextChars,c);
  if (index == -1 && ignoreCase) {
    final boolean isUpper=Character.isUpperCase(c);
    final boolean isLower=Character.isLowerCase(c);
    if (isUpper != isLower) {
      c=isUpper ? Character.toLowerCase(c) : Character.toUpperCase(c);
      index=Arrays.binarySearch(nextChars,c);
    }
  }
  if (index < 0)   return nextLength;
  return nextNodes[index].doSearch(buffer,nextLength,currentLength + 1,ignoreCase);
}

Fixed version (ground truth):
/** 
 * Core search method <p>This method uses a   {@link CharBuffer} to perform searches, and changesthis buffer's position as the match progresses. The two other arguments are the depth of the current search (ie the number of nodes visited since root) and the index of the last node where a match was found (ie the last node where  {@link #fullWord} was true.</p>
 * @param buffer the charbuffer
 * @param matchedLength the last matched length (-1 if no match yet)
 * @param currentLength the current length walked by the trie
 * @return the length of the match found, -1 otherwise
 */
private int doSearch(final CharBuffer buffer,final int matchedLength,final int currentLength,final boolean ignoreCase){
  final int nextLength=fullWord ? currentLength : matchedLength;
  if (!buffer.hasRemaining())   return nextLength;
  char c=buffer.get();
  int index=Arrays.binarySearch(nextChars,c);
  if (index < 0 && ignoreCase) {
    final boolean isUpper=Character.isUpperCase(c);
    final boolean isLower=Character.isLowerCase(c);
    if (isUpper != isLower) {
      c=isUpper ? Character.toLowerCase(c) : Character.toUpperCase(c);
      index=Arrays.binarySearch(nextChars,c);
    }
  }
  if (index < 0)   return nextLength;
  return nextNodes[index].doSearch(buffer,nextLength,currentLength + 1,ignoreCase);
}