nus-yam/ex-repair huggingface dataset:
Program: 30681
Project: 30681
Buggy source:
public void setLibrary(final String value){
  setAttribute("String_Node_Str",value);
}

Fixed version (ground truth):
public void setLibrary(final String value){
  setAttribute(LIBRARY_TAG,value);
}
Program: 30682
Project: 30682
Buggy source:
@Test(dataProvider="String_Node_Str") public void differentIds(GroupAdapter adapter) throws Exception {
  final String[] groupIds={"String_Node_Str","String_Node_Str"};
  final List<? extends AbstractSAMHeaderRecord> groups=adapter.createGroups(groupIds);
  Assert.assertEquals(groups.size(),2);
  int i=0;
  for (  final AbstractSAMHeaderRecord g : groups) {
    System.out.println("String_Node_Str" + adapter.getGroupId(g));
    Assert.assertEquals(groupIds[i],adapter.getGroupId(g));
    i++;
  }
}

Fixed version (ground truth):
@Test(dataProvider="String_Node_Str") public void differentIds(GroupAdapter adapter) throws Exception {
  final String[] groupIds={"String_Node_Str","String_Node_Str"};
  final List<? extends AbstractSAMHeaderRecord> groups=adapter.createGroups(groupIds);
  Assert.assertEquals(groups.size(),2);
  int i=0;
  for (  final AbstractSAMHeaderRecord g : groups) {
    Assert.assertEquals(groupIds[i],adapter.getGroupId(g));
    i++;
  }
}
Program: 30684
Project: 30684
Buggy source:
/** 
 * Create SAMFileHeader with additional information.
 * @param readers sam file readers to combine
 * @param sortOrder sort order new header should have
 * @param mergeDictionaries If true, merge sequence dictionaries in new header.  If false, require thatall input sequence dictionaries be identical.
 */
public SamFileHeaderMerger(final Collection<SAMFileReader> readers,final SAMFileHeader.SortOrder sortOrder,final boolean mergeDictionaries){
  this.readers=readers;
  this.mergedHeader=new SAMFileHeader();
  SAMSequenceDictionary sequenceDictionary=null;
  try {
    sequenceDictionary=getSequenceDictionary(readers);
    this.hasMergedSequenceDictionary=false;
  }
 catch (  SequenceUtil.SequenceListsDifferException pe) {
    if (mergeDictionaries) {
      sequenceDictionary=mergeSequenceDictionaries(readers);
      this.hasMergedSequenceDictionary=true;
    }
 else {
      throw pe;
    }
  }
  this.mergedHeader.setSequenceDictionary(sequenceDictionary);
  for (  final SAMProgramRecord program : mergeProgramGroups(readers)) {
    this.mergedHeader.addProgramRecord(program);
  }
  final List<SAMReadGroupRecord> readGroups=mergeReadGroups(readers);
  this.mergedHeader.setReadGroups(readGroups);
  this.mergedHeader.setGroupOrder(SAMFileHeader.GroupOrder.none);
  this.mergedHeader.setSortOrder(sortOrder);
  for (  final SAMFileReader reader : readers) {
    for (    final String comment : reader.getFileHeader().getComments()) {
      this.mergedHeader.addComment(comment);
    }
  }
}

Fixed version (ground truth):
/** 
 * Create SAMFileHeader with additional information.
 * @param readers sam file readers to combine
 * @param sortOrder sort order new header should have
 * @param mergeDictionaries If true, merge sequence dictionaries in new header.  If false, require thatall input sequence dictionaries be identical.
 */
public SamFileHeaderMerger(final Collection<SAMFileReader> readers,final SAMFileHeader.SortOrder sortOrder,final boolean mergeDictionaries){
  this.readers=readers;
  this.mergedHeader=new SAMFileHeader();
  SAMSequenceDictionary sequenceDictionary;
  try {
    sequenceDictionary=getSequenceDictionary(readers);
    this.hasMergedSequenceDictionary=false;
  }
 catch (  SequenceUtil.SequenceListsDifferException pe) {
    if (mergeDictionaries) {
      sequenceDictionary=mergeSequenceDictionaries(readers);
      this.hasMergedSequenceDictionary=true;
    }
 else {
      throw pe;
    }
  }
  this.mergedHeader.setSequenceDictionary(sequenceDictionary);
  for (  final SAMProgramRecord program : mergeProgramGroups(readers)) {
    this.mergedHeader.addProgramRecord(program);
  }
  final List<SAMReadGroupRecord> readGroups=mergeReadGroups(readers);
  this.mergedHeader.setReadGroups(readGroups);
  this.mergedHeader.setGroupOrder(SAMFileHeader.GroupOrder.none);
  this.mergedHeader.setSortOrder(sortOrder);
  for (  final SAMFileReader reader : readers) {
    for (    final String comment : reader.getFileHeader().getComments()) {
      this.mergedHeader.addComment(comment);
    }
  }
}
Program: 30685
Project: 30685
Buggy source:
/** 
 * They've asked to merge the sequence headers.  What we support right now is finding the sequence name superset.
 * @param currentDict the current dictionary, though merged entries are the superset of both dictionaries
 * @param mergingDict the sequence dictionary to merge
 * @return the superset dictionary, by sequence names
 */
private SAMSequenceDictionary mergeSequences(SAMSequenceDictionary currentDict,SAMSequenceDictionary mergingDict){
  LinkedList<SAMSequenceRecord> resultingDict=new LinkedList<SAMSequenceRecord>();
  LinkedList<String> resultingDictStr=new LinkedList<String>();
  LinkedList<SAMSequenceRecord> holder=new LinkedList<SAMSequenceRecord>();
  resultingDict.addAll(currentDict.getSequences());
  for (  SAMSequenceRecord r : resultingDict) {
    resultingDictStr.add(r.getSequenceName());
  }
  for (  SAMSequenceRecord record : mergingDict.getSequences()) {
    if (resultingDictStr.contains(record.getSequenceName())) {
      int loc=resultingDictStr.indexOf(record.getSequenceName());
      resultingDict.addAll(loc,holder);
      holder.clear();
    }
 else {
      holder.add(record.clone());
    }
  }
  if (holder.size() != 0) {
    resultingDict.addAll(holder);
  }
  return new SAMSequenceDictionary(resultingDict);
}

Fixed version (ground truth):
/** 
 * They've asked to merge the sequence headers.  What we support right now is finding the sequence name superset.
 * @param mergeIntoDict the result of merging so far.  All SAMSequenceRecords in here have been cloned from the originals.
 * @param mergeFromDict A new sequence dictionary to merge into mergeIntoDict.
 * @return A new sequence dictionary that resulting from merging the two inputs.
 */
