nus-yam/ex-repair huggingface dataset:
Program: 82338
Project: 82338
Buggy source:
private Thread getWriterOpener(ShardContext shardContext){
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      try {
        _writer.set(new BlurIndexWriter(_directory,_conf.clone()));
synchronized (_writer) {
          _writer.notify();
        }
        _indexImporter=new IndexImporter(_writer.get(),_lock,_shardContext,TimeUnit.SECONDS,10);
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
      }
    }
  }
);
  thread.setName("String_Node_Str" + shardContext.getTableContext().getTable() + "String_Node_Str"+ shardContext.getShard()+ "String_Node_Str");
  thread.setDaemon(true);
  return thread;
}

Fixed version (ground truth):
private Thread getWriterOpener(ShardContext shardContext){
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      try {
        _writer.set(new BlurIndexWriter(_directory,_conf.clone()));
synchronized (_writer) {
          _writer.notify();
        }
        _indexImporter=new IndexImporter(BlurIndexSimpleWriter.this,_shardContext,TimeUnit.SECONDS,10);
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
      }
    }
  }
);
  thread.setName("String_Node_Str" + shardContext.getTableContext().getTable() + "String_Node_Str"+ shardContext.getShard()+ "String_Node_Str");
  thread.setDaemon(true);
  return thread;
}
Program: 82339
Project: 82339
Buggy source:
private boolean applyDeletes(Directory directory,IndexWriter indexWriter,String shard,boolean emitDeletes) throws IOException {
  DirectoryReader reader=DirectoryReader.open(directory);
  try {
    LOG.info("String_Node_Str",reader);
    CompositeReaderContext compositeReaderContext=reader.getContext();
    List<AtomicReaderContext> leaves=compositeReaderContext.leaves();
    BlurPartitioner blurPartitioner=new BlurPartitioner();
    Text key=new Text();
    int numberOfShards=_shardContext.getTableContext().getDescriptor().getShardCount();
    int shardId=BlurUtil.getShardIndex(shard);
    for (    AtomicReaderContext context : leaves) {
      AtomicReader atomicReader=context.reader();
      Fields fields=atomicReader.fields();
      Terms terms=fields.terms(BlurConstants.ROW_ID);
      if (terms != null) {
        TermsEnum termsEnum=terms.iterator(null);
        BytesRef ref=null;
        while ((ref=termsEnum.next()) != null) {
          key.set(ref.bytes,ref.offset,ref.length);
          int partition=blurPartitioner.getPartition(key,null,numberOfShards);
          if (shardId != partition) {
            return false;
          }
          if (emitDeletes) {
            indexWriter.deleteDocuments(new Term(BlurConstants.ROW_ID,BytesRef.deepCopyOf(ref)));
          }
        }
      }
    }
  }
  finally {
    reader.close();
  }
  return true;
}

Fixed version (ground truth):
private void applyDeletes(Directory directory,IndexWriter indexWriter,String shard,boolean emitDeletes) throws IOException {
  DirectoryReader reader=DirectoryReader.open(directory);
  try {
    LOG.info("String_Node_Str",reader);
    CompositeReaderContext compositeReaderContext=reader.getContext();
    List<AtomicReaderContext> leaves=compositeReaderContext.leaves();
    BlurPartitioner blurPartitioner=new BlurPartitioner();
    Text key=new Text();
    int numberOfShards=_shardContext.getTableContext().getDescriptor().getShardCount();
    int shardId=BlurUtil.getShardIndex(shard);
    for (    AtomicReaderContext context : leaves) {
      AtomicReader atomicReader=context.reader();
      Fields fields=atomicReader.fields();
      Terms terms=fields.terms(BlurConstants.ROW_ID);
      if (terms != null) {
        TermsEnum termsEnum=terms.iterator(null);
        BytesRef ref=null;
        while ((ref=termsEnum.next()) != null) {
          key.set(ref.bytes,ref.offset,ref.length);
          int partition=blurPartitioner.getPartition(key,null,numberOfShards);
          if (shardId != partition) {
            throw new IOException("String_Node_Str" + partition + "String_Node_Str"+ shardId+ "String_Node_Str");
          }
          if (emitDeletes) {
            indexWriter.deleteDocuments(new Term(BlurConstants.ROW_ID,BytesRef.deepCopyOf(ref)));
          }
        }
      }
    }
  }
  finally {
    reader.close();
  }
}
Program: 82340
Project: 82340
Buggy source:
public IndexImporter(IndexWriter indexWriter,ReadWriteLock lock,ShardContext shardContext,TimeUnit refreshUnit,long refreshAmount){
  _indexWriter=indexWriter;
  _lock=lock;
  _shardContext=shardContext;
  _timer=new Timer("String_Node_Str" + shardContext.getShard() + "String_Node_Str"+ shardContext.getTableContext().getTable()+ "String_Node_Str",true);
  long period=refreshUnit.toMillis(refreshAmount);
  _timer.schedule(this,period,period);
}

Fixed version (ground truth):
public IndexImporter(BlurIndex blurIndex,ShardContext shardContext,TimeUnit refreshUnit,long refreshAmount){
  _blurIndex=blurIndex;
  _shardContext=shardContext;
  _timer=new Timer("String_Node_Str" + shardContext.getShard() + "String_Node_Str"+ shardContext.getTableContext().getTable()+ "String_Node_Str",true);
  long period=refreshUnit.toMillis(refreshAmount);
  _timer.schedule(this,period,period);
  _table=_shardContext.getTableContext().getTable();
  _shard=_shardContext.getShard();
}
Program: 82342
Project: 82342
Buggy source:
void performMutate(IndexSearcherClosable searcher,IndexWriter writer) throws IOException {
  try {
    for (    InternalAction internalAction : _actions) {
      internalAction.performAction(searcher,writer);
    }
  }
  finally {
    _actions.clear();
  }
}

