nus-yam/ex-repair huggingface dataset:
Program: 153229
Project: 153229
Buggy source:
public TopDocs getQueryResult(String queryLine){
  IndexReader reader=null;
  TopDocs result=null;
  try {
    reader=IndexReader.open(getIndexDirectory());
    setReader(reader);
    BooleanQuery.setMaxClauseCount(Integer.MAX_VALUE);
    Searcher searcher=new IndexSearcher(reader);
    setSearcher(searcher);
    SortField[] sf={new SortField(FieldNames.REVISION),new SortField(FieldNames.DFILENAME)};
    Sort sort=new Sort(sf);
    QueryParser parser=new CustomQueryParser(FieldNames.CONTENTS,getAnalyzer());
    parser.setAllowLeadingWildcard(true);
    parser.setLowercaseExpandedTerms(true);
    Query query=parser.parse(queryLine);
    TopDocs tmp=searcher.search(query,null,20,sort);
    result=searcher.search(query,null,tmp.totalHits,sort);
  }
 catch (  CorruptIndexException e) {
    LOGGER.error("String_Node_Str" + e);
  }
catch (  IOException e) {
    LOGGER.error("String_Node_Str" + e);
  }
catch (  Exception e) {
    LOGGER.error("String_Node_Str" + e);
  }
  return result;
}

Fixed version (ground truth):
public TopDocs getQueryResult(String queryLine){
  IndexReader reader=null;
  TopDocs result=null;
  try {
    reader=IndexReader.open(getIndexDirectory());
    setReader(reader);
    BooleanQuery.setMaxClauseCount(Integer.MAX_VALUE);
    Searcher searcher=new IndexSearcher(reader);
    setSearcher(searcher);
    SortField[] sf={new SortField(FieldNames.REVISION),new SortField(FieldNames.DFILENAME)};
    Sort sort=new Sort(sf);
    QueryParser parser=new CustomQueryParser(FieldNames.CONTENTS,getAnalyzer());
    parser.setAllowLeadingWildcard(true);
    parser.setLowercaseExpandedTerms(true);
    Query query=parser.parse(queryLine);
    LOGGER.info("String_Node_Str" + query.toString());
    TopDocs tmp=searcher.search(query,null,20,sort);
    result=searcher.search(query,null,tmp.totalHits,sort);
  }
 catch (  CorruptIndexException e) {
    LOGGER.error("String_Node_Str" + e);
  }
catch (  IOException e) {
    LOGGER.error("String_Node_Str" + e);
  }
catch (  Exception e) {
    LOGGER.error("String_Node_Str" + e);
  }
  return result;
}
Program: 153230
Project: 153230
Buggy source:
public NPCEntity spawnNPC(String name,Location l){
  BWorld world=new BWorld(l.getWorld());
  NPCEntity npcEntity=new NPCEntity(server.getMCServer(),world.getWorldServer(),name,new ItemInWorldManager(world.getWorldServer()));
  npcEntity.setPositionRotation(l.getBlockX(),l.getBlockY(),l.getBlockZ(),l.getYaw(),l.getPitch());
  world.getWorldServer().getChunkAt(l.getWorld().getChunkAt(l).getX(),l.getWorld().getChunkAt(l).getZ()).a(npcEntity);
  world.getWorldServer().addEntity(npcEntity);
  npcs.put(name,npcEntity);
  return npcEntity;
}