private SAMSequenceDictionary mergeSequences(SAMSequenceDictionary mergeIntoDict,SAMSequenceDictionary mergeFromDict){
  LinkedList<SAMSequenceRecord> holder=new LinkedList<SAMSequenceRecord>();
  LinkedList<SAMSequenceRecord> resultingDict=new LinkedList<SAMSequenceRecord>();
  for (  final SAMSequenceRecord sequenceRecord : mergeIntoDict.getSequences()) {
    resultingDict.add(sequenceRecord);
  }
  int prevloc=-1;
  SAMSequenceRecord previouslyMerged=null;
  for (  SAMSequenceRecord sequenceRecord : mergeFromDict.getSequences()) {
    int loc=getIndexOfSequenceName(resultingDict,sequenceRecord.getSequenceName());
    if (loc == -1) {
      holder.add(sequenceRecord.clone());
    }
 else     if (prevloc > loc) {
      throw new PicardException("String_Node_Str" + sequenceRecord.getSequenceName() + "String_Node_Str"+ previouslyMerged.getSequenceName()+ "String_Node_Str");
    }
 else {
      resultingDict.addAll(loc,holder);
      prevloc=loc + holder.size();
      previouslyMerged=sequenceRecord;
      holder.clear();
    }
  }
  if (holder.size() != 0) {
    resultingDict.addAll(holder);
  }
  return new SAMSequenceDictionary(resultingDict);
}
Program: 30686
Project: 30686
Buggy source:
public BlockCompressedInputStream(final URL url){
  mFile=new SeekableHTTPStream(url);
  mStream=null;
}

Fixed version (ground truth):
public BlockCompressedInputStream(final URL url){
  mFile=new SeekableBufferedStream(new SeekableHTTPStream(url));
  mStream=null;
}
Program: 30687
Project: 30687
Buggy source:
public int read(byte[] buffer,int offset,int length) throws IOException {
  int nBytesRead=bufferedStream.read(buffer,offset,length);
  position+=nBytesRead;
  return nBytesRead;
}

Fixed version (ground truth):
public int read(byte[] buffer,int offset,int length) throws IOException {
  int nBytesRead=bufferedStream.read(buffer,offset,length);
  if (nBytesRead > 0) {
    position+=nBytesRead;
  }
  return nBytesRead;
}
Program: 30688
Project: 30688
Buggy source:
public SeekableHTTPStream(final URL url){
  this.url=url;
  final String contentLengthString=HttpUtils.getHeaderField(url,"String_Node_Str");
  if (contentLengthString != null) {
    try {
      contentLength=Long.parseLong(contentLengthString);
    }
 catch (    NumberFormatException ignored) {
    }
  }
}

Fixed version (ground truth):
public SeekableHTTPStream(final URL url){
  this.url=url;
  final String contentLengthString=HttpUtils.getHeaderField(url,"String_Node_Str");
  if (contentLengthString != null) {
    try {
      contentLength=Long.parseLong(contentLengthString);
    }
 catch (    NumberFormatException ignored) {
      System.out.println("String_Node_Str" + contentLengthString + "String_Node_Str"+ url);
      contentLength=-1;
    }
  }
}
Program: 30690
Project: 30690
Buggy source:
/** 
 * Read from input until input is exhausted, EOLN is seen, or output buffer is filled
 * @param outputBuffer where to put bytes read
 * @param startOutputIndex where to start putting bytes read
 * @return number of bytes read
 */
public int readToEndOfOutputBufferOrEoln(final byte[] outputBuffer,final int startOutputIndex){
  boolean sawNewline;
  int totalGrabbed=0;
  do {
    if (!ensureBufferNotEmpty()) {
      break;
    }
    final int startInputIndex=nextByte;
    sawNewline=advanceToEobOrEoln();
    int lengthOfChunk=nextByte - startInputIndex;
    if (lengthOfChunk > outputBuffer.length - startOutputIndex) {
      lengthOfChunk=outputBuffer.length - startOutputIndex;
      nextByte=startInputIndex + lengthOfChunk;
    }
    System.arraycopy(fileBuffer,startInputIndex,outputBuffer,startOutputIndex + totalGrabbed,lengthOfChunk);
    totalGrabbed+=lengthOfChunk;
  }
 while (!sawNewline && totalGrabbed < outputBuffer.length - startOutputIndex);
  ensureBufferNotEmpty();
  return totalGrabbed;
}

Fixed version (ground truth):
/** 
 * Read from input until input is exhausted, EOLN is seen, or output buffer is filled
 * @param outputBuffer where to put bytes read
 * @param startOutputIndex where to start putting bytes read
 * @return number of bytes read
 */
public int readToEndOfOutputBufferOrEoln(final byte[] outputBuffer,final int startOutputIndex){
  boolean sawNewline;
  int totalGrabbed=0;
  do {
    if (!ensureBufferNotEmpty()) {
      break;
    }
    final int startInputIndex=nextByte;
    sawNewline=advanceToEobOrEoln();
    int lengthOfChunk=nextByte - startInputIndex;
    if (lengthOfChunk > outputBuffer.length - (startOutputIndex + totalGrabbed)) {
      lengthOfChunk=outputBuffer.length - (startOutputIndex + totalGrabbed);
      nextByte=startInputIndex + lengthOfChunk;
    }
    System.arraycopy(fileBuffer,startInputIndex,outputBuffer,startOutputIndex + totalGrabbed,lengthOfChunk);
    totalGrabbed+=lengthOfChunk;
  }
 while (!sawNewline && totalGrabbed < outputBuffer.length - startOutputIndex);
  ensureBufferNotEmpty();
  return totalGrabbed;
}
Program: 30692
Project: 30692
Buggy source:
public void encode(final ReadEnds read){
  try {
    this.out.writeShort(read.score);
    this.out.writeByte(read.orientation);
    this.out.writeInt(read.read1Sequence);
    this.out.writeInt(read.read1Coordinate);
    this.out.writeLong(read.read1IndexInFile);
    this.out.writeInt(read.read2Sequence);
    if (read.orientation > ReadEnds.R) {
      this.out.writeInt(read.read2Coordinate);
      this.out.writeLong(read.read2IndexInFile);
    }
    this.out.flush();
  }
 catch (  IOException ioe) {
    throw new PicardException("String_Node_Str",ioe);
  }
}