Fixed version (ground truth):
@Override public void performMutate(IndexSearcherClosable searcher,IndexWriter writer) throws IOException {
  try {
    for (    InternalAction internalAction : _actions) {
      internalAction.performAction(searcher,writer);
    }
  }
  finally {
    _actions.clear();
  }
}
Program: 82343
Project: 82343
Buggy source:
private void commitOrAbortJob(JobContext jobContext,Path shardPath,boolean commit) throws IOException {
  FileSystem fileSystem=shardPath.getFileSystem(jobContext.getConfiguration());
  FileStatus[] listStatus=fileSystem.listStatus(shardPath);
  for (  FileStatus fileStatus : listStatus) {
    Path path=fileStatus.getPath();
    String name=path.getName();
    boolean taskComplete=name.endsWith("String_Node_Str");
    if (fileStatus.isDir()) {
      String taskAttemptName=getTaskAttemptName(name);
      TaskAttemptID taskAttemptID=TaskAttemptID.forName(taskAttemptName);
      if (taskAttemptID.getJobID().equals(jobContext.getJobID())) {
        if (commit) {
          if (taskComplete) {
            fileSystem.rename(path,new Path(shardPath,taskAttemptName + "String_Node_Str"));
            LOG.info("String_Node_Str",taskAttemptID,path);
          }
 else {
            fileSystem.delete(path,true);
            LOG.info("String_Node_Str",taskAttemptID,path);
          }
        }
 else {
          fileSystem.delete(path,true);
          LOG.info("String_Node_Str",taskAttemptID,path);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void commitOrAbortJob(JobContext jobContext,Path shardPath,boolean commit) throws IOException {
  FileSystem fileSystem=shardPath.getFileSystem(jobContext.getConfiguration());
  FileStatus[] listStatus=fileSystem.listStatus(shardPath,new PathFilter(){
    @Override public boolean accept(    Path path){
      if (path.getName().endsWith("String_Node_Str")) {
        return true;
      }
      return false;
    }
  }
);
  for (  FileStatus fileStatus : listStatus) {
    Path path=fileStatus.getPath();
    String name=path.getName();
    boolean taskComplete=name.endsWith("String_Node_Str");
    if (fileStatus.isDir()) {
      String taskAttemptName=getTaskAttemptName(name);
      if (taskAttemptName == null) {
        LOG.info("String_Node_Str",name);
        continue;
      }
      TaskAttemptID taskAttemptID=TaskAttemptID.forName(taskAttemptName);
      if (taskAttemptID.getJobID().equals(jobContext.getJobID())) {
        if (commit) {
          if (taskComplete) {
            fileSystem.rename(path,new Path(shardPath,taskAttemptName + "String_Node_Str"));
            LOG.info("String_Node_Str",taskAttemptID,path);
          }
 else {
            fileSystem.delete(path,true);
            LOG.info("String_Node_Str",taskAttemptID,path);
          }
        }
 else {
          fileSystem.delete(path,true);
          LOG.info("String_Node_Str",taskAttemptID,path);
        }
      }
    }
  }
}
Program: 82344
Project: 82344
Buggy source:
private String getTaskAttemptName(String name){
  int lastIndexOf=name.lastIndexOf('.');
  return name.substring(0,lastIndexOf);
}

Fixed version (ground truth):
private String getTaskAttemptName(String name){
  int lastIndexOf=name.lastIndexOf('.');
  if (lastIndexOf < 0) {
    return null;
  }
  return name.substring(0,lastIndexOf);
}
Program: 82345
Project: 82345
Buggy source:
private void tryToCloseReaders(){
  LOG.debug("String_Node_Str",readers.size());
  Iterator<IndexReader> it=readers.iterator();
  while (it.hasNext()) {
    IndexReader reader=it.next();
    if (reader.getRefCount() == 1) {
      it.remove();
      closeInternal(reader);
    }
 else {
      LOG.debug("String_Node_Str" + reader + "String_Node_Str"+ reader.getRefCount()+ "String_Node_Str");
    }
    closeInternal(reader);
  }
}

Fixed version (ground truth):
private void tryToCloseReaders(){
  LOG.debug("String_Node_Str",readers.size());
  Iterator<IndexReader> it=readers.iterator();
  while (it.hasNext()) {
    IndexReader reader=it.next();
    if (reader.getRefCount() == 1) {
      it.remove();
      closeInternal(reader);
    }
 else {
      LOG.debug("String_Node_Str" + reader + "String_Node_Str"+ reader.getRefCount()+ "String_Node_Str");
    }
  }
}
Program: 82346
Project: 82346
Buggy source:
private void closeInternal(final IndexReader reader){
  executorService.submit(new Runnable(){
    @Override public void run(){
      try {
        long s=System.currentTimeMillis();
        reader.close();
        long e=System.currentTimeMillis();
        LOG.debug("String_Node_Str",readers.size(),(e - s),reader);
      }
 catch (      Exception e) {
        readers.add(reader);
        LOG.error("String_Node_Str" + reader + "String_Node_Str",e);
      }
    }
  }
);
}

Fixed version (ground truth):
private void closeInternal(final IndexReader reader){
  if (reader.getRefCount() == 0) {
    return;
  }
  executorService.submit(new Runnable(){
    @Override public void run(){
      try {
        long s=System.currentTimeMillis();
        reader.close();
        long e=System.currentTimeMillis();
        LOG.debug("String_Node_Str",readers.size(),(e - s),reader);
      }
 catch (      Exception e) {
        readers.add(reader);
        LOG.error("String_Node_Str" + reader + "String_Node_Str",e);
      }
    }
  }
);
}
Program: 82347
Project: 82347
Buggy source:
public FastHdfsKeyValueDirectory(Configuration configuration,Path path) throws IOException {
  _store=new HdfsKeyValueStore(configuration,path);
  BytesRef value=new BytesRef();
  if (_store.get(FILES,value)) {
    String filesString=value.utf8ToString();
    String[] files=filesString.split("String_Node_Str" + SEP);
    for (    String file : files) {
      if (file.isEmpty()) {
        continue;
      }
      BytesRef key=new BytesRef(file + LENGTH);
      if (_store.get(key,value)) {
        _files.put(file,Long.parseLong(value.utf8ToString()));
      }
 else {
        throw new IOException("String_Node_Str" + key.utf8ToString() + "String_Node_Str");
      }
    }
  }
  setLockFactory(NoLockFactory.getNoLockFactory());
}

Fixed version (ground truth):
public FastHdfsKeyValueDirectory(Configuration configuration,Path path) throws IOException {
  _store=new HdfsKeyValueStore(configuration,path);
  BytesRef value=new BytesRef();
  if (_store.get(FILES,value)) {
    String filesString=value.utf8ToString();
    String[] files=filesString.split("String_Node_Str" + SEP);
    for (    String file : files) {
      if (file.isEmpty()) {
        continue;
      }
      BytesRef key=new BytesRef(file + LENGTH);
      if (_store.get(key,value)) {
        _files.put(file,Long.parseLong(value.utf8ToString()));
      }
 else {
        _files.put(file,0L);
        LOG.warn("String_Node_Str",file);
      }
    }
  }
  setLockFactory(NoLockFactory.getNoLockFactory());
}
Program: 82348
Project: 82348
Buggy source:
@Override public TableDescriptor getTableDescriptor(boolean useCache,String cluster,String table){
  if (useCache) {
    TableDescriptor tableDescriptor=_tableDescriptorCache.get(table);
    updateEnabled(useCache,tableDescriptor,cluster,table);
    if (tableDescriptor != null) {
      return tableDescriptor;
    }
  }
  long s=System.nanoTime();
  TableDescriptor tableDescriptor=new TableDescriptor();
  try {
    checkIfOpen();
    String blurTablePath=ZookeeperPathConstants.getTablePath(cluster,table);
    byte[] bytes=getData(blurTablePath);
    if (bytes == null || bytes.length == 0) {
      LOG.info("String_Node_Str",table);
      getOldTableDescriptor(useCache,cluster,table,tableDescriptor);
      BlurUtil.removeAll(_zk,blurTablePath);
      byte[] newFormatBytes=serializeTableDescriptor(tableDescriptor);
      BlurUtil.createPath(_zk,blurTablePath,newFormatBytes);
    }
 else {
      TDeserializer deserializer=new TDeserializer(new TJSONProtocol.Factory());
      deserializer.deserialize(tableDescriptor,bytes);
    }
  }
 catch (  TException e) {
    throw new RuntimeException(e);
  }
catch (  KeeperException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
 finally {
    long e=System.nanoTime();
    LOG.debug("String_Node_Str" + (e - s) / 1000000.0 + "String_Node_Str");
  }
  tableDescriptor.cluster=cluster;
  _tableDescriptorCache.put(table,tableDescriptor);
  return tableDescriptor;
}

Fixed version (ground truth):
@Override public TableDescriptor getTableDescriptor(boolean useCache,String cluster,String table){
  if (useCache) {
    TableDescriptor tableDescriptor=_tableDescriptorCache.get(table);
    if (tableDescriptor != null) {
      return tableDescriptor;
    }
  }
  long s=System.nanoTime();
  TableDescriptor tableDescriptor=new TableDescriptor();
  try {
    checkIfOpen();
    String blurTablePath=ZookeeperPathConstants.getTablePath(cluster,table);
    byte[] bytes=getData(blurTablePath);
    if (bytes == null) {
      throw new RuntimeException("String_Node_Str" + table + "String_Node_Str"+ cluster+ "String_Node_Str");
    }
    TDeserializer deserializer=new TDeserializer(new TJSONProtocol.Factory());
    deserializer.deserialize(tableDescriptor,bytes);
  }
 catch (  TException e) {
    throw new RuntimeException(e);
  }
catch (  KeeperException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
 finally {
    long e=System.nanoTime();
    LOG.debug("String_Node_Str" + (e - s) / 1000000.0 + "String_Node_Str");
  }
  tableDescriptor.cluster=cluster;
  _tableDescriptorCache.put(table,tableDescriptor);
  return tableDescriptor;
}
Program: 82349
Project: 82349
Buggy source:
@Override public void disableTable(String cluster,String table){
  long s=System.nanoTime();
  try {
    checkIfOpen();
    if (_zk.exists(ZookeeperPathConstants.getTablePath(cluster,table),false) == null) {
      throw new IOException("String_Node_Str" + table + "String_Node_Str");
    }
    String blurTableEnabledPath=ZookeeperPathConstants.getTableEnabledPath(cluster,table);
    if (_zk.exists(blurTableEnabledPath,false) == null) {
      throw new IOException("String_Node_Str" + table + "String_Node_Str");
    }
    _zk.delete(blurTableEnabledPath,-1);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
catch (  KeeperException e) {
    throw new RuntimeException(e);
  }
 finally {
    long e=System.nanoTime();
    LOG.debug("String_Node_Str" + (e - s) / 1000000.0 + "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void disableTable(String cluster,String table){
  try {
    checkIfOpen();
    String tablePath=ZookeeperPathConstants.getTablePath(cluster,table);
    Stat stat=_zk.exists(tablePath,false);
    if (stat == null) {
      throw new IOException("String_Node_Str" + table + "String_Node_Str");
    }
    TableDescriptor tableDescriptor=getTableDescriptor(false,cluster,table);
    if (!tableDescriptor.isEnabled()) {
      return;
    }
    tableDescriptor.setEnabled(false);
    byte[] bytes=serializeTableDescriptor(tableDescriptor);
    _zk.setData(tablePath,bytes,stat.getVersion());
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
catch (  KeeperException e) {
    throw new RuntimeException(e);
  }
}
Program: 82350
Project: 82350
Buggy source:
@Override public boolean isEnabled(boolean useCache,String cluster,String table){
  if (useCache) {
    Boolean e=_enabled.get(getClusterTableKey(cluster,table));
    if (e != null) {
      return e;
    }
  }
  long s=System.nanoTime();
  String tablePathIsEnabled=ZookeeperPathConstants.getTableEnabledPath(cluster,table);
  try {
    checkIfOpen();
    if (_zk.exists(tablePathIsEnabled,false) == null) {
      return false;
    }
  }
 catch (  KeeperException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
 finally {
    long e=System.nanoTime();
    LOG.debug("String_Node_Str" + (e - s) / 1000000.0 + "String_Node_Str");
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean isEnabled(boolean useCache,String cluster,String table){
  TableDescriptor tableDescriptor=getTableDescriptor(useCache,cluster,table);
  return tableDescriptor.isEnabled();
}
Program: 82351
Project: 82351
Buggy source:
@Override public boolean exists(boolean useCache,String cluster,String table){
  if (useCache) {
    Set<String> tables=_tablesPerCluster.get(cluster);
    if (tables != null) {
      if (tables.contains(table)) {
        return true;
      }
    }
  }
  long s=System.nanoTime();
  try {
    checkIfOpen();
    if (_zk.exists(ZookeeperPathConstants.getTablePath(cluster,table),false) == null) {
      return false;
    }
    return true;
  }
 catch (  KeeperException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
 finally {
    long e=System.nanoTime();
    LOG.debug("String_Node_Str" + (e - s) / 1000000.0 + "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public boolean exists(boolean useCache,String cluster,String table){
  if (useCache) {
    Set<String> tables=_tablesPerCluster.get(cluster);
    if (tables != null) {
      if (tables.contains(table)) {
        return true;
      }
    }
  }
  try {
    checkIfOpen();
    if (_zk.exists(ZookeeperPathConstants.getTablePath(cluster,table),false) == null) {
      return false;
    }
    return true;
  }
 catch (  KeeperException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}
Program: 82352
Project: 82352
Buggy source:
@Override public void enableTable(String cluster,String table){
  long s=System.nanoTime();
  try {
    checkIfOpen();
    if (_zk.exists(ZookeeperPathConstants.getTablePath(cluster,table),false) == null) {
      throw new IOException("String_Node_Str" + table + "String_Node_Str");
    }
    String blurTableEnabledPath=ZookeeperPathConstants.getTableEnabledPath(cluster,table);
    if (_zk.exists(blurTableEnabledPath,false) != null) {
      throw new IOException("String_Node_Str" + table + "String_Node_Str");
    }
    _zk.create(blurTableEnabledPath,null,Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
catch (  KeeperException e) {
    throw new RuntimeException(e);
  }
 finally {
    long e=System.nanoTime();
    LOG.debug("String_Node_Str" + (e - s) / 1000000.0 + "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void enableTable(String cluster,String table){
  long s=System.nanoTime();
  try {
    checkIfOpen();
    String tablePath=ZookeeperPathConstants.getTablePath(cluster,table);
    Stat stat=_zk.exists(tablePath,false);
    if (stat == null) {
      throw new IOException("String_Node_Str" + table + "String_Node_Str");
    }
    TableDescriptor tableDescriptor=getTableDescriptor(false,cluster,table);
    if (tableDescriptor.isEnabled()) {
      return;
    }
    tableDescriptor.setEnabled(true);
    byte[] bytes=serializeTableDescriptor(tableDescriptor);
    _zk.setData(tablePath,bytes,stat.getVersion());
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
catch (  KeeperException e) {
    throw new RuntimeException(e);
  }
 finally {
    long e=System.nanoTime();
    LOG.debug("String_Node_Str" + (e - s) / 1000000.0 + "String_Node_Str");
  }
}
Program: 82353
Project: 82353
Buggy source:
@Override public void seek(long pos) throws IOException {
  ensureOpen();
  if (pos >= _fileLength) {
    throw new IOException("String_Node_Str" + pos + "String_Node_Str"+ _fileLength+ "String_Node_Str");
  }
  if (_position == pos) {
    return;
  }
  long oldBlockId=getBlockId();
  if (_blockPosition == _cacheBlockSize) {
    oldBlockId--;
  }
  _position=pos;
  long newBlockId=getBlockId(_position);
  if (newBlockId == oldBlockId) {
    _blockPosition=getBlockPosition();
  }
 else {
    releaseCache();
  }
}

Fixed version (ground truth):
@Override public void seek(long pos) throws IOException {
  ensureOpen();
  if (pos >= _fileLength) {
    _position=pos;
    return;
  }
  if (_position == pos) {
    return;
  }
  long oldBlockId=getBlockId();
  if (_blockPosition == _cacheBlockSize) {
    oldBlockId--;
  }
  _position=pos;
  long newBlockId=getBlockId(_position);
  if (newBlockId == oldBlockId) {
    _blockPosition=getBlockPosition();
  }
 else {
    releaseCache();
  }
}
Program: 82354
Project: 82354
Buggy source:
private void tryToFill() throws IOException {
  if (!isCacheValueValid() || remaining() == 0) {
    releaseCache();
    fill();
  }
 else {
    return;
  }
}

Fixed version (ground truth):
private void tryToFill() throws IOException {
  checkEOF();
  if (!isCacheValueValid() || remaining() == 0) {
    releaseCache();
    fill();
  }
 else {
    return;
  }
}
Program: 82355
Project: 82355
Buggy source:
@Test public void testCreateIndex() throws IOException {
  long s=System.nanoTime();
  IndexWriterConfig conf=new IndexWriterConfig(LuceneVersionConstant.LUCENE_VERSION,new KeywordAnalyzer());
  FSDirectory control=FSDirectory.open(fileControl);
  Directory dir=getControlDir(control,directory);
  IndexWriter writer=new IndexWriter(dir,conf);
  int numDocs=10000;
  DirectoryReader reader=null;
  for (int i=0; i < 100; i++) {
    if (reader == null) {
      reader=DirectoryReader.open(writer,true);
    }
 else {
      DirectoryReader old=reader;
      reader=DirectoryReader.openIfChanged(old,writer,true);
      if (reader == null) {
        reader=old;
      }
 else {
        old.close();
      }
    }
    assertEquals(i * numDocs,reader.numDocs());
    IndexSearcher searcher=new IndexSearcher(reader);
    NumericRangeQuery<Integer> query=NumericRangeQuery.newIntRange("String_Node_Str",42,42,true,true);
    TopDocs topDocs=searcher.search(query,10);
    assertEquals(i,topDocs.totalHits);
    addDocuments(writer,numDocs);
  }
  writer.close(false);
  reader.close();
  long e=System.nanoTime();
  System.out.println("String_Node_Str" + (e - s) / 1000000.0 + "String_Node_Str");
}

Fixed version (ground truth):
@Test public void testCreateIndex() throws IOException {
  long s=System.nanoTime();
  IndexWriterConfig conf=new IndexWriterConfig(LuceneVersionConstant.LUCENE_VERSION,new KeywordAnalyzer());
  IndexDeletionPolicyReader indexDeletionPolicy=new IndexDeletionPolicyReader(new KeepOnlyLastCommitDeletionPolicy());
  conf.setIndexDeletionPolicy(indexDeletionPolicy);
  FSDirectory control=FSDirectory.open(fileControl);
  Directory dir=getControlDir(control,directory);
  IndexWriter writer=new IndexWriter(dir,conf);
  int numDocs=10000;
  DirectoryReader reader=null;
  long gen=0;
  for (int i=0; i < 100; i++) {
    if (reader == null) {
      reader=DirectoryReader.open(writer,true);
      gen=reader.getIndexCommit().getGeneration();
      indexDeletionPolicy.register(gen);
    }
 else {
      DirectoryReader old=reader;
      reader=DirectoryReader.openIfChanged(old,writer,true);
      if (reader == null) {
        reader=old;
      }
 else {
        long newGen=reader.getIndexCommit().getGeneration();
        indexDeletionPolicy.register(newGen);
        indexDeletionPolicy.unregister(gen);
        old.close();
        gen=newGen;
      }
    }
    assertEquals(i * numDocs,reader.numDocs());
    IndexSearcher searcher=new IndexSearcher(reader);
    NumericRangeQuery<Integer> query=NumericRangeQuery.newIntRange("String_Node_Str",42,42,true,true);
    TopDocs topDocs=searcher.search(query,10);
    assertEquals(i,topDocs.totalHits);
    addDocuments(writer,numDocs);
  }
  writer.close(false);
  reader.close();
  long e=System.nanoTime();
  System.out.println("String_Node_Str" + (e - s) / 1000000.0 + "String_Node_Str");
}
Program: 82356
Project: 82356
Buggy source:
public CachedDecompressor(Decompressor decompressor,SegmentInfo si,ConcurrentLinkedHashMap<CachedKey,BytesRef> cache){
  _si=si;
  _decompressor=decompressor;
  _cache=cache;
}

Fixed version (ground truth):
public CachedDecompressor(Decompressor decompressor,SegmentInfo si,ConcurrentLinkedHashMap<CachedKey,BytesRef> cache){
  _decompressor=decompressor;
}
Program: 82357
Project: 82357
Buggy source:
@Override public void decompress(final DataInput in,final int originalLength,final int offset,final int length,final BytesRef bytes) throws IOException {
  if (in instanceof IndexInput) {
    IndexInput indexInput=(IndexInput)in;
    String name=indexInput.toString();
    long filePointer=indexInput.getFilePointer();
    CachedKey key=new CachedKey(name,filePointer,_si);
    BytesRef cachedRef=_cache.get(key);
    if (cachedRef == null) {
      cachedRef=new BytesRef(originalLength + 7);
      _decompressor.decompress(indexInput,originalLength,0,originalLength,cachedRef);
      _cache.put(key,cachedRef);
      cachedRef.length=originalLength;
      cachedRef.offset=0;
    }
    if (bytes.bytes.length < originalLength + 7) {
      bytes.bytes=new byte[ArrayUtil.oversize(originalLength + 7,1)];
    }
    System.arraycopy(cachedRef.bytes,cachedRef.offset,bytes.bytes,0,length + offset);
    bytes.offset=offset;
    bytes.length=length;
  }
 else {
    _decompressor.decompress(in,originalLength,offset,length,bytes);
  }
}

Fixed version (ground truth):
@Override public void decompress(final DataInput in,final int originalLength,final int offset,final int length,final BytesRef bytes) throws IOException {
  if (in instanceof IndexInput) {
    IndexInput indexInput=(IndexInput)in;
    String name=indexInput.toString();
    long filePointer=indexInput.getFilePointer();
    Entry entry=_entry.get();
    if (entry == null || !entry.isValid(indexInput,name,filePointer)) {
      entry=new Entry(indexInput,name,filePointer);
      entry._cache=new BytesRef(originalLength + 7);
      _decompressor.decompress(indexInput,originalLength,0,originalLength,entry._cache);
      entry._cache.length=originalLength;
      entry._cache.offset=0;
      _entry.set(entry);
    }
    if (bytes.bytes.length < originalLength + 7) {
      bytes.bytes=new byte[ArrayUtil.oversize(originalLength + 7,1)];
    }
    System.arraycopy(entry._cache.bytes,entry._cache.offset,bytes.bytes,0,length + offset);
    bytes.offset=offset;
    bytes.length=length;
  }
 else {
    _decompressor.decompress(in,originalLength,offset,length,bytes);
  }
}
Program: 82358
Project: 82358
Buggy source:
@Override public void run(){
  BlockingQueue<Client> bq=_connMap.get(_connection);
synchronized (_connection) {
    if (!_connMap.get(_connection).isEmpty()) {
      Iterator<Client> it=bq.iterator();
      try {
        while (it.hasNext()) {
          Client client=it.next();
          if (((WeightedClient)client).isStale()) {
            close(client);
            bq.take();
          }
 else           break;
        }
      }
 catch (      InterruptedException e) {
        throw new RuntimeException(e);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (_running.get()) {
    for (    Entry<Connection,BlockingQueue<Client>> e : _connMap.entrySet()) {
      testConnections(e.getKey(),e.getValue());
    }
    try {
      Thread.sleep(getClientPoolCleanFrequency());
    }
 catch (    InterruptedException e) {
      return;
    }
  }
}
Program: 82359
Project: 82359
Buggy source:
public Client getClient(Connection connection) throws TTransportException, IOException {
  BlockingQueue<Client> blockingQueue=getQueue(connection);
  if (blockingQueue.isEmpty()) {
    return newClient(connection);
  }
  try {
    return blockingQueue.take();
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public Client getClient(Connection connection) throws TTransportException, IOException {
  BlockingQueue<Client> blockingQueue=getQueue(connection);
  if (blockingQueue.isEmpty()) {
    return newClient(connection);
  }
  while (true) {
    WeightedClient client=(WeightedClient)blockingQueue.poll();
    if (client == null) {
      return newClient(connection);
    }
    if (client.isStale()) {
      if (testClient(connection,client)) {
        return client;
      }
    }
 else {
      return client;
    }
  }
}
Program: 82360
Project: 82360
Buggy source:
public void trashConnections(Connection connection,Client client){
  BlockingQueue<Client> blockingQueue;
synchronized (connection) {
    blockingQueue=_connMap.put(connection,getNewQueue());
    try {
      blockingQueue.put(client);
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
  LOG.info("String_Node_Str",connection);
  for (  Client c : blockingQueue) {
    close(c);
  }
}

Fixed version (ground truth):
public void trashConnections(Connection connection,Client client){
  BlockingQueue<Client> blockingQueue;
synchronized (_connMap) {
    blockingQueue=_connMap.put(connection,getNewQueue());
    try {
      blockingQueue.put(client);
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
  LOG.info("String_Node_Str",connection);
  for (  Client c : blockingQueue) {
    close(c);
  }
}
Program: 82361
Project: 82361
Buggy source:
public void returnClient(Connection connection,Client client){
  try {
    ((WeightedClient)client).setEnqueTime(System.currentTimeMillis());
    getQueue(connection).put(client);
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void returnClient(Connection connection,Client client){
  ((WeightedClient)client).touch();
  if (!getQueue(connection).offer(client)) {
    close(client);
  }
}
Program: 82362
Project: 82362
Buggy source:
private BlockingQueue<Client> getQueue(Connection connection){
  BlockingQueue<Client> blockingQueue;
synchronized (connection) {
    blockingQueue=_connMap.get(connection);
    if (blockingQueue == null) {
      blockingQueue=getNewQueue();
      _connMap.put(connection,blockingQueue);
    }
  }
  return _connMap.get(connection);
}

Fixed version (ground truth):
private BlockingQueue<Client> getQueue(Connection connection){
  BlockingQueue<Client> blockingQueue=_connMap.get(connection);
  if (blockingQueue != null) {
    return blockingQueue;
  }
synchronized (_connMap) {
    blockingQueue=_connMap.get(connection);
    if (blockingQueue == null) {
      blockingQueue=getNewQueue();
      _connMap.put(connection,blockingQueue);
    }
  }
  return _connMap.get(connection);
}
Program: 82363
Project: 82363
Buggy source:
private static void checkAndRemoveStaleClients(){
  _master=new Thread(new Runnable(){
    @Override public void run(){
      while (_running.get()) {
        try {
          Thread.sleep(getClientPoolCleanFrequency());
          List<Thread> workers=new ArrayList<Thread>();
          int num=0;
          for (          Connection connection : _connMap.keySet()) {
            Thread thread=new PoolWorker(connection);
            thread.setName("String_Node_Str" + ++num);
            thread.start();
            workers.add(thread);
          }
          for (          Thread t : workers) {
            t.join();
          }
        }
 catch (        InterruptedException e) {
          throw new RuntimeException(e);
        }
      }
    }
  }
);
  _master.setDaemon(true);
  _master.setName("String_Node_Str");
  _master.start();
}

Fixed version (ground truth):
private static void checkAndRemoveStaleClients(){
  _master=new Thread(new Runnable(){
    @Override public void run(){
      while (_running.get()) {
        for (        Entry<Connection,BlockingQueue<Client>> e : _connMap.entrySet()) {
          testConnections(e.getKey(),e.getValue());
        }
        try {
          Thread.sleep(getClientPoolCleanFrequency());
        }
 catch (        InterruptedException e) {
          return;
        }
      }
    }
    private void testConnections(    Connection connection,    BlockingQueue<Client> clients){
      LOG.debug("String_Node_Str",connection);
      int size=clients.size();
      for (int i=0; i < size; i++) {
        WeightedClient weightedClient=(WeightedClient)clients.poll();
        if (weightedClient == null) {
          return;
        }
        if (weightedClient.isStale()) {
          if (testClient(connection,weightedClient)) {
            tryToReturnToQueue(clients,weightedClient);
          }
 else {
            close(weightedClient);
          }
        }
 else {
          tryToReturnToQueue(clients,weightedClient);
        }
      }
    }
    private void tryToReturnToQueue(    BlockingQueue<Client> clients,    WeightedClient weightedClient){
      if (!clients.offer(weightedClient)) {
        close(weightedClient);
      }
    }
  }
);
  _master.setDaemon(true);
  _master.setName("String_Node_Str");
  _master.start();
}
Program: 82364
Project: 82364
Buggy source:
public boolean isStale(){
  long diff=System.currentTimeMillis() - _enqueueTime;
  return diff >= getClientIdleTimeThreshold();
}

Fixed version (ground truth):
public boolean isStale(){
  long diff=System.nanoTime() - _lastUse;
  return diff >= getClientIdleTimeThreshold();
}
Program: 82365
Project: 82365
Buggy source:
public static void close(Client client){
  client.getInputProtocol().getTransport().close();
  client.getOutputProtocol().getTransport().close();
}

Fixed version (ground truth):
public static void close(Client client){
  try {
    client.getInputProtocol().getTransport().close();
    client.getOutputProtocol().getTransport().close();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",client);
  }
}
Program: 82366
Project: 82366
Buggy source:
void process(AtomicLongArray counts,long[] minimumsBeforeReturning) throws IOException {
  SimpleCollector col=new SimpleCollector(_bitSet);
  if (minimumsBeforeReturning == null) {
    for (int i=0; i < _scorers.length; i++) {
      Scorer scorer=_scorers[i];
      if (scorer != null) {
        scorer.score(col);
        counts.addAndGet(i,col._hits);
      }
      col._hits=0;
    }
  }
 else {
    for (int i=0; i < _scorers.length; i++) {
      long min=minimumsBeforeReturning[i];
      long currentCount=counts.get(i);
      if (currentCount < min) {
        Scorer scorer=_scorers[i];
        if (scorer != null) {
          scorer.score(col);
          counts.addAndGet(i,col._hits);
        }
        counts.addAndGet(i,col._hits);
        col._hits=0;
      }
    }
  }
}

Fixed version (ground truth):
void process(AtomicLongArray counts,long[] minimumsBeforeReturning) throws IOException {
  SimpleCollector col=new SimpleCollector(_bitSet);
  if (minimumsBeforeReturning == null) {
    for (int i=0; i < _scorers.length; i++) {
      Scorer scorer=_scorers[i];
      if (scorer != null) {
        scorer.score(col);
        counts.addAndGet(i,col._hits);
      }
      col._hits=0;
    }
  }
 else {
    for (int i=0; i < _scorers.length; i++) {
      long min=minimumsBeforeReturning[i];
      long currentCount=counts.get(i);
      if (currentCount < min) {
        Scorer scorer=_scorers[i];
        if (scorer != null) {
          scorer.score(col);
          counts.addAndGet(i,col._hits);
        }
        col._hits=0;
      }
    }
  }
}
Program: 82367
Project: 82367
Buggy source:
public CachedDecompressor(Decompressor decompressor,SegmentInfo si,ConcurrentLinkedHashMap<CachedKey,BytesRef> cache){
  _si=si;
  _decompressor=decompressor;
  _cache=cache;
}

Fixed version (ground truth):
public CachedDecompressor(Decompressor decompressor,SegmentInfo si,ConcurrentLinkedHashMap<CachedKey,BytesRef> cache){
  _decompressor=decompressor;
}
Program: 82368
Project: 82368
Buggy source:
@Override public void decompress(final DataInput in,final int originalLength,final int offset,final int length,final BytesRef bytes) throws IOException {
  if (in instanceof IndexInput) {
    IndexInput indexInput=(IndexInput)in;
    String name=indexInput.toString();
    long filePointer=indexInput.getFilePointer();
    CachedKey key=new CachedKey(name,filePointer,_si);
    BytesRef cachedRef=_cache.get(key);
    if (cachedRef == null) {
      cachedRef=new BytesRef(originalLength + 7);
      _decompressor.decompress(indexInput,originalLength,0,originalLength,cachedRef);
      _cache.put(key,cachedRef);
      cachedRef.length=originalLength;
      cachedRef.offset=0;
    }
    if (bytes.bytes.length < originalLength + 7) {
      bytes.bytes=new byte[ArrayUtil.oversize(originalLength + 7,1)];
    }
    System.arraycopy(cachedRef.bytes,cachedRef.offset,bytes.bytes,0,length + offset);
    bytes.offset=offset;
    bytes.length=length;
  }
 else {
    _decompressor.decompress(in,originalLength,offset,length,bytes);
  }
}

Fixed version (ground truth):
@Override public void decompress(final DataInput in,final int originalLength,final int offset,final int length,final BytesRef bytes) throws IOException {
  if (in instanceof IndexInput) {
    IndexInput indexInput=(IndexInput)in;
    String name=indexInput.toString();
    long filePointer=indexInput.getFilePointer();
    Entry entry=_entry.get();
    if (entry == null || !entry.isValid(indexInput,name,filePointer)) {
      entry=new Entry(indexInput,name,filePointer);
      entry._cache=new BytesRef(originalLength + 7);
      _decompressor.decompress(indexInput,originalLength,0,originalLength,entry._cache);
      entry._cache.length=originalLength;
      entry._cache.offset=0;
      _entry.set(entry);
    }
    if (bytes.bytes.length < originalLength + 7) {
      bytes.bytes=new byte[ArrayUtil.oversize(originalLength + 7,1)];
    }
    System.arraycopy(entry._cache.bytes,entry._cache.offset,bytes.bytes,0,length + offset);
    bytes.offset=offset;
    bytes.length=length;
  }
 else {
    _decompressor.decompress(in,originalLength,offset,length,bytes);
  }
}
Program: 82369
Project: 82369
Buggy source:
void process(AtomicLongArray counts,long[] minimumsBeforeReturning) throws IOException {
  SimpleCollector col=new SimpleCollector(_bitSet);
  if (minimumsBeforeReturning == null) {
    for (int i=0; i < _scorers.length; i++) {
      Scorer scorer=_scorers[i];
      if (scorer != null) {
        scorer.score(col);
        counts.addAndGet(i,col._hits);
      }
      col._hits=0;
    }
  }
 else {
    for (int i=0; i < _scorers.length; i++) {
      long min=minimumsBeforeReturning[i];
      long currentCount=counts.get(i);
      if (currentCount < min) {
        Scorer scorer=_scorers[i];
        if (scorer != null) {
          scorer.score(col);
          counts.addAndGet(i,col._hits);
        }
        counts.addAndGet(i,col._hits);
        col._hits=0;
      }
    }
  }
}

Fixed version (ground truth):
void process(AtomicLongArray counts,long[] minimumsBeforeReturning) throws IOException {
  SimpleCollector col=new SimpleCollector(_bitSet);
  if (minimumsBeforeReturning == null) {
    for (int i=0; i < _scorers.length; i++) {
      Scorer scorer=_scorers[i];
      if (scorer != null) {
        scorer.score(col);
        counts.addAndGet(i,col._hits);
      }
      col._hits=0;
    }
  }
 else {
    for (int i=0; i < _scorers.length; i++) {
      long min=minimumsBeforeReturning[i];
      long currentCount=counts.get(i);
      if (currentCount < min) {
        Scorer scorer=_scorers[i];
        if (scorer != null) {
          scorer.score(col);
          counts.addAndGet(i,col._hits);
        }
        col._hits=0;
      }
    }
  }
}
Program: 82370
Project: 82370
Buggy source:
@Override public void run(){
  BlockingQueue<Client> bq=_connMap.get(_connection);
synchronized (_connection) {
    if (!_connMap.get(_connection).isEmpty()) {
      Iterator<Client> it=bq.iterator();
      try {
        while (it.hasNext()) {
          Client client=it.next();
          if (((WeightedClient)client).isStale()) {
            close(client);
            bq.take();
          }
 else           break;
        }
      }
 catch (      InterruptedException e) {
        throw new RuntimeException(e);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (_running.get()) {
    for (    Entry<Connection,BlockingQueue<Client>> e : _connMap.entrySet()) {
      testConnections(e.getKey(),e.getValue());
    }
    try {
      Thread.sleep(getClientPoolCleanFrequency());
    }
 catch (    InterruptedException e) {
      return;
    }
  }
}
Program: 82371
Project: 82371
Buggy source:
public Client getClient(Connection connection) throws TTransportException, IOException {
  BlockingQueue<Client> blockingQueue=getQueue(connection);
  if (blockingQueue.isEmpty()) {
    return newClient(connection);
  }
  try {
    return blockingQueue.take();
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public Client getClient(Connection connection) throws TTransportException, IOException {
  BlockingQueue<Client> blockingQueue=getQueue(connection);
  if (blockingQueue.isEmpty()) {
    return newClient(connection);
  }
  while (true) {
    WeightedClient client=(WeightedClient)blockingQueue.poll();
    if (client == null) {
      return newClient(connection);
    }
    if (client.isStale()) {
      if (testClient(connection,client)) {
        return client;
      }
    }
 else {
      return client;
    }
  }
}
Program: 82372
Project: 82372
Buggy source:
public void trashConnections(Connection connection,Client client){
  BlockingQueue<Client> blockingQueue;
synchronized (connection) {
    blockingQueue=_connMap.put(connection,getNewQueue());
    try {
      blockingQueue.put(client);
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
  LOG.info("String_Node_Str",connection);
  for (  Client c : blockingQueue) {
    close(c);
  }
}

Fixed version (ground truth):
public void trashConnections(Connection connection,Client client){
  BlockingQueue<Client> blockingQueue;
synchronized (_connMap) {
    blockingQueue=_connMap.put(connection,getNewQueue());
    try {
      blockingQueue.put(client);
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
  LOG.info("String_Node_Str",connection);
  for (  Client c : blockingQueue) {
    close(c);
  }
}
Program: 82373
Project: 82373
Buggy source:
public void returnClient(Connection connection,Client client){
  try {
    ((WeightedClient)client).setEnqueTime(System.currentTimeMillis());
    getQueue(connection).put(client);
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void returnClient(Connection connection,Client client){
  ((WeightedClient)client).touch();
  if (!getQueue(connection).offer(client)) {
    close(client);
  }
}
Program: 82374
Project: 82374
Buggy source:
private BlockingQueue<Client> getQueue(Connection connection){
  BlockingQueue<Client> blockingQueue;
synchronized (connection) {
    blockingQueue=_connMap.get(connection);
    if (blockingQueue == null) {
      blockingQueue=getNewQueue();
      _connMap.put(connection,blockingQueue);
    }
  }
  return _connMap.get(connection);
}

Fixed version (ground truth):
private BlockingQueue<Client> getQueue(Connection connection){
  BlockingQueue<Client> blockingQueue=_connMap.get(connection);
  if (blockingQueue != null) {
    return blockingQueue;
  }
synchronized (_connMap) {
    blockingQueue=_connMap.get(connection);
    if (blockingQueue == null) {
      blockingQueue=getNewQueue();
      _connMap.put(connection,blockingQueue);
    }
  }
  return _connMap.get(connection);
}
Program: 82375
Project: 82375
Buggy source:
private static void checkAndRemoveStaleClients(){
  _master=new Thread(new Runnable(){
    @Override public void run(){
      while (_running.get()) {
        try {
          Thread.sleep(getClientPoolCleanFrequency());
          List<Thread> workers=new ArrayList<Thread>();
          int num=0;
          for (          Connection connection : _connMap.keySet()) {
            Thread thread=new PoolWorker(connection);
            thread.setName("String_Node_Str" + ++num);
            thread.start();
            workers.add(thread);
          }
          for (          Thread t : workers) {
            t.join();
          }
        }
 catch (        InterruptedException e) {
          throw new RuntimeException(e);
        }
      }
    }
  }
);
  _master.setDaemon(true);
  _master.setName("String_Node_Str");
  _master.start();
}

Fixed version (ground truth):
private static void checkAndRemoveStaleClients(){
  _master=new Thread(new Runnable(){
    @Override public void run(){
      while (_running.get()) {
        for (        Entry<Connection,BlockingQueue<Client>> e : _connMap.entrySet()) {
          testConnections(e.getKey(),e.getValue());
        }
        try {
          Thread.sleep(getClientPoolCleanFrequency());
        }
 catch (        InterruptedException e) {
          return;
        }
      }
    }
    private void testConnections(    Connection connection,    BlockingQueue<Client> clients){
      LOG.debug("String_Node_Str",connection);
      int size=clients.size();
      for (int i=0; i < size; i++) {
        WeightedClient weightedClient=(WeightedClient)clients.poll();
        if (weightedClient == null) {
          return;
        }
        if (weightedClient.isStale()) {
          if (testClient(connection,weightedClient)) {
            tryToReturnToQueue(clients,weightedClient);
          }
 else {
            close(weightedClient);
          }
        }
 else {
          tryToReturnToQueue(clients,weightedClient);
        }
      }
    }
    private void tryToReturnToQueue(    BlockingQueue<Client> clients,    WeightedClient weightedClient){
      if (!clients.offer(weightedClient)) {
        close(weightedClient);
      }
    }
  }
);
  _master.setDaemon(true);
  _master.setName("String_Node_Str");
  _master.start();
}
Program: 82376
Project: 82376
Buggy source:
public boolean isStale(){
  long diff=System.currentTimeMillis() - _enqueueTime;
  return diff >= getClientIdleTimeThreshold();
}

Fixed version (ground truth):
public boolean isStale(){
  long diff=System.nanoTime() - _lastUse;
  return diff >= getClientIdleTimeThreshold();
}
Program: 82377
Project: 82377
Buggy source:
public static void close(Client client){
  client.getInputProtocol().getTransport().close();
  client.getOutputProtocol().getTransport().close();
}

Fixed version (ground truth):
public static void close(Client client){
  try {
    client.getInputProtocol().getTransport().close();
    client.getOutputProtocol().getTransport().close();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",client);
  }
}