Fixed version (ground truth):
public NPCEntity spawnNPC(String name,Location l){
  if (name.length() > 16) {
    String tmp=name.substring(0,16);
    server.getLogger().log(Level.WARNING,"String_Node_Str");
    server.getLogger().log(Level.WARNING,name + "String_Node_Str" + tmp);
    name=tmp;
  }
  BWorld world=new BWorld(l.getWorld());
  NPCEntity npcEntity=new NPCEntity(server.getMCServer(),world.getWorldServer(),name,new ItemInWorldManager(world.getWorldServer()));
  npcEntity.setPositionRotation(l.getBlockX(),l.getBlockY(),l.getBlockZ(),l.getYaw(),l.getPitch());
  world.getWorldServer().getChunkAt(l.getWorld().getChunkAt(l).getX(),l.getWorld().getChunkAt(l).getZ()).a(npcEntity);
  world.getWorldServer().addEntity(npcEntity);
  npcs.put(name,npcEntity);
  return npcEntity;
}
Program: 153231
Project: 153231
Buggy source:
public void despawn(String npcName){
  NPCEntity npc=npcs.get(npcName);
  if (npc != null) {
    npcs.remove(npcName);
    try {
      npc.world.removeEntity(npcNpc);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void despawn(String npcName){
  if (npcName.length() > 16) {
    npcName=npcName.substring(0,16);
  }
  NPCEntity npc=npcs.get(npcName);
  if (npc != null) {
    npcs.remove(npcName);
    try {
      npc.world.removeEntity(npc);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}
Program: 153232
Project: 153232
Buggy source:
private IndexInput wrapInput(String name) throws IOException {
  return new CompressedIndexInput(name,_directory,_compression,_blockSize);
}

Fixed version (ground truth):
private IndexInput wrapInput(String name) throws IOException {
  return new CompressedIndexInput(name,_directory,_compression);
}
Program: 153233
Project: 153233
Buggy source:
public CompressedIndexOutput(String name,Directory directory,CompressionCodec compression,int blockSize) throws IOException {
  _compression=compression;
  _directory=directory;
  _name=name;
  _output=directory.createOutput(name);
  _tmpOutput=directory.createOutput(name + Z_TMP);
  _buffer=new byte[blockSize];
  _compressedBuffer=new byte[blockSize * 2];
}

Fixed version (ground truth):
public CompressedIndexOutput(String name,Directory directory,CompressionCodec compression,int blockSize) throws IOException {
  _compression=compression;
  _directory=directory;
  _name=name;
  _output=directory.createOutput(name);
  _tmpOutput=directory.createOutput(name + Z_TMP);
  _buffer=new byte[blockSize];
  _compressedBuffer=new byte[blockSize * 2];
  System.out.println("String_Node_Str" + name + "String_Node_Str"+ blockSize+ "String_Node_Str");
}
Program: 153234
Project: 153234
Buggy source:
private void readMetaData() throws IOException {
  _indexInput.seek(_realLength - 20);
  long metaDataLength=_indexInput.readLong();
  int blockCount=_indexInput.readInt();
  _origLength=_indexInput.readLong();
  _blockLengths=new int[blockCount];
  _blockPositions=new long[blockCount];
  _indexInput.seek(_realLength - 20 - metaDataLength);
  for (int i=0; i < blockCount; i++) {
    _blockPositions[i]=_indexInput.readVLong();
    _blockLengths[i]=_indexInput.readVInt();
  }
}

Fixed version (ground truth):
private void readMetaData() throws IOException {
  _indexInput.seek(_realLength - _SIZES_META_DATA);
  long metaDataLength=_indexInput.readLong();
  int blockCount=_indexInput.readInt();
  _blockSize=_indexInput.readInt();
  _origLength=_indexInput.readLong();
  _blockLengths=new int[blockCount];
  _blockPositions=new long[blockCount];
  _indexInput.seek(_realLength - _SIZES_META_DATA - metaDataLength);
  for (int i=0; i < blockCount; i++) {
    _blockPositions[i]=_indexInput.readVLong();
    _blockLengths[i]=_indexInput.readVInt();
  }
}
Program: 153235
Project: 153235
Buggy source:
public CompressedIndexInput(String name,Directory directory,CompressionCodec compression,int blockSize) throws IOException {
  _compression=compression;
  _indexInput=directory.openInput(name);
  _realLength=_indexInput.length();
  _blockBuffer=new byte[blockSize];
  _decompressionBuffer=new byte[blockSize * 2];
  _blockSize=blockSize;
  readMetaData();
}

Fixed version (ground truth):
public CompressedIndexInput(String name,Directory directory,CompressionCodec compression) throws IOException {
  _compression=compression;
  _indexInput=directory.openInput(name);
  _realLength=_indexInput.length();
  readMetaData();
  _blockBuffer=new byte[_blockSize];
  _decompressionBuffer=new byte[_blockSize * 2];
  System.out.println("String_Node_Str" + _origLength + "String_Node_Str"+ _realLength);
}
Program: 153236
Project: 153236
Buggy source:
public CompressedFieldDataDirectory(Directory dir,CompressionCodec compression,int blockSize){
  _directory=dir;
  if (compression == null) {
    _compression=DEFAULT_COMPRESSION;
  }
 else {
    _compression=compression;
  }
  _blockSize=blockSize;
}

Fixed version (ground truth):
public CompressedFieldDataDirectory(Directory dir,CompressionCodec compression,int blockSize){
  _directory=dir;
  if (compression == null) {
    _compression=DEFAULT_COMPRESSION;
  }
 else {
    _compression=compression;
  }
  _writingBlockSize=blockSize;
}
Program: 153237
Project: 153237
Buggy source:
private IndexOutput wrapOutput(String name) throws IOException {
  return new CompressedIndexOutput(name,_directory,_compression,_blockSize);
}

Fixed version (ground truth):
private IndexOutput wrapOutput(String name) throws IOException {
  return new CompressedIndexOutput(name,_directory,_compression,_writingBlockSize);
}
Program: 153238
Project: 153238
Buggy source:
public void readBytes(byte[] b,int offset,int len) throws IOException {
synchronized (_indexInput) {
    while (len > 0) {
      int blockId=getBlockId();
      if (blockId != _currentBlockId) {
        fetchBlock(blockId);
      }
      int blockPosition=getBlockPosition();
      int length=Math.min(_blockBufferLength - blockPosition,len);
      System.arraycopy(_blockBuffer,blockPosition,b,offset,length);
      _pos+=length;
      len-=length;
    }
  }
}

Fixed version (ground truth):
public void readBytes(byte[] b,int offset,int len) throws IOException {
synchronized (_indexInput) {
    while (len > 0) {
      int blockId=getBlockId();
      if (blockId != _currentBlockId) {
        fetchBlock(blockId);
      }
      int blockPosition=getBlockPosition();
      int length=Math.min(_blockBufferLength - blockPosition,len);
      System.arraycopy(_blockBuffer,blockPosition,b,offset,length);
      _pos+=length;
      len-=length;
      offset+=length;
    }
  }
}
Program: 153239
Project: 153239
Buggy source:
public void actionPerformed(ActionEvent action){
  if (action.getSource().equals(connect)) {
    try {
      pf.setString("String_Node_Str",serverName.getText());
      pf.setInt("String_Node_Str",Integer.parseInt(portNum.getText()));
      pf.setInt("String_Node_Str",Integer.parseInt(localServerPortnum.getText()));
      pf.save();
    }
 catch (    NumberFormatException nfe) {
    }
    if (serverMainThread == null || !serverMainThread.isAlive()) {
      safeSetButton("String_Node_Str");
      final String distantServer=serverName.getText() + "String_Node_Str" + portNum.getText();
      final String localServer=localServerPortnum.getText();
      serverMainThread=new Thread(new Runnable(){
        public void run(){
          String[] args={localServer,distantServer,"String_Node_Str","String_Node_Str","String_Node_Str"};
          Main.main(args,false);
        }
      }
);
      serverMainThread.start();
    }
 else {
      safeSetButton("String_Node_Str");
      serverMainThread.interrupt();
    }
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent action){
  if (action.getSource().equals(connect)) {
    int desired=48;
    try {
      pf.setString("String_Node_Str",serverName.getText());
      pf.setInt("String_Node_Str",Integer.parseInt(portNum.getText()));
      pf.setInt("String_Node_Str",Integer.parseInt(localServerPortnum.getText()));
      try {
        desired=Integer.parseInt(desiredSize.getText());
      }
 catch (      NumberFormatException nfe) {
        desired=48;
        desiredSize.setText("String_Node_Str");
      }
      pf.setInt("String_Node_Str",desired);
      desiredSize.setEditable(false);
      pf.save();
    }
 catch (    NumberFormatException nfe) {
    }
    if (serverMainThread == null || !serverMainThread.isAlive()) {
      safeSetButton("String_Node_Str");
      final String distantServer=serverName.getText() + "String_Node_Str" + portNum.getText();
      final String localServer=localServerPortnum.getText();
      final String cacheSize=Integer.toString(desired * 1024 * 1024);
      serverMainThread=new Thread(new Runnable(){
        public void run(){
          String[] args={localServer,distantServer,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",cacheSize};
          Main.main(args,false);
        }
      }
);
      serverMainThread.start();
    }
 else {
      safeSetButton("String_Node_Str");
      serverMainThread.interrupt();
      desiredSize.setEditable(true);
    }
  }
}
Program: 153241
Project: 153241
Buggy source:
public void run(){
  String[] args={localServer,distantServer,"String_Node_Str","String_Node_Str","String_Node_Str"};
  Main.main(args,false);
}

Fixed version (ground truth):
public void run(){
  String[] args={localServer,distantServer,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",cacheSize};
  Main.main(args,false);
}
Program: 153242
Project: 153242
Buggy source:
public static void pruneCache(){
synchronized (dirSyncObject) {
    int limit=Globals.getCacheLimit();
    while (!fileList.isEmpty() && limit > 0 && directorySize > limit) {
      File oldest=fileList.removeFirst();
      removeFile(oldest);
    }
  }
}

Fixed version (ground truth):
public static void pruneCache(){
synchronized (dirSyncObject) {
    int limit=Globals.getCacheLimit();
    while (!fileList.isEmpty() && limit > 0 && directorySize > limit) {
      File oldest=fileList.removeFirst();
      removeFile(oldest);
    }
    if (Main.craftGUI != null) {
      Main.craftGUI.safeSetFileSize(Integer.toString(directorySize / 1024 / 1024));
    }
  }
}
Program: 153247
Project: 153247
Buggy source:
public HashCache(PassthroughConnection ptc){
  ptc.hashQueue=new ConcurrentLinkedQueue<Long>();
  if (!Main.cacheDir.isDirectory()) {
    return;
  }
  File[] files=Main.cacheDir.listFiles();
  Arrays.sort(files,fileCompare);
  if (files.length > 0) {
    fileId=getIntFromName(files[files.length - 1]) + 1;
  }
  for (  File file : files) {
    readSingleFile(file,false,ptc);
  }
  ptc.hashesReceivedThisConnection=new ConcurrentHashMap<Long,Boolean>();
}

Fixed version (ground truth):
public HashCache(PassthroughConnection ptc){
  System.out.println("String_Node_Str");
  ptc.hashQueue=new ConcurrentLinkedQueue<Long>();
  if (!Main.cacheDir.isDirectory()) {
    return;
  }
  File[] files=Main.cacheDir.listFiles();
  Arrays.sort(files,fileCompare);
  if (files.length > 0) {
    fileId=getIntFromName(files[files.length - 1]) + 1;
  }
  for (  File file : files) {
    readSingleFile(file,false,ptc);
  }
  ptc.hashesReceivedThisConnection=new ConcurrentHashMap<Long,Boolean>();
}
Program: 153249
Project: 153249
Buggy source:
public static void killServer(){
  Logging.log("String_Node_Str");
synchronized (sleeper) {
    serverEnabled=false;
    sleeper.notifyAll();
  }
}

Fixed version (ground truth):
public static void killServer(){
  Logging.log("String_Node_Str");
  if (server != null) {
    server.interrupt();
  }
  try {
    server.join();
  }
 catch (  InterruptedException e) {
    Logging.log("String_Node_Str");
  }
}
Program: 153251
Project: 153251
Buggy source:
public Integer recompressChunkData(byte[] buffer,boolean overwriteInput,long[] hashes){
  if (buffer.length < 131072) {
    return null;
  }
  int inputOffset=32768;
  int inputSize=81920;
  int outputOffset=overwriteInput ? 0 : 16384;
  int outputSize=overwriteInput ? 32768 : 16384;
  ;
  if (hashes != null) {
    int pos=inputSize + inputOffset;
    for (int a=0; a < 40; a++) {
      long hash=hashes[a];
      for (int b=0; b < 8; b++) {
        buffer[pos++]=(byte)hash;
        hash=hash >> 8;
      }
    }
    inputSize+=8 * 40;
  }
  deflate.reset();
  deflate.setInput(buffer,inputOffset,inputSize);
  deflate.finish();
  int compressedLength=deflate.deflate(buffer,outputOffset,outputSize);
  if (!deflate.finished()) {
    return null;
  }
 else {
    return compressedLength;
  }
}

Fixed version (ground truth):
public Integer recompressChunkData(byte[] buffer,boolean overwriteInput,long[] hashes){
  if (buffer.length < 163840) {
    return null;
  }
  int inputOffset=65536;
  int inputSize=81920;
  int outputOffset=overwriteInput ? 0 : 32768;
  int outputSize=overwriteInput ? 65536 : 32768;
  if (hashes != null) {
    int pos=inputSize + inputOffset;
    for (int a=0; a < 40; a++) {
      long hash=hashes[a];
      for (int b=0; b < 8; b++) {
        buffer[pos++]=(byte)hash;
        hash=hash >> 8;
      }
    }
    inputSize+=8 * 40;
  }
  deflate.reset();
  deflate.setInput(buffer,inputOffset,inputSize);
  deflate.finish();
  int compressedLength=deflate.deflate(buffer,outputOffset,outputSize);
  if (!deflate.finished()) {
    return null;
  }
 else {
    return compressedLength;
  }
}
Program: 153252
Project: 153252
Buggy source:
public long[] extractHashes(byte[] buffer,long[] hashes){
  int inputOffset=32768;
  int inputSize=81920;
  int pos=inputSize + inputOffset;
  for (int a=0; a < 40; a++) {
    long hash=0;
    for (int b=0; b < 8; b++) {
      byte value=buffer[pos++];
      hash=(hash >> 8) & 0x00FFFFFFFFFFFFFFL;
      hash|=((long)value) << 56;
    }
    hashes[a]=hash;
  }
  return hashes;
}

Fixed version (ground truth):
public long[] extractHashes(byte[] buffer,long[] hashes){
  int inputOffset=65536;
  int inputSize=81920;
  int pos=inputSize + inputOffset;
  for (int a=0; a < 40; a++) {
    long hash=0;
    for (int b=0; b < 8; b++) {
      byte value=buffer[pos++];
      hash=(hash >> 8) & 0x00FFFFFFFFFFFFFFL;
      hash|=((long)value) << 56;
    }
    hashes[a]=hash;
  }
  return hashes;
}
Program: 153253
Project: 153253
Buggy source:
public long[] generateHashes(PassthroughConnection ptc,byte[] buffer){
synchronized (ptc.hashThreadSyncObject) {
    if (ptc.hashThreads == null) {
      ptc.hashThreads=new HashThread[4];
      for (int cnt=0; cnt < 4; cnt++) {
        ptc.hashThreads[cnt]=new HashThread(ptc);
        ptc.hashThreads[cnt].start();
      }
    }
  }
  HashThread[] hashThreads=ptc.hashThreads;
  for (int cnt=0; cnt < 40; cnt+=10) {
    hashThreads[cnt / 10].init(buffer,32768,cnt,cnt + 10,ptc.hashes,dontWipe);
  }
  for (int cnt=0; cnt < 4; cnt++) {
    hashThreads[cnt].doneJoin();
  }
  return ptc.hashes;
}

Fixed version (ground truth):
public long[] generateHashes(PassthroughConnection ptc,byte[] buffer){
synchronized (ptc.hashThreadSyncObject) {
    if (ptc.hashThreads == null) {
      ptc.hashThreads=new HashThread[4];
      for (int cnt=0; cnt < 4; cnt++) {
        ptc.hashThreads[cnt]=new HashThread(ptc);
        ptc.hashThreads[cnt].start();
      }
    }
  }
  HashThread[] hashThreads=ptc.hashThreads;
  for (int cnt=0; cnt < 40; cnt+=10) {
    hashThreads[cnt / 10].init(buffer,65536,cnt,cnt + 10,ptc.hashes,dontWipe);
  }
  for (int cnt=0; cnt < 4; cnt++) {
    hashThreads[cnt].doneJoin();
  }
  return ptc.hashes;
}
Program: 153254
Project: 153254
Buggy source:
byte[] expandChunkData(byte[] input,int inputLength,byte[] buffer){
  if (buffer.length < 131072 || inputLength > 16384) {
    return null;
  }
  inflate.reset();
  inflate.setInput(input,0,inputLength);
  int outputOffset=32768;
  int outputLength=131072 - outputOffset;
  int expandedLength=-1;
  try {
    expandedLength=inflate.inflate(buffer,outputOffset,outputLength);
  }
 catch (  DataFormatException e) {
    return null;
  }
  if (expandedLength != 81920 && expandedLength != 81920 + 320) {
    return null;
  }
  return buffer;
}

Fixed version (ground truth):
byte[] expandChunkData(byte[] input,int inputLength,byte[] buffer){
  if (buffer.length < 163840 || inputLength > 32768) {
    return null;
  }
  inflate.reset();
  inflate.setInput(input,0,inputLength);
  int outputOffset=65536;
  int outputLength=163840 - outputOffset;
  int expandedLength=-1;
  try {
    expandedLength=inflate.inflate(buffer,outputOffset,outputLength);
  }
 catch (  DataFormatException e) {
    return null;
  }
  if (expandedLength != 81920 && expandedLength != 81920 + 320) {
    return null;
  }
  return buffer;
}
Program: 153255
Project: 153255
Buggy source:
public void wipeBuffer(PassthroughConnection ptc,byte[] buffer,boolean[] wipe){
  HashThread[] hashThreads=ptc.hashThreads;
  for (int cnt=0; cnt < 40; cnt+=10) {
    hashThreads[cnt / 10].init(buffer,32768,cnt,cnt + 10,ptc.hashes,wipe);
  }
  for (int cnt=0; cnt < 4; cnt++) {
    hashThreads[cnt].doneJoin();
  }
}

Fixed version (ground truth):
public void wipeBuffer(PassthroughConnection ptc,byte[] buffer,boolean[] wipe){
  HashThread[] hashThreads=ptc.hashThreads;
  for (int cnt=0; cnt < 40; cnt+=10) {
    hashThreads[cnt / 10].init(buffer,65536,cnt,cnt + 10,ptc.hashes,wipe);
  }
  for (int cnt=0; cnt < 4; cnt++) {
    hashThreads[cnt].doneJoin();
  }
}
Program: 153258
Project: 153258
Buggy source:
@Override public byte[] write(DataOutputStream out,PassthroughConnection ptc,KillableThread thread,boolean serverToClient){
  if (!serverToClient || (!ptc.clientInfo.getLocalCache())) {
    return super.write(out,ptc,thread,serverToClient);
  }
 else {
    int length=super.lengthUnit.getValue();
    byte[] buffer=super.getValue();
    if (Globals.compressInfo()) {
      ptc.printLogMessage("String_Node_Str" + ptc.setHashes.size());
      ptc.printLogMessage("String_Node_Str" + length);
    }
    ChunkScan chunkScan=ptc.chunkScan;
    chunkScan.expandChunkData(buffer,length,buffer);
    chunkScan.generateHashes(ptc,buffer);
    boolean[] matches=new boolean[40];
    for (int cnt=0; cnt < 40; cnt++) {
      Long hash=ptc.hashes[cnt];
      matches[cnt]=ptc.setHashes.contains(hash);
      ptc.setHashes.add(hash);
    }
    chunkScan.wipeBuffer(ptc,buffer,matches);
    Integer newLength=chunkScan.recompressChunkData(buffer,true,ptc.hashes);
    if (newLength == null) {
      return null;
    }
    super.lengthUnit.setValue(-newLength);
    if (Globals.compressInfo()) {
      ptc.printLogMessage("String_Node_Str" + newLength);
    }
    return super.write(out,ptc,thread,serverToClient);
  }
}

Fixed version (ground truth):
@Override public byte[] write(DataOutputStream out,PassthroughConnection ptc,KillableThread thread,boolean serverToClient){
  if (!serverToClient || (!ptc.clientInfo.getLocalCache())) {
    return super.write(out,ptc,thread,serverToClient);
  }
 else {
    int length=super.lengthUnit.getValue();
    byte[] buffer=super.getValue();
    if (Globals.compressInfo()) {
      ptc.printLogMessage("String_Node_Str" + ptc.setHashes.size());
      ptc.printLogMessage("String_Node_Str" + length);
    }
    ChunkScan chunkScan=ptc.chunkScan;
    if (chunkScan.expandChunkData(buffer,length,buffer) == null) {
      if (Globals.compressInfo()) {
        ptc.printLogMessage("String_Node_Str");
      }
      return super.write(out,ptc,thread,serverToClient);
    }
    chunkScan.generateHashes(ptc,buffer);
    boolean[] matches=new boolean[40];
    for (int cnt=0; cnt < 40; cnt++) {
      Long hash=ptc.hashes[cnt];
      matches[cnt]=ptc.setHashes.contains(hash);
      ptc.setHashes.add(hash);
    }
    chunkScan.wipeBuffer(ptc,buffer,matches);
    Integer newLength=chunkScan.recompressChunkData(buffer,true,ptc.hashes);
    if (newLength == null) {
      if (Globals.compressInfo()) {
        ptc.printLogMessage("String_Node_Str");
      }
      return super.write(out,ptc,thread,serverToClient);
    }
    super.lengthUnit.setValue(-newLength);
    if (Globals.compressInfo()) {
      ptc.printLogMessage("String_Node_Str" + newLength);
    }
    return super.write(out,ptc,thread,serverToClient);
  }
}
Program: 153259
Project: 153259
Buggy source:
@Override public byte[] write(DataOutputStream out,PassthroughConnection ptc,KillableThread thread,boolean serverToClient){
  length=lengthUnit.write(out,ptc,thread,serverToClient);
  if (length == null) {
    return null;
  }
  incrementCounter(serverToClient,Math.abs(length),ptc);
  while (true) {
    try {
      out.write(value,0,Math.abs(length));
      out.flush();
    }
 catch (    SocketTimeoutException toe) {
      if (timedOut(thread)) {
        continue;
      }
      return null;
    }
catch (    IOException e) {
      return null;
    }
    super.timeout=0;
    return value;
  }
}

Fixed version (ground truth):
@Override public byte[] write(DataOutputStream out,PassthroughConnection ptc,KillableThread thread,boolean serverToClient){
  if ((length=lengthUnit.getValue()) < 0) {
    lengthUnit.setValue(length);
  }
  length=lengthUnit.write(out,ptc,thread,serverToClient);
  if (length == null) {
    return null;
  }
  incrementCounter(serverToClient,Math.abs(length),ptc);
  while (true) {
    try {
      out.write(value,0,Math.abs(length));
      out.flush();
    }
 catch (    SocketTimeoutException toe) {
      if (timedOut(thread)) {
        continue;
      }
      return null;
    }
catch (    IOException e) {
      return null;
    }
    super.timeout=0;
    return value;
  }
}
Program: 153264
Project: 153264
Buggy source:
public HashCache(PassthroughConnection ptc){
  System.out.println("String_Node_Str");
  ptc.hashQueue=new ConcurrentLinkedQueue<Long>();
  if (!Main.cacheDir.isDirectory()) {
    return;
  }
  File[] files=Main.cacheDir.listFiles();
  Arrays.sort(files,fileCompare);
  if (files.length > 0) {
    fileId=getIntFromName(files[files.length - 1]) + 1;
  }
  for (  File file : files) {
    readSingleFile(file,false,ptc);
  }
  ptc.hashesReceivedThisConnection=new ConcurrentHashMap<Long,Boolean>();
}

Fixed version (ground truth):
public HashCache(PassthroughConnection ptc){
  ptc.hashQueue=new ConcurrentLinkedQueue<Long>();
  if (!Main.cacheDir.isDirectory()) {
    return;
  }
  File[] files=Main.cacheDir.listFiles();
  Arrays.sort(files,fileCompare);
  if (files.length > 0) {
    fileId=getIntFromName(files[files.length - 1]) + 1;
  }
  for (  File file : files) {
    readSingleFile(file,false,ptc);
  }
  ptc.hashesReceivedThisConnection=new ConcurrentHashMap<Long,Boolean>();
  ptc.hashesSentThisConnection=new ConcurrentHashMap<Long,Boolean>();
}
Program: 153266
Project: 153266
Buggy source:
@Override public String read(DataInputStream in,PassthroughConnection ptc,KillableThread thread,boolean serverToClient,DownlinkState linkState){
  while (true) {
    try {
      value=in.readUTF();
    }
 catch (    SocketTimeoutException toe) {
      if (timedOut(thread)) {
        continue;
      }
      return null;
    }
catch (    IOException e) {
      return null;
    }
  }
}

Fixed version (ground truth):
@Override public String read(DataInputStream in,PassthroughConnection ptc,KillableThread thread,boolean serverToClient,DownlinkState linkState){
  while (true) {
    try {
      value=in.readUTF();
    }
 catch (    SocketTimeoutException toe) {
      if (timedOut(thread)) {
        continue;
      }
      return null;
    }
catch (    IOException e) {
      return null;
    }
    super.timeout=0;
    return value;
  }
}
Program: 153267
Project: 153267
Buggy source:
@Override public String write(DataOutputStream out,PassthroughConnection ptc,KillableThread thread,boolean serverToClient){
  while (true) {
    try {
      out.writeUTF(value);
    }
 catch (    SocketTimeoutException toe) {
      if (timedOut(thread)) {
        continue;
      }
      return null;
    }
catch (    IOException e) {
      return null;
    }
  }
}

Fixed version (ground truth):
@Override public String write(DataOutputStream out,PassthroughConnection ptc,KillableThread thread,boolean serverToClient){
  while (true) {
    try {
      out.writeUTF(value);
    }
 catch (    SocketTimeoutException toe) {
      if (timedOut(thread)) {
        continue;
      }
      return null;
    }
catch (    IOException e) {
      return null;
    }
    super.timeout=0;
    return value;
  }
}
Program: 153268
Project: 153268
Buggy source:
public static Integer getPort(String fullHostname){
  int pos=fullHostname.lastIndexOf("String_Node_Str");
  if (pos == -1) {
    try {
      return Integer.parseInt(fullHostname);
    }
 catch (    NumberFormatException nfe) {
      return null;
    }
  }
 else {
    try {
      return Integer.parseInt(fullHostname.substring(pos + 1));
    }
 catch (    NumberFormatException nfe) {
      return null;
    }
  }
}

Fixed version (ground truth):
public static Integer getPort(String fullHostname){
  int pos=fullHostname.lastIndexOf("String_Node_Str");
  int pos2=fullHostname.lastIndexOf("String_Node_Str");
  int lastMarker=Math.max(pos,pos2);
  if (lastMarker == -1) {
    try {
      return Integer.parseInt(fullHostname);
    }
 catch (    NumberFormatException nfe) {
      return null;
    }
  }
 else {
    try {
      return Integer.parseInt(fullHostname.substring(lastMarker + 1));
    }
 catch (    NumberFormatException nfe) {
      return null;
    }
  }
}
Program: 153274
Project: 153274
Buggy source:
synchronized void printLogMessage(String message){
  String username=clientInfo.getUsername();
  if (username == null) {
    Logging.log("String_Node_Str" + shortTime.format(new Date()) + "String_Node_Str"+ clientInfo.getIP()+ "String_Node_Str"+ clientInfo.getPort()+ "String_Node_Str"+ message);
  }
 else {
    Logging.log("String_Node_Str" + shortTime.format(new Date()) + "String_Node_Str"+ clientInfo.getIP()+ "String_Node_Str"+ clientInfo.getPort()+ "String_Node_Str"+ username+ "String_Node_Str"+ message);
  }
}

Fixed version (ground truth):
synchronized void printLogMessage(String message){
  String username=(clientInfo == null) ? null : (clientInfo.getUsername());
  if (username == null) {
    Logging.log("String_Node_Str" + shortTime.format(new Date()) + "String_Node_Str"+ clientInfo.getIP()+ "String_Node_Str"+ clientInfo.getPort()+ "String_Node_Str"+ message);
  }
 else {
    Logging.log("String_Node_Str" + shortTime.format(new Date()) + "String_Node_Str"+ clientInfo.getIP()+ "String_Node_Str"+ clientInfo.getPort()+ "String_Node_Str"+ username+ "String_Node_Str"+ message);
  }
}
Program: 153275
Project: 153275
Buggy source:
@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  boolean first=true;
  if (!full) {
    for (int cnt2=0; cnt2 < cnt; cnt2++) {
      if (first) {
        first=false;
        sb.append(buffer[cnt2]);
      }
 else {
        sb.append("String_Node_Str" + buffer[cnt2]);
      }
    }
  }
 else {
    int cntHigh=cnt + size;
    for (int cnt2=cnt; (cnt2 != cnt && cnt2 != cntHigh) || first; cnt2++) {
      if (cnt2 >= size) {
        cnt2=0;
      }
      System.out.println(cnt + "String_Node_Str" + cnt2);
      if (first) {
        first=false;
        sb.append(buffer[cnt2]);
      }
 else {
        sb.append("String_Node_Str" + buffer[cnt2]);
      }
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  boolean first=true;
  if (!full) {
    for (int cnt2=0; cnt2 < cnt; cnt2++) {
      if (first) {
        first=false;
        sb.append(buffer[cnt2]);
      }
 else {
        sb.append("String_Node_Str" + buffer[cnt2]);
      }
    }
  }
 else {
    int cntHigh=cnt + size;
    for (int cnt2=cnt; (cnt2 != cnt && cnt2 != cntHigh) || first; cnt2++) {
      if (cnt2 >= size) {
        cnt2=0;
      }
      if (first) {
        first=false;
        sb.append(buffer[cnt2]);
      }
 else {
        sb.append("String_Node_Str" + buffer[cnt2]);
      }
    }
  }
  return sb.toString();
}
Program: 153278
Project: 153278
Buggy source:
@Override public ItemStack read(DataInputStream in,PassthroughConnection ptc,KillableThread thread,boolean serverToClient,DownlinkState linkState){
  while (true) {
    try {
      value.blockId=in.readShort();
    }
 catch (    SocketTimeoutException toe) {
      if (timedOut(thread)) {
        continue;
      }
      return null;
    }
catch (    IOException e) {
      return null;
    }
    if (value.blockId < 0) {
      return value;
    }
    try {
      value.amount=in.readByte();
    }
 catch (    SocketTimeoutException toe) {
      if (timedOut(thread)) {
        continue;
      }
      return null;
    }
catch (    IOException e) {
      return null;
    }
    try {
      value.damage=in.readShort();
    }
 catch (    SocketTimeoutException toe) {
      if (timedOut(thread)) {
        continue;
      }
      return null;
    }
catch (    IOException e) {
      return null;
    }
    super.timeout=0;
    return value;
  }
}

Fixed version (ground truth):
@Override public ItemStack read(DataInputStream in,PassthroughConnection ptc,KillableThread thread,boolean serverToClient,DownlinkState linkState){
  if (value == null) {
    value=new ItemStack();
  }
  while (true) {
    try {
      value.blockId=in.readShort();
    }
 catch (    SocketTimeoutException toe) {
      if (timedOut(thread)) {
        continue;
      }
      return null;
    }
catch (    IOException e) {
      return null;
    }
    if (value.blockId < 0) {
      return value;
    }
    try {
      value.amount=in.readByte();
    }
 catch (    SocketTimeoutException toe) {
      if (timedOut(thread)) {
        continue;
      }
      return null;
    }
catch (    IOException e) {
      return null;
    }
    try {
      value.damage=in.readShort();
    }
 catch (    SocketTimeoutException toe) {
      if (timedOut(thread)) {
        continue;
      }
      return null;
    }
catch (    IOException e) {
      return null;
    }
    super.timeout=0;
    return value;
  }
}
Program: 153279
Project: 153279
Buggy source:
public void run(){
  boolean eof=false;
  byte[] buffer=new byte[131072];
  DownlinkState linkState=new DownlinkState();
  while (!eof && !super.killed()) {
    Byte packetId=UnitByte.getByte(in,ptc,this);
    if (packetId == null) {
      ptc.printLogMessage("String_Node_Str");
      eof=true;
      continue;
    }
    if (UnitByte.writeByte(out,packetId,ptc,this) == null) {
      ptc.printLogMessage("String_Node_Str");
      eof=true;
      continue;
    }
    Packet currentPacket=new Packet(packetId);
    if (Globals.isVerbose()) {
      ptc.printLogMessage("String_Node_Str" + packetId);
    }
    if (currentPacket.pass(in,out,ptc,this,true,buffer,linkState) == null) {
      ptc.printLogMessage("String_Node_Str");
      eof=true;
      continue;
    }
  }
  ptc.interrupt();
}

Fixed version (ground truth):
public void run(){
  boolean eof=false;
  byte[] buffer=new byte[131072];
  DownlinkState linkState=new DownlinkState();
  while (!eof && !super.killed()) {
    Byte packetId=UnitByte.getByte(in,ptc,this);
    if (packetId == null) {
      if (!Globals.isQuiet()) {
        ptc.printLogMessage("String_Node_Str");
      }
      eof=true;
      continue;
    }
    if (UnitByte.writeByte(out,packetId,ptc,this) == null) {
      if (!Globals.isQuiet()) {
        ptc.printLogMessage("String_Node_Str");
      }
      eof=true;
      continue;
    }
    Packet currentPacket=new Packet(packetId);
    if (Globals.isVerbose()) {
      ptc.printLogMessage("String_Node_Str" + packetId);
    }
    if (currentPacket.pass(in,out,ptc,this,true,buffer,linkState) == null) {
      if (!Globals.isQuiet()) {
        ptc.printLogMessage("String_Node_Str");
      }
      eof=true;
      continue;
    }
  }
  ptc.interrupt();
}
Program: 153280
Project: 153280
Buggy source:
public void run(){
  boolean eof=false;
  byte[] buffer=new byte[131072];
  while (!eof && !super.killed()) {
    Byte packetId=UnitByte.getByte(in,ptc,this);
    if (packetId == null) {
      ptc.printLogMessage("String_Node_Str");
      eof=true;
      continue;
    }
    if (UnitByte.writeByte(out,packetId,ptc,this) == null) {
      ptc.printLogMessage("String_Node_Str");
      eof=true;
      continue;
    }
    Packet currentPacket=new Packet(packetId);
    if (Globals.isVerbose()) {
      ptc.printLogMessage("String_Node_Str" + packetId);
    }
    if (currentPacket.pass(in,out,ptc,this,false,buffer,null) == null) {
      ptc.printLogMessage("String_Node_Str");
      eof=true;
      continue;
    }
  }
  ptc.interrupt();
}

Fixed version (ground truth):
public void run(){
  boolean eof=false;
  byte[] buffer=new byte[131072];
  while (!eof && !super.killed()) {
    Byte packetId=UnitByte.getByte(in,ptc,this);
    if (packetId == null) {
      if (!Globals.isQuiet()) {
        ptc.printLogMessage("String_Node_Str");
      }
      eof=true;
      continue;
    }
    if (packetId == 0xFF) {
      ptc.printLogMessage("String_Node_Str");
      eof=true;
    }
    if (UnitByte.writeByte(out,packetId,ptc,this) == null) {
      ptc.printLogMessage("String_Node_Str");
      eof=true;
      continue;
    }
    Packet currentPacket=new Packet(packetId);
    if (Globals.isVerbose()) {
      ptc.printLogMessage("String_Node_Str" + packetId);
    }
    if (currentPacket.pass(in,out,ptc,this,false,buffer,null) == null) {
      if (!Globals.isQuiet()) {
        ptc.printLogMessage("String_Node_Str");
      }
      eof=true;
      continue;
    }
  }
  ptc.interrupt();
}
Program: 153281
Project: 153281
Buggy source:
@Override public Packet pass(DataInputStream in,DataOutputStream out,PassthroughConnection ptc,KillableThread thread,boolean serverToClient,byte[] buffer,DownlinkState linkState){
  if (!setupFields()) {
    ptc.printLogMessage("String_Node_Str" + packetId);
  }
  if (Globals.isVerbose()) {
    ptc.printLogMessage((serverToClient ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + packetId);
  }
  int length=fields.length;
  for (int cnt=0; cnt < length; cnt++) {
    if (Globals.isVerbose()) {
      ptc.printLogMessage((serverToClient ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + fields[cnt].getClass().toString());
    }
    Object val=fields[cnt].pass(in,out,ptc,null,serverToClient,buffer,linkState);
    if (Globals.isVerbose()) {
      ptc.printLogMessage(cnt + "String_Node_Str" + val);
    }
    if (val == null) {
      return null;
    }
  }
  entityDestroyCheck(linkState);
  return this;
}

Fixed version (ground truth):
@Override public Packet pass(DataInputStream in,DataOutputStream out,PassthroughConnection ptc,KillableThread thread,boolean serverToClient,byte[] buffer,DownlinkState linkState){
  if (!setupFields()) {
    ptc.printLogMessage("String_Node_Str" + packetId);
  }
  if (Globals.isVerbose()) {
    ptc.printLogMessage((serverToClient ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + packetId);
  }
  int length=fields.length;
  for (int cnt=0; cnt < length; cnt++) {
    if (Globals.isVerbose()) {
      ptc.printLogMessage((serverToClient ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + fields[cnt].getClass().toString());
    }
    Object val=fields[cnt].pass(in,out,ptc,thread,serverToClient,buffer,linkState);
    if (Globals.isVerbose()) {
      ptc.printLogMessage(cnt + "String_Node_Str" + val);
    }
    if (val == null) {
      return null;
    }
  }
  entityDestroyCheck(linkState);
  return this;
}
Program: 153283
Project: 153283
Buggy source:
boolean timedOut(KillableThread thread){
  if (thread == null || (!thread.killed)) {
    timeout++;
    if (timeout >= 20) {
      return false;
    }
 else {
      return true;
    }
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
boolean timedOut(KillableThread thread){
  if (thread == null || (!thread.killed())) {
    timeout++;
    if (timeout >= 20) {
      return false;
    }
 else {
      return true;
    }
  }
 else {
    return false;
  }
}
Program: 153284
Project: 153284
Buggy source:
public static ApiException create(StatusLine statusLine,Object jsonResponse){
  int statusCode=statusLine.getStatusCode();
  Map<String,Object> response=(Map<String,Object>)jsonResponse;
  return new ApiException(statusCode,response.get("String_Node_Str").toString(),jsonResponse);
}

Fixed version (ground truth):
public static ApiException create(StatusLine statusLine,Map<String,Object> jsonResponse){
  if (jsonResponse == null) {
    jsonResponse=new HashMap<String,Object>();
  }
  final String errorMessage=jsonResponse.get(ERRORMSG) == null ? "String_Node_Str" : jsonResponse.get(ERRORMSG).toString();
  return new ApiException(statusLine.getStatusCode(),errorMessage,jsonResponse);
}
Program: 153285
Project: 153285
Buggy source:
public ApiException(int statusCode,String reason,Object jsonResponse){
  super(reason);
  logger.warn("String_Node_Str",statusCode,reason);
  this.jsonResponse=(Map<String,Object>)jsonResponse;
  this.statusCode=statusCode;
}

Fixed version (ground truth):
public ApiException(int statusCode,String reason,Map<String,Object> jsonResponse){
  super(reason);
  logger.warn("String_Node_Str",statusCode,reason);
  this.jsonResponse=jsonResponse;
  this.statusCode=statusCode;
}
Program: 153286
Project: 153286
Buggy source:
public ResourceNotFoundException(int statusCode,String reason,Object jsonResponse){
  super(statusCode,reason,jsonResponse);
}

Fixed version (ground truth):
public ResourceNotFoundException(int statusCode,String reason,Map<String,Object> jsonResponse){
  super(statusCode,reason,jsonResponse);
}
Program: 153287
Project: 153287
Buggy source:
public UnAuthorizedException(int statusCode,String reason,Object jsonResponse){
  super(statusCode,reason,jsonResponse);
}

Fixed version (ground truth):
public UnAuthorizedException(int statusCode,String reason,Map<String,Object> jsonResponse){
  super(statusCode,reason,jsonResponse);
}
Program: 153288
Project: 153288
Buggy source:
public synchronized String read(String regionFilePath,String sequenceNameRequested) throws IOException {
  File regionFile=new File(regionFilePath);
  BufferedReader fileReader=NonDatabaseDataSourceIndexBuilder.getReader(regionFile);
  try {
    String line="String_Node_Str";
    boolean currentSequenceMatches=false;
    while ((line=fileReader.readLine()) != null) {
      if (line.startsWith("String_Node_Str")) {
        String sequenceName=line.substring(1);
        int spacePos=sequenceName.indexOf("String_Node_Str");
        if (spacePos != -1) {
          sequenceName=sequenceName.substring(0,spacePos);
        }
        currentSequenceMatches=sequenceName.equals(sequenceNameRequested);
        logger.info(String.format("String_Node_Str",sequenceName));
      }
 else       if (currentSequenceMatches) {
        sequenceStringbuffer.append(line);
      }
    }
  }
  finally {
    fileReader.close();
  }
  logger.info(String.format("String_Node_Str",sequenceStringbuffer.length()));
  return sequenceStringbuffer.toString();
}

Fixed version (ground truth):
public synchronized String read(String regionFilePath,String sequenceNameRequested) throws IOException {
  File regionFile=new File(regionFilePath);
  BufferedReader fileReader=NonDatabaseDataSourceIndexBuilder.getReader(regionFile);
  StringBuffer sequenceStringbuffer=new StringBuffer();
  try {
    String line="String_Node_Str";
    boolean currentSequenceMatches=false;
    while ((line=fileReader.readLine()) != null) {
      if (line.startsWith("String_Node_Str")) {
        String sequenceName=line.substring(1);
        int spacePos=sequenceName.indexOf("String_Node_Str");
        if (spacePos != -1) {
          sequenceName=sequenceName.substring(0,spacePos);
        }
        currentSequenceMatches=sequenceName.equals(sequenceNameRequested);
        logger.info(String.format("String_Node_Str",sequenceName));
      }
 else       if (currentSequenceMatches) {
        sequenceStringbuffer.append(line);
      }
    }
  }
  finally {
    fileReader.close();
  }
  logger.info(String.format("String_Node_Str",sequenceStringbuffer.length()));
  return sequenceStringbuffer.toString();
}
Program: 153289
Project: 153289
Buggy source:
@Override public Sequence sequenceLength(String region){
  return sequence(region);
}

Fixed version (ground truth):
@Override public Sequence sequenceLength(String region){
  Sequence sequence=sequence(region);
  sequence.dna="String_Node_Str";
  return sequence;
}
Program: 153290
Project: 153290
Buggy source:
@Override public Sequence sequence(String region){
  Sequence sequence=(Sequence)Hazelcast.getMap("String_Node_Str").get(region);
  if (sequence != null)   return sequence;
  sequence=new Sequence();
  sequence.dna="String_Node_Str";
  sequence.length=0;
  sequence.organism_id=-1;
  Feature regionFeature=this.getInfo(region,null,null);
  String regionFilePath=null;
  for (  Property prop : regionFeature.properties) {
    if (prop.name.equals("String_Node_Str")) {
      regionFilePath=prop.value;
    }
  }
  if (regionFilePath != null) {
    try {
      sequence.dna=extractor.read(regionFilePath,region);
      ;
    }
 catch (    IOException e) {
      throw new RuntimeException("String_Node_Str" + region);
    }
  }
  sequence.length=sequence.dna.length();
  sequence.organism_id=regionFeature.organism_id;
  Hazelcast.getMap("String_Node_Str").put(region,sequence);
  return sequence;
}

Fixed version (ground truth):
@Override public Sequence sequence(String region){
  Sequence sequenceCached=(Sequence)Hazelcast.getMap("String_Node_Str").get(region);
  if (sequenceCached != null) {
    return clone(sequenceCached);
  }
  Sequence sequence=new Sequence();
  sequence.dna="String_Node_Str";
  sequence.organism_id=-1;
  Feature regionFeature=this.getInfo(region,null,null);
  String regionFilePath=null;
  if (regionFeature != null) {
    sequence.organism_id=regionFeature.organism_id;
    for (    Property prop : regionFeature.properties) {
      if (prop.name.equals("String_Node_Str")) {
        regionFilePath=prop.value;
      }
    }
    if (regionFilePath != null) {
      try {
        sequence.dna=extractor.read(regionFilePath,region);
        ;
      }
 catch (      IOException e) {
        logger.warn("String_Node_Str" + region);
      }
    }
  }
  sequence.length=sequence.dna.length();
  Hazelcast.getMap("String_Node_Str").put(region,sequence);
  return clone(sequence);
}
Program: 153291
Project: 153291
Buggy source:
@Override public Sequence sequenceTrimmed(String region,Integer start,Integer end){
  Sequence s=sequence(region);
  if (start == null && end == null) {
    s.start=0;
    s.end=s.length - 1;
    s.region=region;
    return s;
  }
  int max=s.dna.length() - 1;
  int actualStart=start - 1;
  int actualEnd=(end < max) ? end : max;
  s.dna=s.dna.substring(actualStart,actualEnd);
  s.start=start;
  s.end=end;
  return s;
}

Fixed version (ground truth):
@Override public Sequence sequenceTrimmed(String region,Integer start,Integer end){
  logger.info(String.format("String_Node_Str",region,start,end));
  Sequence sequence=sequence(region);
  if (start == null && end == null) {
    sequence.start=0;
    sequence.end=sequence.length - 1;
    sequence.region=region;
    return sequence;
  }
  int max=sequence.dna.length() - 1;
  if (max < 0) {
    sequence.start=0;
    sequence.end=0;
    return sequence;
  }
  int actualStart=start;
  int actualEnd=(end < max) ? end : max;
  logger.info(String.format("String_Node_Str",max,actualStart,actualEnd));
  sequence.dna=sequence.dna.substring(actualStart,actualEnd);
  sequence.start=start;
  sequence.end=end;
  return sequence;
}
Program: 153293
Project: 153293
Buggy source:
@Override public Sequence sequenceTrimmed(String region,Integer start,Integer end){
  Sequence s=sequence(region);
  if (start == null && end == null) {
    s.start=0;
    s.end=s.length - 1;
    s.region=region;
    return s;
  }
  int actualStart=start - 1;
  int actualEnd=end - 1;
  s.dna=s.dna.substring(actualStart,actualEnd);
  return s;
}

Fixed version (ground truth):
@Override public Sequence sequenceTrimmed(String region,Integer start,Integer end){
  Sequence s=sequence(region);
  if (start == null && end == null) {
    s.start=0;
    s.end=s.length - 1;
    s.region=region;
    return s;
  }
  int actualStart=start - 1;
  int actualEnd=end;
  s.dna=s.dna.substring(actualStart,actualEnd);
  return s;
}
Program: 153294
Project: 153294
Buggy source:
public void put(String key,String obj){
  if (obj.contains("String_Node_Str") && obj.contains("String_Node_Str")) {
    GFFAttributeMapList list=new GFFAttributeMapList();
    list.parseAttributes(obj);
    map.put(key,list);
  }
 else {
    String quote="String_Node_Str";
    String quote2="String_Node_Str";
    if ((obj.startsWith(quote) && obj.endsWith(quote)) || (obj.startsWith(quote2) && obj.endsWith(quote2))) {
      String oldObj=obj;
      obj=obj.substring(1,obj.length() - 2);
    }
    map.put(key,obj);
    if (key.equals("String_Node_Str")) {
      if (this.feature != null) {
        this.feature.id=obj;
      }
    }
  }
}

Fixed version (ground truth):
public void put(String key,String obj){
  if (obj == null || obj.length() == 0) {
    return;
  }
  if (obj.contains("String_Node_Str") && obj.contains("String_Node_Str")) {
    GFFAttributeMapList list=new GFFAttributeMapList();
    list.parseAttributes(obj);
    map.put(key,list);
  }
 else {
    String quote="String_Node_Str";
    String quote2="String_Node_Str";
    if ((obj.startsWith(quote) && obj.endsWith(quote)) || (obj.startsWith(quote2) && obj.endsWith(quote2))) {
      if (obj.length() <= 2)       return;
      obj=obj.substring(1,obj.length() - 1);
    }
    map.put(key,obj);
    if (key.equals("String_Node_Str")) {
      if (this.feature != null) {
        this.feature.id=obj;
      }
    }
  }
}