Fixed version (ground truth):
public void encode(final ReadEnds read){
  try {
    this.out.writeShort(read.score);
    this.out.writeShort(read.libraryId);
    this.out.writeByte(read.orientation);
    this.out.writeInt(read.read1Sequence);
    this.out.writeInt(read.read1Coordinate);
    this.out.writeLong(read.read1IndexInFile);
    this.out.writeInt(read.read2Sequence);
    if (read.orientation > ReadEnds.R) {
      this.out.writeInt(read.read2Coordinate);
      this.out.writeLong(read.read2IndexInFile);
    }
    this.out.flush();
  }
 catch (  IOException ioe) {
    throw new PicardException("String_Node_Str",ioe);
  }
}
Program: 30693
Project: 30693
Buggy source:
public ReadEnds decode(){
  final ReadEnds read=new ReadEnds();
  try {
    try {
      read.score=this.in.readShort();
    }
 catch (    EOFException eof) {
      return null;
    }
    read.orientation=this.in.readByte();
    read.read1Sequence=this.in.readInt();
    read.read1Coordinate=this.in.readInt();
    read.read1IndexInFile=this.in.readLong();
    read.read2Sequence=this.in.readInt();
    if (read.orientation > ReadEnds.R) {
      read.read2Coordinate=this.in.readInt();
      read.read2IndexInFile=this.in.readLong();
    }
    return read;
  }
 catch (  IOException ioe) {
    throw new PicardException("String_Node_Str",ioe);
  }
}

Fixed version (ground truth):
public ReadEnds decode(){
  final ReadEnds read=new ReadEnds();
  try {
    try {
      read.score=this.in.readShort();
    }
 catch (    EOFException eof) {
      return null;
    }
    read.libraryId=this.in.readShort();
    read.orientation=this.in.readByte();
    read.read1Sequence=this.in.readInt();
    read.read1Coordinate=this.in.readInt();
    read.read1IndexInFile=this.in.readLong();
    read.read2Sequence=this.in.readInt();
    if (read.orientation > ReadEnds.R) {
      read.read2Coordinate=this.in.readInt();
      read.read2IndexInFile=this.in.readLong();
    }
    return read;
  }
 catch (  IOException ioe) {
    throw new PicardException("String_Node_Str",ioe);
  }
}
Program: 30694
Project: 30694
Buggy source:
/** 
 * Read value of specified type.
 * @param tagType What type to read.
 * @param byteBuffer Little-ending byte buffer to read value from.
 * @return Value in in-memory Object form.
 */
private static Object readValue(final byte tagType,final ByteBuffer byteBuffer){
switch (tagType) {
case 'Z':
    return readNullTerminatedString(byteBuffer);
case 'A':
  return (char)byteBuffer.get();
case 'I':
return byteBuffer.getInt() & 0xffffffffL;
case 'i':
return byteBuffer.getInt();
case 's':
return byteBuffer.getShort();
case 'S':
return byteBuffer.getShort() & 0xffff;
case 'c':
return byteBuffer.get();
case 'C':
return (short)((int)byteBuffer.get() & 0xff);
case 'f':
return byteBuffer.getFloat();
case 'H':
final String hexRep=readNullTerminatedString(byteBuffer);
return SAMUtils.hexStringToBytes(hexRep);
default :
throw new SAMFormatException("String_Node_Str" + (char)tagType);
}
}

Fixed version (ground truth):
/** 
 * Read value of specified type.
 * @param tagType What type to read.
 * @param byteBuffer Little-ending byte buffer to read value from.
 * @return Value in in-memory Object form.
 */
private static Object readValue(final byte tagType,final ByteBuffer byteBuffer){
switch (tagType) {
case 'Z':
    return readNullTerminatedString(byteBuffer);
case 'A':
  return (char)byteBuffer.get();
case 'I':
return byteBuffer.getInt() & 0xffffffffL;
case 'i':
return byteBuffer.getInt();
case 's':
return byteBuffer.getShort();
case 'S':
return byteBuffer.getShort() & 0xffff;
case 'c':
return byteBuffer.get();
case 'C':
return (short)((int)byteBuffer.get() & 0xff);
case 'f':
return byteBuffer.getFloat();
case 'H':
final String hexRep=readNullTerminatedString(byteBuffer);
return StringUtil.hexStringToBytes(hexRep);
default :
throw new SAMFormatException("String_Node_Str" + (char)tagType);
}
}
Program: 30695
Project: 30695
Buggy source:
/** 
 * Write the given tag name and value to disk.
 */
void writeTag(final short tag,final Object value){
  binaryCodec.writeShort(tag);
  final char tagValueType=getTagValueType(value);
  binaryCodec.writeByte(tagValueType);
switch (tagValueType) {
case 'Z':
    binaryCodec.writeString((String)value,false,true);
  break;
case 'A':
binaryCodec.writeByte(((Character)value));
break;
case 'I':
binaryCodec.writeUInt((Long)value);
break;
case 'i':
binaryCodec.writeInt((Integer)value);
break;
case 's':
binaryCodec.writeShort(((Number)value).shortValue());
break;
case 'c':
binaryCodec.writeByte(((Number)value).byteValue());
break;
case 'f':
binaryCodec.writeFloat((Float)value);
break;
case 'H':
final byte[] byteArray=(byte[])value;
binaryCodec.writeString(SAMUtils.bytesToHexString(byteArray),false,true);
break;
case 'S':
binaryCodec.writeUShort((Integer)value);
break;
case 'C':
binaryCodec.writeUByte(((Integer)value).shortValue());
break;
default :
throw new IllegalArgumentException("String_Node_Str" + value.getClass().getName());
}
}

Fixed version (ground truth):
/** 
 * Write the given tag name and value to disk.
 */
void writeTag(final short tag,final Object value){
  binaryCodec.writeShort(tag);
  final char tagValueType=getTagValueType(value);
  binaryCodec.writeByte(tagValueType);
switch (tagValueType) {
case 'Z':
    binaryCodec.writeString((String)value,false,true);
  break;
case 'A':
binaryCodec.writeByte(((Character)value));
break;
case 'I':
binaryCodec.writeUInt((Long)value);
break;
case 'i':
binaryCodec.writeInt((Integer)value);
break;
case 's':
binaryCodec.writeShort(((Number)value).shortValue());
break;
case 'c':
binaryCodec.writeByte(((Number)value).byteValue());
break;
case 'f':
binaryCodec.writeFloat((Float)value);
break;
case 'H':
final byte[] byteArray=(byte[])value;
binaryCodec.writeString(StringUtil.bytesToHexString(byteArray),false,true);
break;
case 'S':
binaryCodec.writeUShort((Integer)value);
break;
case 'C':
binaryCodec.writeUByte(((Integer)value).shortValue());
break;
default :
throw new IllegalArgumentException("String_Node_Str" + value.getClass().getName());
}
}
Program: 30696
Project: 30696
Buggy source:
private String formatTagValue(final short tag,final Object value){
  final String tagString=SAMTagUtil.getSingleton().makeStringTag(tag);
  if (value == null || value instanceof String) {
    return tagString + "String_Node_Str" + value;
  }
 else   if (value instanceof Integer) {
    return tagString + "String_Node_Str" + value;
  }
 else   if (value instanceof Character) {
    return tagString + "String_Node_Str" + value;
  }
 else   if (value instanceof Float) {
    return tagString + "String_Node_Str" + value;
  }
 else   if (value instanceof byte[]) {
    return tagString + "String_Node_Str" + SAMUtils.bytesToHexString((byte[])value);
  }
 else {
    throw new RuntimeException("String_Node_Str" + tagString + "String_Node_Str"+ value);
  }
}

Fixed version (ground truth):
private String formatTagValue(final short tag,final Object value){
  final String tagString=SAMTagUtil.getSingleton().makeStringTag(tag);
  if (value == null || value instanceof String) {
    return tagString + "String_Node_Str" + value;
  }
 else   if (value instanceof Integer) {
    return tagString + "String_Node_Str" + value;
  }
 else   if (value instanceof Character) {
    return tagString + "String_Node_Str" + value;
  }
 else   if (value instanceof Float) {
    return tagString + "String_Node_Str" + value;
  }
 else   if (value instanceof byte[]) {
    return tagString + "String_Node_Str" + StringUtil.bytesToHexString((byte[])value);
  }
 else {
    throw new RuntimeException("String_Node_Str" + tagString + "String_Node_Str"+ value);
  }
}
Program: 30697
Project: 30697
Buggy source:
/** 
 * Retrieve the 2nd-best base call from SQ value.
 * @param sqValue
 * @return Ordinal of 2nd-best base call.
 */
public static int sqValueToBaseOrdinal(final byte sqValue){
  return sqValue >>> BASE_INDEX_SHIFT;
}

Fixed version (ground truth):
/** 
 * Retrieve the 2nd-best base call from SQ value.
 * @param sqValue
 * @return Ordinal of 2nd-best base call.
 */
public static int sqValueToBaseOrdinal(final byte sqValue){
  return (sqValue & 0xff) >>> BASE_INDEX_SHIFT;
}
Program: 30698
Project: 30698
Buggy source:
/** 
 * Convert in-memory representation of tag to SAM text representation.
 * @param tagName Two-character tag name.
 * @param value Tag value as approriate Object subclass.
 * @return SAM text String representation, i.e. name:type:value
 */
String encode(final String tagName,Object value){
  final StringBuilder sb=new StringBuilder(tagName);
  sb.append(':');
  char tagType=BinaryTagCodec.getTagValueType(value);
switch (tagType) {
case 'c':
case 'C':
case 's':
case 'S':
case 'I':
    tagType='i';
}
if (tagType == 'H') {
  value=SAMUtils.bytesToHexString((byte[])value);
}
 else if (tagType == 'i') {
  final long longVal=((Number)value).longValue();
  if (longVal > Integer.MAX_VALUE || longVal < Integer.MIN_VALUE) {
    throw new SAMFormatException("String_Node_Str" + tagName + "String_Node_Str"+ longVal);
  }
}
sb.append(tagType);
sb.append(':');
sb.append(value.toString());
return sb.toString();
}

Fixed version (ground truth):
/** 
 * Convert in-memory representation of tag to SAM text representation.
 * @param tagName Two-character tag name.
 * @param value Tag value as approriate Object subclass.
 * @return SAM text String representation, i.e. name:type:value
 */
String encode(final String tagName,Object value){
  final StringBuilder sb=new StringBuilder(tagName);
  sb.append(':');
  char tagType=BinaryTagCodec.getTagValueType(value);
switch (tagType) {
case 'c':
case 'C':
case 's':
case 'S':
case 'I':
    tagType='i';
}
if (tagType == 'H') {
  value=StringUtil.bytesToHexString((byte[])value);
}
 else if (tagType == 'i') {
  final long longVal=((Number)value).longValue();
  if (longVal > Integer.MAX_VALUE || longVal < Integer.MIN_VALUE) {
    throw new SAMFormatException("String_Node_Str" + tagName + "String_Node_Str"+ longVal);
  }
}
sb.append(tagType);
sb.append(':');
sb.append(value.toString());
return sb.toString();
}
Program: 30699
Project: 30699
Buggy source:
private Object convertStringToObject(final String type,final String stringVal){
  final Object val;
  if (type.equals("String_Node_Str")) {
    val=stringVal;
  }
 else   if (type.equals("String_Node_Str")) {
    if (stringVal.length() != 1) {
      throw new SAMFormatException("String_Node_Str");
    }
    val=stringVal.charAt(0);
  }
 else   if (type.equals("String_Node_Str")) {
    try {
      val=new Integer(stringVal);
    }
 catch (    NumberFormatException e) {
      throw new SAMFormatException("String_Node_Str");
    }
  }
 else   if (type.equals("String_Node_Str")) {
    try {
      val=new Float(stringVal);
    }
 catch (    NumberFormatException e) {
      throw new SAMFormatException("String_Node_Str");
    }
  }
 else   if (type.equals("String_Node_Str")) {
    try {
      val=SAMUtils.hexStringToBytes(stringVal);
    }
 catch (    NumberFormatException e) {
      throw new SAMFormatException("String_Node_Str");
    }
  }
 else {
    throw new SAMFormatException("String_Node_Str" + type);
  }
  return val;
}

Fixed version (ground truth):
private Object convertStringToObject(final String type,final String stringVal){
  final Object val;
  if (type.equals("String_Node_Str")) {
    val=stringVal;
  }
 else   if (type.equals("String_Node_Str")) {
    if (stringVal.length() != 1) {
      throw new SAMFormatException("String_Node_Str");
    }
    val=stringVal.charAt(0);
  }
 else   if (type.equals("String_Node_Str")) {
    try {
      val=new Integer(stringVal);
    }
 catch (    NumberFormatException e) {
      throw new SAMFormatException("String_Node_Str");
    }
  }
 else   if (type.equals("String_Node_Str")) {
    try {
      val=new Float(stringVal);
    }
 catch (    NumberFormatException e) {
      throw new SAMFormatException("String_Node_Str");
    }
  }
 else   if (type.equals("String_Node_Str")) {
    try {
      val=StringUtil.hexStringToBytes(stringVal);
    }
 catch (    NumberFormatException e) {
      throw new SAMFormatException("String_Node_Str");
    }
  }
 else {
    throw new SAMFormatException("String_Node_Str" + type);
  }
  return val;
}
Program: 30700
Project: 30700
Buggy source:
/** 
 * Constructs a FastaSequenceFile that reads from the specified file. 
 */
FastaSequenceFile(final File file,final boolean truncateNamesAtWhitespace){
  this.file=file;
  this.truncateNamesAtWhitespace=truncateNamesAtWhitespace;
  this.in=new FastLineReader(IoUtil.openFileForReading(file));
  String dictionaryName=file.getAbsolutePath();
  boolean fileTypeSupported=false;
  for (  String extension : ReferenceSequenceFileFactory.FASTA_EXTENSIONS) {
    if (dictionaryName.endsWith(extension)) {
      dictionaryName=dictionaryName.substring(0,dictionaryName.lastIndexOf(extension));
      dictionaryName+="String_Node_Str";
      fileTypeSupported=true;
      break;
    }
  }
  if (!fileTypeSupported)   throw new IllegalArgumentException("String_Node_Str" + file.getAbsolutePath());
  dictionaryName+="String_Node_Str";
  final File dictionary=new File(dictionaryName);
  if (dictionary.exists()) {
    IoUtil.assertFileIsReadable(dictionary);
    try {
      final SAMTextHeaderCodec codec=new SAMTextHeaderCodec();
      final SAMFileHeader header=codec.decode(new AsciiLineReader(new FileInputStream(dictionary)),dictionary);
      if (header.getSequenceDictionary() != null && header.getSequenceDictionary().size() > 0) {
        this.sequenceDictionary=header.getSequenceDictionary();
      }
    }
 catch (    Exception e) {
      throw new PicardException("String_Node_Str" + dictionaryName,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Constructs a FastaSequenceFile that reads from the specified file. 
 */
FastaSequenceFile(final File file,final boolean truncateNamesAtWhitespace){
  this.file=file;
  this.truncateNamesAtWhitespace=truncateNamesAtWhitespace;
  this.in=new FastLineReader(IoUtil.openFileForReading(file));
  String dictionaryName=file.getAbsolutePath();
  boolean fileTypeSupported=false;
  for (  String extension : ReferenceSequenceFileFactory.FASTA_EXTENSIONS) {
    if (dictionaryName.endsWith(extension)) {
      dictionaryName=dictionaryName.substring(0,dictionaryName.lastIndexOf(extension));
      dictionaryName+="String_Node_Str";
      fileTypeSupported=true;
      break;
    }
  }
  if (!fileTypeSupported)   throw new IllegalArgumentException("String_Node_Str" + file.getAbsolutePath());
  final File dictionary=new File(dictionaryName);
  if (dictionary.exists()) {
    IoUtil.assertFileIsReadable(dictionary);
    try {
      final SAMTextHeaderCodec codec=new SAMTextHeaderCodec();
      final SAMFileHeader header=codec.decode(new AsciiLineReader(new FileInputStream(dictionary)),dictionary);
      if (header.getSequenceDictionary() != null && header.getSequenceDictionary().size() > 0) {
        this.sequenceDictionary=header.getSequenceDictionary();
      }
    }
 catch (    Exception e) {
      throw new PicardException("String_Node_Str" + dictionaryName,e);
    }
  }
}
Program: 30701
Project: 30701
Buggy source:
/** 
 * For setting the Cigar string when BAMRecord has decoded it.  Use this rather than setCigar() so that indexing bin doesn't get clobbered.
 */
protected void initializeCigar(final Cigar cigar){
  this.mCigar=cigar;
  mCigarString=null;
  mAlignmentBlocks=null;
}

Fixed version (ground truth):
/** 
 * For setting the Cigar string when BAMRecord has decoded it.  Use this rather than setCigar() so that indexing bin doesn't get clobbered.
 */
protected void initializeCigar(final Cigar cigar){
  this.mCigar=cigar;
  mCigarString=null;
  mAlignmentBlocks=null;
  mAlignmentEnd=NO_ALIGNMENT_START;
}
Program: 30702
Project: 30702
Buggy source:
/** 
 * @return 1-based inclusive rightmost position of the clippped sequence, or -1 read if unmapped.
 */
public int getAlignmentEnd(){
  if (getReadUnmappedFlag()) {
    return NO_ALIGNMENT_START;
  }
 else   if (this.mAlignmentEnd == NO_ALIGNMENT_START) {
    this.mAlignmentEnd=getCigar().getReferenceLength() - 1;
  }
  return this.mAlignmentEnd;
}

Fixed version (ground truth):
/** 
 * @return 1-based inclusive rightmost position of the clippped sequence, or -1 read if unmapped.
 */
public int getAlignmentEnd(){
  if (getReadUnmappedFlag()) {
    return NO_ALIGNMENT_START;
  }
 else   if (this.mAlignmentEnd == NO_ALIGNMENT_START) {
    this.mAlignmentEnd=mAlignmentStart + getCigar().getReferenceLength() - 1;
  }
  return this.mAlignmentEnd;
}
Program: 30703
Project: 30703
Buggy source:
/** 
 * @param value 1-based inclusive leftmost position of the clippped sequence, or 0 if there is no position.
 */
public void setAlignmentStart(final int value){
  mAlignmentStart=value;
  setIndexingBin(null);
}

Fixed version (ground truth):
/** 
 * @param value 1-based inclusive leftmost position of the clippped sequence, or 0 if there is no position.
 */
public void setAlignmentStart(final int value){
  mAlignmentStart=value;
  mAlignmentEnd=NO_ALIGNMENT_START;
  setIndexingBin(null);
}
Program: 30704
Project: 30704
Buggy source:
public void setCigarString(final String value){
  mCigarString=value;
  mCigar=null;
  mAlignmentBlocks=null;
  setIndexingBin(null);
}

Fixed version (ground truth):
public void setCigarString(final String value){
  mCigarString=value;
  mCigar=null;
  mAlignmentBlocks=null;
  mAlignmentEnd=NO_ALIGNMENT_START;
  setIndexingBin(null);
}
Program: 30707
Project: 30707
Buggy source:
/** 
 * Remove non visible views laid out of the screen
 */
private void removeNonVisibleViews(){
  if (getChildCount() == 0)   return;
  final int leftScreenEdge=getScrollX();
  final int rightScreenEdge=leftScreenEdge + getWidth();
  int dspRightScreenEdge=pxToDsp(rightScreenEdge);
  if (dspRightScreenEdge >= 0)   dspRightScreenEdge++;
  int dspLeftScreenEdge=pxToDsp(leftScreenEdge);
  if (dspLeftScreenEdge < 0)   dspLeftScreenEdge--;
  mTempViewArray.clear();
  View v;
  for (int i=0; i < getChildCount(); i++) {
    v=getChildAt(i);
    if (!isOnScreen((LayoutParams)v.getLayoutParams(),dspLeftScreenEdge,dspRightScreenEdge))     mTempViewArray.add(v);
  }
  for (int i=0; i < mTempViewArray.size(); i++) {
    v=mTempViewArray.get(i);
    removeViewInLayout(v);
    mAdapter.offerViewForRecycling(v);
  }
  mTempViewArray.clear();
  int dspMostRight=dspLeftScreenEdge;
  int dspMostLeft=dspRightScreenEdge;
  LayoutParams lp;
  for (int i=0; i < getChildCount(); i++) {
    lp=(LayoutParams)getChildAt(i).getLayoutParams();
    if (lp.getDspRight() > dspMostRight)     dspMostRight=lp.getDspRight();
    if (lp.dspLeft < dspMostLeft)     dspMostLeft=lp.dspLeft;
  }
  mCurrentlyLayoutedViewsLeftEdgeDsp=dspMostLeft;
  mCurrentlyLayoutedViewsRightEdgeDsp=dspMostRight;
}

Fixed version (ground truth):
/** 
 * Remove non visible views laid out of the screen
 */
private void removeNonVisibleViews(){
  if (getChildCount() == 0)   return;
  final int leftScreenEdge=getScrollX();
  final int rightScreenEdge=leftScreenEdge + getWidth();
  int dspRightScreenEdge=pxToDsp(rightScreenEdge);
  if (dspRightScreenEdge >= 0)   dspRightScreenEdge++;
  int dspLeftScreenEdge=pxToDsp(leftScreenEdge);
  if (dspLeftScreenEdge <= 0)   dspLeftScreenEdge--;
  mTempViewArray.clear();
  View v;
  for (int i=0; i < getChildCount(); i++) {
    v=getChildAt(i);
    if (!isOnScreen((LayoutParams)v.getLayoutParams(),dspLeftScreenEdge,dspRightScreenEdge))     mTempViewArray.add(v);
  }
  for (int i=0; i < mTempViewArray.size(); i++) {
    v=mTempViewArray.get(i);
    removeViewInLayout(v);
    mAdapter.offerViewForRecycling(v);
  }
  mTempViewArray.clear();
  int dspMostRight=dspLeftScreenEdge;
  int dspMostLeft=dspRightScreenEdge;
  LayoutParams lp;
  for (int i=0; i < getChildCount(); i++) {
    lp=(LayoutParams)getChildAt(i).getLayoutParams();
    if (lp.getDspRight() > dspMostRight)     dspMostRight=lp.getDspRight();
    if (lp.dspLeft < dspMostLeft)     dspMostLeft=lp.dspLeft;
  }
  mCurrentlyLayoutedViewsLeftEdgeDsp=dspMostLeft;
  mCurrentlyLayoutedViewsRightEdgeDsp=dspMostRight;
}
Program: 30709
Project: 30709
Buggy source:
/** 
 * Takes a URI for an image contained within an application jar file and  converts it into a data URI for use in a MarkerOptions object. <p> Usage: <p> markerOptions.icon(MarkerImageFactory.createMarkerImage("/path/to/my/image.jpg", "jpg")); <p> Currently tested to work with "jpg" and "png" files.
 * @param uri
 * @param type
 * @return 
 * @throws java.io.IOException 
 */
public static String createMarkerImage(String uri,String type){
  String dataURI=null;
  URL myURL=MarkerImageFactory.class.getResource(uri);
  if (myURL != null) {
    String myURI=myURL.toExternalForm();
    Image img=new Image(myURI);
    String imageMimeType="String_Node_Str" + type;
    try {
      dataURI="String_Node_Str" + imageMimeType + "String_Node_Str"+ javax.xml.bind.DatatypeConverter.printBase64Binary(getImageBytes(SwingFXUtils.fromFXImage(img,null),type))+ "String_Node_Str";
    }
 catch (    IOException ioe) {
      Logger.getLogger(MarkerImageFactory.class.getName()).log(Level.WARNING,"String_Node_Str",ioe);
      dataURI=null;
    }
  }
  return dataURI;
}

Fixed version (ground truth):
/** 
 * Takes a URI for an image contained within an application jar file and  converts it into a data URI for use in a MarkerOptions object. <p> Usage: <p> markerOptions.icon(MarkerImageFactory.createMarkerImage("/path/to/my/image.jpg", "jpg")); <p> Currently tested to work with "jpg" and "png" files.
 * @param uri
 * @param type
 * @return 
 */
public static String createMarkerImage(String uri,String type){
  String dataURI=null;
  URL myURL=MarkerImageFactory.class.getResource(uri);
  if (myURL != null) {
    String myURI=myURL.toExternalForm();
    Image img=new Image(myURI);
    String imageMimeType="String_Node_Str" + type;
    try {
      dataURI="String_Node_Str" + imageMimeType + "String_Node_Str"+ javax.xml.bind.DatatypeConverter.printBase64Binary(getImageBytes(SwingFXUtils.fromFXImage(img,null),type))+ "String_Node_Str";
    }
 catch (    IOException ioe) {
      Logger.getLogger(MarkerImageFactory.class.getName()).log(Level.WARNING,"String_Node_Str",ioe);
      dataURI=null;
    }
  }
  return dataURI;
}
Program: 30710
Project: 30710
Buggy source:
@Override public void start(final Stage stage) throws Exception {
  mapComponent=new GoogleMapView();
  mapComponent.addMapInializedListener(this);
  BorderPane bp=new BorderPane();
  ToolBar tb=new ToolBar();
  btnZoomIn=new Button("String_Node_Str");
  btnZoomIn.setOnAction(e -> {
    map.zoomProperty().set(map.getZoom() + 1);
  }
);
  btnZoomIn.setDisable(true);
  btnZoomOut=new Button("String_Node_Str");
  btnZoomOut.setOnAction(e -> {
    map.zoomProperty().set(map.getZoom() - 1);
  }
);
  btnZoomOut.setDisable(true);
  lblZoom=new Label();
  lblCenter=new Label();
  lblClick=new Label();
  tb.getItems().addAll(btnZoomIn,btnZoomOut,new Label("String_Node_Str"),lblZoom,new Label("String_Node_Str"),lblCenter,new Label("String_Node_Str"),lblClick);
  bp.setTop(tb);
  bp.setCenter(mapComponent);
  Scene scene=new Scene(bp);
  stage.setScene(scene);
  stage.show();
}

Fixed version (ground truth):
@Override public void start(final Stage stage) throws Exception {
  mapComponent=new GoogleMapView();
  mapComponent.addMapInializedListener(this);
  BorderPane bp=new BorderPane();
  ToolBar tb=new ToolBar();
  btnZoomIn=new Button("String_Node_Str");
  btnZoomIn.setOnAction(e -> {
    map.zoomProperty().set(map.getZoom() + 1);
  }
);
  btnZoomIn.setDisable(true);
  btnZoomOut=new Button("String_Node_Str");
  btnZoomOut.setOnAction(e -> {
    map.zoomProperty().set(map.getZoom() - 1);
  }
);
  btnZoomOut.setDisable(true);
  lblZoom=new Label();
  lblCenter=new Label();
  lblClick=new Label();
  mapTypeCombo=new ComboBox<>();
  mapTypeCombo.setOnAction(e -> {
    map.setMapType(mapTypeCombo.getSelectionModel().getSelectedItem());
  }
);
  mapTypeCombo.setDisable(true);
  Button btnType=new Button("String_Node_Str");
  btnType.setOnAction(e -> {
    map.setMapType(MapTypeIdEnum.HYBRID);
  }
);
  tb.getItems().addAll(btnZoomIn,btnZoomOut,mapTypeCombo,new Label("String_Node_Str"),lblZoom,new Label("String_Node_Str"),lblCenter,new Label("String_Node_Str"),lblClick);
  bp.setTop(tb);
  bp.setCenter(mapComponent);
  Scene scene=new Scene(bp);
  stage.setScene(scene);
  stage.show();
}
Program: 30712
Project: 30712
Buggy source:
/** 
 * Invoke the specified JavaScript function in the JavaScript runtime.
 * @param function The function to invoke
 * @param args Any arguments to pass to the function
 * @return The result of the function.
 */
protected Object invokeJavascript(String function,Object... args){
  Object[] jsArgs=new Object[args.length];
  for (int i=0; i < jsArgs.length; i++) {
    if (args[i] instanceof JavascriptObject) {
      jsArgs[i]=((JavascriptObject)args[i]).getJSObject();
    }
 else {
      jsArgs[i]=args[i];
    }
  }
  return jsObject.call(function,(Object[])jsArgs);
}

Fixed version (ground truth):
/** 
 * Invoke the specified JavaScript function in the JavaScript runtime.
 * @param function The function to invoke
 * @param args Any arguments to pass to the function
 * @return The result of the function.
 */
protected Object invokeJavascript(String function,Object... args){
  Object[] jsArgs=new Object[args.length];
  for (int i=0; i < jsArgs.length; i++) {
    if (args[i] instanceof JavascriptObject) {
      jsArgs[i]=((JavascriptObject)args[i]).getJSObject();
    }
 else     if (args[i] instanceof JavascriptEnum) {
      jsArgs[i]=((JavascriptEnum)args[i]).getEnumValue();
    }
 else {
      jsArgs[i]=args[i];
    }
  }
  return jsObject.call(function,(Object[])jsArgs);
}
Program: 30713
Project: 30713
Buggy source:
@Override public final void close(){
  offsets.close();
  if (address != 0) {
    Unsafe.free(address,capacity);
    address=0;
  }
}

Fixed version (ground truth):
@Override public final void close(){
  offsets=Misc.free(offsets);
  if (address != 0) {
    Unsafe.free(address,capacity);
    address=0;
  }
}
Program: 30714
Project: 30714
Buggy source:
@Override public MapKey withKeyAsLong(long value){
  key.startAddress=kPos;
  key.appendAddress=key.startAddress + keyDataOffset;
  if (key.appendAddress + 8 > kLimit) {
    resize(8);
  }
  Unsafe.getUnsafe().putLong(key.appendAddress,value);
  key.appendAddress+=8;
  return key;
}

Fixed version (ground truth):
@Override public MapKey withKeyAsLong(long value){
  key.startAddress=kPos;
  key.appendAddress=kPos + keyDataOffset;
  if (key.appendAddress + 8 > kLimit) {
    key.nextColOffset=kPos + keyBlockOffset;
    resize(8);
  }
  Unsafe.getUnsafe().putLong(key.appendAddress,value);
  key.appendAddress+=8;
  return key;
}
Program: 30715
Project: 30715
Buggy source:
public void of(TableReader reader){
  this.reader=reader;
  this.timestampIndex=reader.getMetadata().getTimestampIndex();
  if (this.timestampIndex == -1) {
    throw CairoException.instance(0).put("String_Node_Str");
  }
  calculateRanges();
}

Fixed version (ground truth):
public void of(TableReader reader){
  this.timestampIndex=reader.getMetadata().getTimestampIndex();
  if (this.timestampIndex == -1) {
    throw CairoException.instance(0).put("String_Node_Str").put(reader.getTableName()).put("String_Node_Str");
  }
  this.reader=reader;
  calculateRanges();
}
Program: 30716
Project: 30716
Buggy source:
private void calculateRanges(){
  if (intervals.size() > 0) {
    if (reader.getPartitionedBy() == PartitionBy.NONE) {
      initialIntervalsLo=0;
      initialIntervalsHi=intervals.size();
      initialPartitionLo=0;
      initialPartitionHi=reader.getPartitionCount();
    }
 else {
      cullIntervals();
      if (initialIntervalsLo < initialIntervalsHi) {
        cullPartitions();
      }
    }
    toTop();
  }
}

Fixed version (ground truth):
private void calculateRanges(){
  if (intervals.size() > 0) {
    if (reader.getPartitionedBy() == PartitionBy.NONE) {
      initialIntervalsLo=0;
      initialIntervalsHi=intervals.size() / 2;
      initialPartitionLo=0;
      initialPartitionHi=reader.getPartitionCount();
    }
 else {
      cullIntervals();
      if (initialIntervalsLo < initialIntervalsHi) {
        cullPartitions();
      }
    }
    toTop();
  }
}
Program: 30717
Project: 30717
Buggy source:
/** 
 * Adds key-value pair to index. If key already exists, value is appended to end of list of existing values. Otherwise new value list is associated with the key. <p> Index is updated atomically as far as concurrent reading is concerned. Please refer to notes on classes that are responsible for reading bitmap indexes, such as   {@link BitmapIndexBackwardReader}.
 * @param key   int key
 * @param value long value
 */
public void add(int key,long value){
}

Fixed version (ground truth):
/** 
 * Adds key-value pair to index. If key already exists, value is appended to end of list of existing values. Otherwise new value list is associated with the key. <p> Index is updated atomically as far as concurrent reading is concerned. Please refer to notes on classes that are responsible for reading bitmap indexes, such as   {@link BitmapIndexBwdReader}.
 * @param key   int key
 * @param value long value
 */
public void add(int key,long value){
}
Program: 30720
Project: 30720
Buggy source:
@NotNull private BitmapIndexReader createBitmapIndexReaderAt(int globalIndex,int columnBase,int columnIndex,int direction){
  BitmapIndexReader reader;
  if (!metadata.isColumnIndexed(columnIndex)) {
    throw CairoException.instance(0).put("String_Node_Str").put(metadata.getColumnName(columnIndex));
  }
  ReadOnlyColumn col=columns.getQuick(globalIndex);
  if (col instanceof NullColumn) {
    if (direction == BitmapIndexReader.DIR_BACKWARD) {
      reader=new BitmapIndexBackwardNullReader();
      bitmapIndexes.setQuick(globalIndex,reader);
    }
 else {
      reader=new BitmapIndexForwardNullReader();
      bitmapIndexes.setQuick(globalIndex + 1,reader);
    }
  }
 else {
    Path path=partitionPathGenerator.generate(this,getPartitionIndex(columnBase));
    try {
      if (direction == BitmapIndexReader.DIR_BACKWARD) {
        reader=new BitmapIndexBackwardReader(configuration,path.chopZ(),metadata.getColumnName(columnIndex),getColumnTop(columnBase,columnIndex));
        bitmapIndexes.setQuick(globalIndex,reader);
      }
 else {
        reader=new BitmapIndexForwardReader(configuration,path.chopZ(),metadata.getColumnName(columnIndex),getColumnTop(columnBase,columnIndex));
        bitmapIndexes.setQuick(globalIndex + 1,reader);
      }
    }
  finally {
      path.trimTo(rootLen);
    }
  }
  return reader;
}

Fixed version (ground truth):
@NotNull private BitmapIndexReader createBitmapIndexReaderAt(int globalIndex,int columnBase,int columnIndex,int direction){
  BitmapIndexReader reader;
  if (!metadata.isColumnIndexed(columnIndex)) {
    throw CairoException.instance(0).put("String_Node_Str").put(metadata.getColumnName(columnIndex));
  }
  ReadOnlyColumn col=columns.getQuick(globalIndex);
  if (col instanceof NullColumn) {
    if (direction == BitmapIndexReader.DIR_BACKWARD) {
      reader=new BitmapIndexBwdNullReader();
      bitmapIndexes.setQuick(globalIndex,reader);
    }
 else {
      reader=new BitmapIndexFwdNullReader();
      bitmapIndexes.setQuick(globalIndex + 1,reader);
    }
  }
 else {
    Path path=partitionPathGenerator.generate(this,getPartitionIndex(columnBase));
    try {
      if (direction == BitmapIndexReader.DIR_BACKWARD) {
        reader=new BitmapIndexBwdReader(configuration,path.chopZ(),metadata.getColumnName(columnIndex),getColumnTop(columnBase,columnIndex));
        bitmapIndexes.setQuick(globalIndex,reader);
      }
 else {
        reader=new BitmapIndexFwdReader(configuration,path.chopZ(),metadata.getColumnName(columnIndex),getColumnTop(columnBase,columnIndex));
        bitmapIndexes.setQuick(globalIndex + 1,reader);
      }
    }
  finally {
      path.trimTo(rootLen);
    }
  }
  return reader;
}
Program: 30723
Project: 30723
Buggy source:
public void unlock(CharSequence tableName){
  readerPool.unlock(tableName);
  writerPool.unlock(tableName);
}

Fixed version (ground truth):
@Override public void unlock(CharSequence tableName){
  readerPool.unlock(tableName);
  writerPool.unlock(tableName);
}
Program: 30724
Project: 30724
Buggy source:
@Override public int getStatus(CharSequence tableName){
  return TableUtils.exists(configuration.getFilesFacade(),path,configuration.getRoot(),tableName);
}

Fixed version (ground truth):
@Override public int getStatus(CharSequence tableName,int lo,int hi){
  return TableUtils.exists(configuration.getFilesFacade(),path,configuration.getRoot(),tableName,lo,hi);
}
Program: 30725
Project: 30725
Buggy source:
public boolean lock(CharSequence tableName){
  if (writerPool.lock(tableName)) {
    boolean locked=readerPool.lock(tableName);
    if (locked) {
      return true;
    }
    writerPool.unlock(tableName);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean lock(CharSequence tableName){
  if (writerPool.lock(tableName)) {
    boolean locked=readerPool.lock(tableName);
    if (locked) {
      return true;
    }
    writerPool.unlock(tableName);
  }
  return false;
}
Program: 30726
Project: 30726
Buggy source:
public static int exists(FilesFacade ff,Path path,CharSequence root,CharSequence name){
  path.of(root).concat(name).$();
  if (ff.exists(path)) {
    if (ff.exists(path.chopZ().concat(TXN_FILE_NAME).$())) {
      return TABLE_EXISTS;
    }
 else {
      return TABLE_RESERVED;
    }
  }
 else {
    return TABLE_DOES_NOT_EXIST;
  }
}

Fixed version (ground truth):
public static int exists(FilesFacade ff,Path path,CharSequence root,CharSequence name,int lo,int hi){
  path.of(root).concat(name,lo,hi).$();
  if (ff.exists(path)) {
    if (ff.exists(path.chopZ().concat(TXN_FILE_NAME).$())) {
      return TABLE_EXISTS;
    }
 else {
      return TABLE_RESERVED;
    }
  }
 else {
    return TABLE_DOES_NOT_EXIST;
  }
}
Program: 30728
Project: 30728
Buggy source:
int getStatus(CharSequence tableName);

Fixed version (ground truth):
default int getStatus(CharSequence tableName){
  return getStatus(tableName,0,tableName.length());
}
Program: 30729
Project: 30729
Buggy source:
public ParserException put(char c){
  message.put(c);
  return this;
}

Fixed version (ground truth):
public ParserException put(Sinkable sinkable){
  message.put(sinkable);
  return this;
}
Program: 30732
Project: 30732
Buggy source:
private QueryModel parseDml() throws ParserException {
  CharSequence tok;
  QueryModel model=queryModelPool.next();
  tok=tok("String_Node_Str");
  if (Chars.equals(tok,"String_Node_Str")) {
    parseWithClauses(model);
    tok=tok("String_Node_Str");
  }
  if (Chars.equals(tok,"String_Node_Str")) {
    parseSelectClause(model);
  }
 else {
    lexer.unparse();
    if (subQueryMode) {
      parseFromClause(model,model);
      return model;
    }
    model.addColumn(queryColumnPool.next().of("String_Node_Str",0,exprNodePool.next().of(ExprNode.LITERAL,"String_Node_Str",0,0)));
  }
  QueryModel nestedModel=queryModelPool.next();
  parseFromClause(nestedModel,model);
  model.setSelectModelType(QueryModel.SELECT_MODEL_CHOOSE);
  model.setNestedModel(nestedModel);
  return model;
}

Fixed version (ground truth):
private QueryModel parseDml() throws ParserException {
  CharSequence tok;
  QueryModel model=queryModelPool.next();
  tok=tok("String_Node_Str");
  if (Chars.equals(tok,"String_Node_Str")) {
    parseWithClauses(model);
    tok=tok("String_Node_Str");
  }
  if (Chars.equals(tok,"String_Node_Str")) {
    parseSelectClause(model);
  }
 else {
    lexer.unparse();
    if (subQueryMode) {
      parseFromClause(model,model);
      return model;
    }
    model.addColumn(queryColumnPool.next().of("String_Node_Str",exprNodePool.next().of(ExprNode.LITERAL,"String_Node_Str",0,0)));
  }
  QueryModel nestedModel=queryModelPool.next();
  parseFromClause(nestedModel,model);
  model.setSelectModelType(QueryModel.SELECT_MODEL_CHOOSE);
  model.setNestedModel(nestedModel);
  return model;
}