nus-yam/ex-repair huggingface dataset:
Program: 82195
Project: 82195
Buggy source:
public Document highlight(int docID,Document document,SegmentReader segmentReader) throws IOException {
  Document highlight;
  try {
    highlight=HighlightHelper.highlight(docID,document,_highlightQuery,_fieldManager,segmentReader,_preTag,_postTag);
  }
 catch (  InvalidTokenOffsetsException e) {
    throw new IOException(e);
  }
  return highlight;
}

Fixed version (ground truth):
public Document highlight(int docID,Document document,AtomicReader atomicReader) throws IOException {
  Document highlight;
  try {
    highlight=HighlightHelper.highlight(docID,document,_highlightQuery,_fieldManager,atomicReader,_preTag,_postTag);
  }
 catch (  InvalidTokenOffsetsException e) {
    throw new IOException(e);
  }
  return highlight;
}
Program: 82196
Project: 82196
Buggy source:
private static void applyFamilies(Set<String> alreadyProcessed,OpenBitSet bits,Set<String> columnFamiliesToFetch,SegmentReader segmentReader,int primeDocRowId,int numberOfDocsInRow,Bits liveDocs) throws IOException {
  for (  String family : columnFamiliesToFetch) {
    if (!alreadyProcessed.contains(family)) {
      applyFamily(bits,family,segmentReader,primeDocRowId,numberOfDocsInRow,liveDocs);
      alreadyProcessed.add(family);
    }
  }
}

Fixed version (ground truth):
private static void applyFamilies(Set<String> alreadyProcessed,OpenBitSet bits,Set<String> columnFamiliesToFetch,AtomicReader segmentReader,int primeDocRowId,int numberOfDocsInRow,Bits liveDocs) throws IOException {
  for (  String family : columnFamiliesToFetch) {
    if (!alreadyProcessed.contains(family)) {
      applyFamily(bits,family,segmentReader,primeDocRowId,numberOfDocsInRow,liveDocs);
      alreadyProcessed.add(family);
    }
  }
}
Program: 82198
Project: 82198
Buggy source:
private static OpenBitSet getDocsToFetch(SegmentReader segmentReader,Selector selector,int primeDocRowId,int numberOfDocsInRow,Bits liveDocs,Filter filter,AtomicInteger totalRecords) throws IOException {
  Set<String> alreadyProcessed=new HashSet<String>();
  OpenBitSet bits=new OpenBitSet(numberOfDocsInRow);
  OpenBitSet mask=null;
  if (filter != null) {
    DocIdSet docIdSet=filter.getDocIdSet(segmentReader.getContext(),liveDocs);
    mask=getMask(docIdSet,primeDocRowId,numberOfDocsInRow);
  }
  Set<String> columnFamiliesToFetch=selector.getColumnFamiliesToFetch();
  boolean fetchAll=true;
  if (columnFamiliesToFetch != null) {
    fetchAll=false;
    applyFamilies(alreadyProcessed,bits,columnFamiliesToFetch,segmentReader,primeDocRowId,numberOfDocsInRow,liveDocs);
  }
  Map<String,Set<String>> columnsToFetch=selector.getColumnsToFetch();
  if (columnsToFetch != null) {
    fetchAll=false;
    applyColumns(alreadyProcessed,bits,columnsToFetch,segmentReader,primeDocRowId,numberOfDocsInRow,liveDocs);
  }
  if (fetchAll) {
    bits.set(0,numberOfDocsInRow);
  }
  if (mask != null) {
    bits.intersect(mask);
  }
  totalRecords.set((int)bits.cardinality());
  return bits;
}

Fixed version (ground truth):
private static OpenBitSet getDocsToFetch(AtomicReader atomicReader,Selector selector,int primeDocRowId,int numberOfDocsInRow,Bits liveDocs,Filter filter,AtomicInteger totalRecords) throws IOException {
  Set<String> alreadyProcessed=new HashSet<String>();
  OpenBitSet bits=new OpenBitSet(numberOfDocsInRow);
  OpenBitSet mask=null;
  if (filter != null) {
    DocIdSet docIdSet=filter.getDocIdSet(atomicReader.getContext(),liveDocs);
    mask=getMask(docIdSet,primeDocRowId,numberOfDocsInRow);
  }
  Set<String> columnFamiliesToFetch=selector.getColumnFamiliesToFetch();
  boolean fetchAll=true;
  if (columnFamiliesToFetch != null) {
    fetchAll=false;
    applyFamilies(alreadyProcessed,bits,columnFamiliesToFetch,atomicReader,primeDocRowId,numberOfDocsInRow,liveDocs);
  }
  Map<String,Set<String>> columnsToFetch=selector.getColumnsToFetch();
  if (columnsToFetch != null) {
    fetchAll=false;
    applyColumns(alreadyProcessed,bits,columnsToFetch,atomicReader,primeDocRowId,numberOfDocsInRow,liveDocs);
  }
  if (fetchAll) {
    bits.set(0,numberOfDocsInRow);
  }
  if (mask != null) {
    bits.intersect(mask);
  }
  totalRecords.set((int)bits.cardinality());
  return bits;
}
Program: 82199
Project: 82199
Buggy source:
private static void applyColumns(Set<String> alreadyProcessed,OpenBitSet bits,Map<String,Set<String>> columnsToFetch,SegmentReader segmentReader,int primeDocRowId,int numberOfDocsInRow,Bits liveDocs) throws IOException {
  for (  String family : columnsToFetch.keySet()) {
    if (!alreadyProcessed.contains(family)) {
      applyFamily(bits,family,segmentReader,primeDocRowId,numberOfDocsInRow,liveDocs);
      alreadyProcessed.add(family);
    }
  }
}

Fixed version (ground truth):
private static void applyColumns(Set<String> alreadyProcessed,OpenBitSet bits,Map<String,Set<String>> columnsToFetch,AtomicReader atomicReader,int primeDocRowId,int numberOfDocsInRow,Bits liveDocs) throws IOException {
  for (  String family : columnsToFetch.keySet()) {
    if (!alreadyProcessed.contains(family)) {
      applyFamily(bits,family,atomicReader,primeDocRowId,numberOfDocsInRow,liveDocs);
      alreadyProcessed.add(family);
    }
  }
}
Program: 82200
Project: 82200
Buggy source:
private static void applyFamily(OpenBitSet bits,String family,SegmentReader segmentReader,int primeDocRowId,int numberOfDocsInRow,Bits liveDocs) throws IOException {
  Fields fields=segmentReader.fields();
  Terms terms=fields.terms(BlurConstants.FAMILY);
  TermsEnum iterator=terms.iterator(null);
  BytesRef text=new BytesRef(family);
  int lastDocId=primeDocRowId + numberOfDocsInRow;
  if (iterator.seekExact(text,true)) {
    DocsEnum docs=iterator.docs(liveDocs,null,DocsEnum.FLAG_NONE);
    int doc=primeDocRowId;
    while ((doc=docs.advance(doc)) < lastDocId) {
      bits.set(doc - primeDocRowId);
    }
  }
}

Fixed version (ground truth):
private static void applyFamily(OpenBitSet bits,String family,AtomicReader atomicReader,int primeDocRowId,int numberOfDocsInRow,Bits liveDocs) throws IOException {
  Fields fields=atomicReader.fields();
  Terms terms=fields.terms(BlurConstants.FAMILY);
  TermsEnum iterator=terms.iterator(null);
  BytesRef text=new BytesRef(family);
  int lastDocId=primeDocRowId + numberOfDocsInRow;
  if (iterator.seekExact(text,true)) {
    DocsEnum docs=iterator.docs(liveDocs,null,DocsEnum.FLAG_NONE);
    int doc=primeDocRowId;
    while ((doc=docs.advance(doc)) < lastDocId) {
      bits.set(doc - primeDocRowId);
    }
  }
}
Program: 82201
Project: 82201
Buggy source:
@Override protected RowMutation mutate(RowMutation rowMutation){
  List<RecordMutation> mutations=rowMutation.getRecordMutations();
  for (  RecordMutation mutation : mutations) {
    Record record=mutation.getRecord();
    record.addToColumns(new Column("String_Node_Str",READ));
    record.addToColumns(new Column("String_Node_Str",DISCOVER));
  }
  return rowMutation;
}

Fixed version (ground truth):
@Override protected RowMutation mutate(RowMutation rowMutation){
  List<RecordMutation> mutations=rowMutation.getRecordMutations();
  for (  RecordMutation mutation : mutations) {
    Record record=mutation.getRecord();
    record.addToColumns(new Column(ACL_READ,READ));
    record.addToColumns(new Column(ACL_DISCOVER,DISCOVER));
  }
  return rowMutation;
}
Program: 82202
Project: 82202
Buggy source:
@Override protected void postTableCreate(TableDescriptor tableDescriptor,Iface client){
  String name=tableDescriptor.getName();
  try {
    client.addColumnDefinition(name,new ColumnDefinition("String_Node_Str","String_Node_Str",null,false,"String_Node_Str",null,false));
    client.addColumnDefinition(name,new ColumnDefinition("String_Node_Str","String_Node_Str",null,false,"String_Node_Str",null,false));
  }
 catch (  BlurException e) {
    throw new RuntimeException(e);
  }
catch (  TException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override protected void postTableCreate(TableDescriptor tableDescriptor,Iface client){
  String name=tableDescriptor.getName();
  try {
    client.addColumnDefinition(name,new ColumnDefinition(TEST,ACL_READ,null,false,ACL_READ,null,false));
    client.addColumnDefinition(name,new ColumnDefinition(TEST,ACL_DISCOVER,null,false,ACL_DISCOVER,null,false));
  }
 catch (  BlurException e) {
    throw new RuntimeException(e);
  }
catch (  TException e) {
    throw new RuntimeException(e);
  }
}
Program: 82203
Project: 82203
Buggy source:
public static SegmentReader getSegmentReader(IndexReader indexReader) throws IOException {
  if (indexReader instanceof SegmentReader) {
    return (SegmentReader)indexReader;
  }
  if (indexReader instanceof ExitableFilterAtomicReader) {
    ExitableFilterAtomicReader exitableFilterAtomicReader=(ExitableFilterAtomicReader)indexReader;
    AtomicReader originalReader=exitableFilterAtomicReader.getOriginalReader();
    return getSegmentReader(originalReader);
  }
  if (indexReader instanceof SecureAtomicReader) {
    SecureAtomicReader secureAtomicReader=(SecureAtomicReader)indexReader;
    AtomicReader originalReader=secureAtomicReader.getOriginalReader();
    return getSegmentReader(originalReader);
  }
  throw new IOException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * WARNING!!! This method can bypass access control. Use only when you are sure you know what you are doing!
 * @param indexReader
 * @return
 * @throws IOException
 */
public static SegmentReader getSegmentReader(IndexReader indexReader) throws IOException {
  if (indexReader instanceof SegmentReader) {
    return (SegmentReader)indexReader;
  }
  if (indexReader instanceof ExitableFilterAtomicReader) {
    ExitableFilterAtomicReader exitableFilterAtomicReader=(ExitableFilterAtomicReader)indexReader;
    AtomicReader originalReader=exitableFilterAtomicReader.getOriginalReader();
    return getSegmentReader(originalReader);
  }
  if (indexReader instanceof SecureAtomicReader) {
    SecureAtomicReader secureAtomicReader=(SecureAtomicReader)indexReader;
    AtomicReader originalReader=secureAtomicReader.getOriginalReader();
    return getSegmentReader(originalReader);
  }
  throw new IOException("String_Node_Str");
}
Program: 82204
Project: 82204
Buggy source:
public static File getDefaultTmpPath(String propName) throws IOException {
  String blurHomeDir=getBlurHomeDir();
  File tmp;
  if (blurHomeDir == null) {
    tmp=getTmpDir();
    LOG.info("String_Node_Str",tmp);
  }
 else {
    tmp=new File(blurHomeDir,"String_Node_Str");
    LOG.info("String_Node_Str",tmp);
    if (!tmp.mkdirs()) {
      tmp=getTmpDir();
      LOG.info("String_Node_Str",tmp);
    }
  }
  if (!tmp.exists() && !tmp.mkdirs()) {
    throw new IOException("String_Node_Str" + tmp.toURI() + "String_Node_Str"+ propName+ "String_Node_Str");
  }
  File file=new File(tmp,UUID.randomUUID().toString());
  if (!file.createNewFile()) {
    throw new IOException("String_Node_Str" + tmp.toURI() + "String_Node_Str");
  }
  file.delete();
  return tmp;
}

Fixed version (ground truth):
public static File getDefaultTmpPath(String propName) throws IOException {
  String blurHomeDir=getBlurHomeDir();
  File tmp;
  if (blurHomeDir == null) {
    tmp=getTmpDir();
    LOG.info("String_Node_Str",tmp);
  }
 else {
    tmp=new File(blurHomeDir,"String_Node_Str");
    LOG.info("String_Node_Str",tmp);
    if (!tmp.exists() && !tmp.mkdirs()) {
      tmp=getTmpDir();
      LOG.info("String_Node_Str",tmp);
    }
  }
  if (!tmp.exists() && !tmp.mkdirs()) {
    throw new IOException("String_Node_Str" + tmp.toURI() + "String_Node_Str"+ propName+ "String_Node_Str");
  }
  File file=new File(tmp,UUID.randomUUID().toString());
  if (!file.createNewFile()) {
    throw new IOException("String_Node_Str" + tmp.toURI() + "String_Node_Str");
  }
  file.delete();
  return tmp;
}
Program: 82205
Project: 82205
Buggy source:
private IndexReader getReader() throws CorruptIndexException, LockObtainFailedException, IOException {
  RAMDirectory directory=new RAMDirectory();
  IndexWriterConfig conf=new IndexWriterConfig(LUCENE_VERSION,new KeywordAnalyzer());
  IndexWriter writer=new IndexWriter(directory,conf);
  Document doc=new Document();
  doc.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  doc.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  Document doc1=new Document();
  doc.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  writer.addDocument(doc);
  writer.addDocument(doc1);
  writer.close();
  return DirectoryReader.open(directory);
}

Fixed version (ground truth):
private IndexReader getReader() throws CorruptIndexException, LockObtainFailedException, IOException {
  RAMDirectory directory=new RAMDirectory();
  IndexWriterConfig conf=new IndexWriterConfig(LUCENE_VERSION,new KeywordAnalyzer());
  IndexWriter writer=new IndexWriter(directory,conf);
  Document doc=new Document();
  doc.add(new StringField(BlurConstants.PRIME_DOC,BlurConstants.PRIME_DOC_VALUE,Store.NO));
  doc.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  doc.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  Document doc1=new Document();
  doc.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  writer.addDocument(doc);
  writer.addDocument(doc1);
  writer.close();
  return DirectoryReader.open(directory);
}
Program: 82206
Project: 82206
Buggy source:
private IndexReader getReaderWithDocsHavingFamily() throws CorruptIndexException, LockObtainFailedException, IOException {
  RAMDirectory directory=new RAMDirectory();
  IndexWriterConfig conf=new IndexWriterConfig(LUCENE_VERSION,new KeywordAnalyzer());
  IndexWriter writer=new IndexWriter(directory,conf);
  Document doc=new Document();
  doc.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  doc.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  Document doc1=new Document();
  doc1.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  doc1.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  writer.addDocument(doc);
  writer.addDocument(doc1);
  writer.close();
  return DirectoryReader.open(directory);
}

Fixed version (ground truth):
private IndexReader getReaderWithDocsHavingFamily() throws CorruptIndexException, LockObtainFailedException, IOException {
  RAMDirectory directory=new RAMDirectory();
  IndexWriterConfig conf=new IndexWriterConfig(LUCENE_VERSION,new KeywordAnalyzer());
  IndexWriter writer=new IndexWriter(directory,conf);
  Document doc=new Document();
  doc.add(new StringField(BlurConstants.PRIME_DOC,BlurConstants.PRIME_DOC_VALUE,Store.NO));
  doc.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  doc.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  Document doc1=new Document();
  doc1.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  doc1.add(new StringField("String_Node_Str","String_Node_Str",Store.YES));
  writer.addDocument(doc);
  writer.addDocument(doc1);
  writer.close();
  return DirectoryReader.open(directory);
}
Program: 82208
Project: 82208
Buggy source:
public void runGisTypeTest() throws IOException, ParseException {
  BaseFieldManager fieldManager=getFieldManager(new NoStopWordStandardAnalyzer());
  setupGisField(fieldManager);
  Record record=new Record();
  record.setFamily("String_Node_Str");
  record.setRecordId("String_Node_Str");
  record.addToColumns(new Column("String_Node_Str","String_Node_Str"));
  List<Field> fields=fieldManager.getFields("String_Node_Str",record);
  IndexWriterConfig conf=new IndexWriterConfig(Version.LUCENE_43,fieldManager.getAnalyzerForIndex());
  IndexWriter writer=new IndexWriter(_dir,conf);
  writer.addDocument(fields);
  writer.close();
  DirectoryReader reader=DirectoryReader.open(_dir);
  IndexSearcher searcher=new IndexSearcher(reader);
  SuperParser parser=new SuperParser(Version.LUCENE_43,fieldManager,true,null,ScoreType.SUPER,new Term(BlurConstants.PRIME_DOC,BlurConstants.PRIME_DOC_VALUE));
  Query query=parser.parse("String_Node_Str");
  TopDocs topDocs=searcher.search(query,10);
  assertEquals(1,topDocs.totalHits);
  reader.close();
}

Fixed version (ground truth):
public void runGisTypeTest() throws IOException, ParseException {
  BaseFieldManager fieldManager=getFieldManager(new NoStopWordStandardAnalyzer());
  setupGisField(fieldManager);
  Record record=new Record();
  record.setFamily("String_Node_Str");
  record.setRecordId("String_Node_Str");
  record.addToColumns(new Column("String_Node_Str","String_Node_Str"));
  List<Field> fields=fieldManager.getFields("String_Node_Str",record);
  IndexWriterConfig conf=new IndexWriterConfig(Version.LUCENE_43,fieldManager.getAnalyzerForIndex());
  IndexWriter writer=new IndexWriter(_dir,conf);
  fields.add(new StringField(BlurConstants.PRIME_DOC,BlurConstants.PRIME_DOC_VALUE,Store.NO));
  writer.addDocument(fields);
  writer.close();
  DirectoryReader reader=DirectoryReader.open(_dir);
  IndexSearcher searcher=new IndexSearcher(reader);
  SuperParser parser=new SuperParser(Version.LUCENE_43,fieldManager,true,null,ScoreType.SUPER,new Term(BlurConstants.PRIME_DOC,BlurConstants.PRIME_DOC_VALUE));
  Query query=parser.parse("String_Node_Str");
  TopDocs topDocs=searcher.search(query,10);
  assertEquals(1,topDocs.totalHits);
  reader.close();
}
Program: 82209
Project: 82209
Buggy source:
public void shutdownDfs(){
  if (cluster != null) {
    LOG.info("String_Node_Str");
    try {
      cluster.shutdown();
    }
 catch (    Exception e) {
    }
    try {
      FileSystem fs=cluster.getFileSystem();
      if (fs != null) {
        LOG.info("String_Node_Str");
        fs.close();
      }
      FileSystem.closeAll();
    }
 catch (    IOException e) {
      LOG.error("String_Node_Str",e);
    }
    ThreadGroup threadGroup=Thread.currentThread().getThreadGroup();
    Thread[] threads=new Thread[100];
    int enumerate=threadGroup.enumerate(threads);
    for (int i=0; i < enumerate; i++) {
      Thread thread=threads[i];
      if (thread.getName().startsWith("String_Node_Str")) {
        if (thread.isAlive()) {
          thread.interrupt();
          LOG.info("String_Node_Str" + thread.getName() + "String_Node_Str");
          Object target=getField(Thread.class,thread,"String_Node_Str");
          if (target != null) {
            ThreadPoolExecutor e=(ThreadPoolExecutor)getField(ThreadPoolExecutor.class,target,"String_Node_Str");
            if (e != null) {
              e.shutdownNow();
            }
          }
          try {
            LOG.info("String_Node_Str" + thread.getName() + "String_Node_Str");
            thread.join();
          }
 catch (          InterruptedException e) {
            throw new RuntimeException(e);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void shutdownDfs(){
  if (cluster != null) {
    LOG.info("String_Node_Str");
    try {
      cluster.shutdown();
    }
 catch (    Exception e) {
    }
    try {
      FileSystem fs=cluster.getFileSystem();
      if (fs != null) {
        LOG.info("String_Node_Str");
        fs.close();
      }
      FileSystem.closeAll();
    }
 catch (    IOException e) {
      LOG.error("String_Node_Str",e);
    }
    ThreadGroup threadGroup=group;
    Thread[] threads=new Thread[100];
    int enumerate=threadGroup.enumerate(threads);
    for (int i=0; i < enumerate; i++) {
      Thread thread=threads[i];
      if (thread.getName().startsWith("String_Node_Str")) {
        if (thread.isAlive()) {
          thread.interrupt();
          LOG.info("String_Node_Str" + thread.getName() + "String_Node_Str");
          Object target=getField(Thread.class,thread,"String_Node_Str");
          if (target != null) {
            ThreadPoolExecutor e=(ThreadPoolExecutor)getField(ThreadPoolExecutor.class,target,"String_Node_Str");
            if (e != null) {
              e.shutdownNow();
            }
          }
          try {
            LOG.info("String_Node_Str" + thread.getName() + "String_Node_Str");
            thread.join();
          }
 catch (          InterruptedException e) {
            throw new RuntimeException(e);
          }
        }
      }
    }
  }
}
Program: 82210
Project: 82210
Buggy source:
public void startBlurCluster(String path,int controllerCount,int shardCount,boolean randomPort,boolean externalProcesses){
  MemoryReporter.enable();
  startDfs(path + "String_Node_Str");
  startZooKeeper(path + "String_Node_Str",randomPort);
  setupBuffers();
  startControllers(controllerCount,randomPort,externalProcesses);
  startShards(shardCount,randomPort,externalProcesses);
  try {
    waitForSafeModeToExit();
  }
 catch (  BlurException e) {
    throw new RuntimeException(e);
  }
catch (  TException e) {
    throw new RuntimeException(e);
  }
catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void startBlurCluster(final String path,final int controllerCount,final int shardCount,final boolean randomPort,final boolean externalProcesses){
  Thread thread=new Thread(group,new Runnable(){
    @Override public void run(){
      MemoryReporter.enable();
      startDfs(path + "String_Node_Str");
      startZooKeeper(path + "String_Node_Str",randomPort);
      setupBuffers();
      startControllers(controllerCount,randomPort,externalProcesses);
      startShards(shardCount,randomPort,externalProcesses);
      try {
        waitForSafeModeToExit();
      }
 catch (      BlurException e) {
        throw new RuntimeException(e);
      }
catch (      TException e) {
        throw new RuntimeException(e);
      }
catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
);
  thread.start();
  try {
    thread.join();
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}
Program: 82211
Project: 82211
Buggy source:
private static List<Connection> getOnlineControllers(BlurConfiguration conf){
  setupZooKeeper(conf);
  return _connections;
}

Fixed version (ground truth):
private static List<Connection> getOnlineControllers(BlurConfiguration conf){
  String zooKeeperConnectionStr=getZooKeeperConnectionStr(conf);
  ZooKeeperConntrollerWatchInfo zooKeeperConntrollerWatchInfo=_zkConnectionInfo.get(zooKeeperConnectionStr);
  if (zooKeeperConntrollerWatchInfo != null) {
    return zooKeeperConntrollerWatchInfo._connections;
  }
  setupZooKeeper(conf);
  zooKeeperConntrollerWatchInfo=_zkConnectionInfo.get(zooKeeperConnectionStr);
  return zooKeeperConntrollerWatchInfo._connections;
}
Program: 82212
Project: 82212
Buggy source:
public static void closeZooKeeper(){
  if (_watchConntrollers != null) {
    try {
      _watchConntrollers.close();
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",e);
    }
  }
  if (_zooKeeper != null) {
    try {
      _zooKeeper.close();
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
public static void closeZooKeeper(){
  Collection<ZooKeeperConntrollerWatchInfo> values=_zkConnectionInfo.values();
  for (  ZooKeeperConntrollerWatchInfo zooKeeperConntrollerWatchInfo : values) {
    closeQuietly(zooKeeperConntrollerWatchInfo);
  }
}
Program: 82213
Project: 82213
Buggy source:
private static void setConnections(List<String> children){
  Set<Connection> goodConnections=new HashSet<Connection>();
  for (  String s : children) {
    Connection connection=new Connection(s);
    goodConnections.add(connection);
    if (!_connections.contains(connection)) {
      _connections.add(connection);
    }
  }
  Set<Connection> badConnections=new HashSet<Connection>();
  for (  Connection c : _connections) {
    if (!goodConnections.contains(c)) {
      badConnections.add(c);
    }
  }
  _connections.removeAll(badConnections);
}

Fixed version (ground truth):
void setConnections(List<String> children){
  Set<Connection> goodConnections=new HashSet<Connection>();
  for (  String s : children) {
    Connection connection=new Connection(s);
    goodConnections.add(connection);
    if (!_connections.contains(connection)) {
      _connections.add(connection);
    }
  }
  Set<Connection> badConnections=new HashSet<Connection>();
  for (  Connection c : _connections) {
    if (!goodConnections.contains(c)) {
      badConnections.add(c);
    }
  }
  _connections.removeAll(badConnections);
}
Program: 82214
Project: 82214
Buggy source:
private static void setupZooKeeper(BlurConfiguration conf){
  if (_zooKeeper == null) {
    String zkConn=conf.getExpected(BLUR_ZOOKEEPER_CONNECTION);
    int zkSessionTimeout=conf.getInt(BLUR_ZOOKEEPER_TIMEOUT,BLUR_ZOOKEEPER_TIMEOUT_DEFAULT);
    try {
      _zooKeeper=ZkUtils.newZooKeeper(zkConn,zkSessionTimeout);
      setConnections(_zooKeeper.getChildren(ZookeeperPathConstants.getOnlineControllersPath(),false));
      _watchConntrollers=new WatchChildren(_zooKeeper,ZookeeperPathConstants.getOnlineControllersPath());
      _watchConntrollers.watch(new OnChange(){
        @Override public void action(        List<String> children){
          setConnections(children);
        }
      }
);
      Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
        @Override public void run(){
          closeZooKeeper();
        }
      }
));
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
private static synchronized void setupZooKeeper(BlurConfiguration conf){
  String zooKeeperConnectionStr=getZooKeeperConnectionStr(conf);
  ZooKeeperConntrollerWatchInfo zooKeeperConntrollerWatchInfo=_zkConnectionInfo.get(zooKeeperConnectionStr);
  if (zooKeeperConntrollerWatchInfo == null) {
    try {
      final ZooKeeperConntrollerWatchInfo zkcwi=new ZooKeeperConntrollerWatchInfo(conf);
      _zkConnectionInfo.put(zooKeeperConnectionStr,zkcwi);
      Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
        @Override public void run(){
          closeQuietly(zkcwi);
        }
      }
));
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}
Program: 82215
Project: 82215
Buggy source:
private static synchronized BlurConfiguration getBlurConfiguration() throws IOException {
  if (_blurConfiguration == null) {
    _blurConfiguration=new BlurConfiguration();
  }
  return _blurConfiguration;
}

Fixed version (ground truth):
private static synchronized BlurConfiguration getBlurConfiguration() throws IOException {
  if (_defaultBlurConfiguration == null) {
    _defaultBlurConfiguration=new BlurConfiguration();
  }
  return _defaultBlurConfiguration;
}
Program: 82216
Project: 82216
Buggy source:
@Override public void run(){
  closeZooKeeper();
}

Fixed version (ground truth):
@Override public void run(){
  closeQuietly(zkcwi);
}
Program: 82217
Project: 82217
Buggy source:
@Override public void deleteFile(String name) throws IOException {
  Long length=_files.remove(name);
  if (length != null) {
    LOG.debug("String_Node_Str",name,length);
    long blocks=length / _blockSize;
    _store.delete(new BytesRef(name + LENGTH));
    _store.delete(new BytesRef(name + LASTMOD));
    for (long l=0; l <= blocks; l++) {
      _store.delete(new BytesRef(name + "String_Node_Str" + l));
    }
  }
}

Fixed version (ground truth):
@Override public void deleteFile(String name) throws IOException {
  Long length=_files.remove(name);
  if (length != null) {
    LOG.debug("String_Node_Str",name,length);
    long blocks=length / _blockSize;
    _store.delete(new BytesRef(name + LENGTH));
    _store.delete(new BytesRef(name + LASTMOD));
    for (long l=0; l <= blocks; l++) {
      _store.delete(new BytesRef(name + "String_Node_Str" + l));
    }
    writeFileNamesAndSync();
  }
}
Program: 82218
Project: 82218
Buggy source:
@Override public void sync(Collection<String> names) throws IOException {
  writeFilesNames();
  _store.sync();
  if (shouldPerformGC()) {
    gc();
  }
}

Fixed version (ground truth):
@Override public void sync(Collection<String> names) throws IOException {
  writeFileNamesAndSync();
  if (shouldPerformGC()) {
    gc();
  }
}
Program: 82219
Project: 82219
Buggy source:
public FastHdfsKeyValueDirectory(Timer hdfsKeyValueTimer,Configuration configuration,Path path) throws IOException {
  _path=path;
  _store=new HdfsKeyValueStore(hdfsKeyValueTimer,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 {
        LOG.warn("String_Node_Str",file);
      }
    }
  }
  setLockFactory(NoLockFactory.getNoLockFactory());
  writeFilesNames();
  gc();
}

Fixed version (ground truth):
public FastHdfsKeyValueDirectory(Timer hdfsKeyValueTimer,Configuration configuration,Path path) throws IOException {
  _path=path;
  _store=new HdfsKeyValueStore(hdfsKeyValueTimer,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()) {
        throw new IOException("String_Node_Str" + filesString + "String_Node_Str");
      }
      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" + file + "String_Node_Str");
      }
    }
  }
  setLockFactory(NoLockFactory.getNoLockFactory());
  writeFilesNames();
  gc();
}
Program: 82220
Project: 82220
Buggy source:
private void writeFilesNames() throws IOException {
  StringBuilder builder=new StringBuilder();
  for (  String n : _files.keySet()) {
    if (builder.length() != 0) {
      builder.append(SEP);
    }
    builder.append(n);
  }
  _store.put(FILES,new BytesRef(builder.toString()));
}

Fixed version (ground truth):
private void writeFilesNames() throws IOException {
  StringBuilder builder=new StringBuilder();
  Set<String> fileNames=new TreeSet<String>(_files.keySet());
  for (  String n : fileNames) {
    if (builder.length() != 0) {
      builder.append(SEP);
    }
    builder.append(n);
  }
  _store.put(FILES,new BytesRef(builder.toString()));
}
Program: 82221
Project: 82221
Buggy source:
@Override public String[] listAll() throws IOException {
  Set<String> fileNames=new HashSet<String>(_files.keySet());
  fileNames.remove(null);
  return fileNames.toArray(new String[fileNames.size()]);
}

Fixed version (ground truth):
@Override public String[] listAll() throws IOException {
  Set<String> fileNames=new HashSet<String>(_files.keySet());
  return fileNames.toArray(new String[fileNames.size()]);
}
Program: 82222
Project: 82222
Buggy source:
public void startDfs(Configuration conf,boolean format,String path){
  String perm;
  Path p=new Path(new File("String_Node_Str").getAbsolutePath());
  try {
    FileSystem fileSystem=p.getFileSystem(conf);
    FileStatus fileStatus=fileSystem.getFileStatus(p);
    FsPermission permission=fileStatus.getPermission();
    perm=permission.getUserAction().ordinal() + "String_Node_Str" + permission.getGroupAction().ordinal()+ "String_Node_Str"+ permission.getOtherAction().ordinal();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  LOG.info("String_Node_Str" + perm);
  conf.set("String_Node_Str",perm);
  System.setProperty("String_Node_Str",path);
  try {
    cluster=new MiniDFSCluster(conf,1,true,(String[])null);
    cluster.waitActive();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void startDfs(Configuration conf,boolean format,String path){
  String perm;
  Path p=new Path(new File(path).getAbsolutePath());
  try {
    FileSystem fileSystem=p.getFileSystem(conf);
    if (!fileSystem.exists(p)) {
      if (!fileSystem.mkdirs(p)) {
        throw new RuntimeException("String_Node_Str" + path + "String_Node_Str");
      }
    }
    FileStatus fileStatus=fileSystem.getFileStatus(p);
    FsPermission permission=fileStatus.getPermission();
    perm=permission.getUserAction().ordinal() + "String_Node_Str" + permission.getGroupAction().ordinal()+ "String_Node_Str"+ permission.getOtherAction().ordinal();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  LOG.info("String_Node_Str" + perm);
  conf.set("String_Node_Str",perm);
  System.setProperty("String_Node_Str",path);
  try {
    cluster=new MiniDFSCluster(conf,1,true,(String[])null);
    cluster.waitActive();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
}
Program: 82223
Project: 82223
Buggy source:
@Override public int compareTo(MergeWork o){
  return Long.compare(_size,o._size);
}

Fixed version (ground truth):
@Override public int compareTo(MergeWork o){
  if (_size == o._size) {
    return 0;
  }
  return _size < o._size ? -1 : 1;
}
Program: 82224
Project: 82224
Buggy source:
@Override public void run(){
  _writeLock.lock();
  try {
    if (_output != null && _lastWrite.get() + MAX_OPEN_FOR_WRITING < System.currentTimeMillis()) {
      LOG.info("String_Node_Str",_path);
      try {
        _output.close();
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
      }
 finally {
        _output=null;
      }
      try {
        cleanupOldFiles();
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
      }
    }
  }
  finally {
    _writeLock.unlock();
  }
}

Fixed version (ground truth):
@Override public void run(){
  _writeLock.lock();
  try {
    if (_output != null && _lastWrite.get() + MAX_OPEN_FOR_WRITING < System.currentTimeMillis()) {
      try {
        cleanupOldFiles();
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
      }
      LOG.info("String_Node_Str",_path);
      try {
        _output.close();
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
      }
 finally {
        _output=null;
      }
    }
  }
  finally {
    _writeLock.unlock();
  }
}
Program: 82225
Project: 82225
Buggy source:
private void addToTimer(Timer hdfsKeyValueTimer){
  _writeLock.lock();
  try {
    try {
      cleanupOldFiles();
    }
 catch (    IOException e) {
      LOG.error("String_Node_Str",e);
    }
  }
  finally {
    _writeLock.unlock();
  }
  hdfsKeyValueTimer.schedule(new TimerTask(){
    @Override public void run(){
      _writeLock.lock();
      try {
        if (_output != null && _lastWrite.get() + MAX_OPEN_FOR_WRITING < System.currentTimeMillis()) {
          LOG.info("String_Node_Str",_path);
          try {
            _output.close();
          }
 catch (          IOException e) {
            LOG.error("String_Node_Str",e);
          }
 finally {
            _output=null;
          }
          try {
            cleanupOldFiles();
          }
 catch (          IOException e) {
            LOG.error("String_Node_Str",e);
          }
        }
      }
  finally {
        _writeLock.unlock();
      }
    }
  }
,DAEMON_POLL_TIME,DAEMON_POLL_TIME);
}

Fixed version (ground truth):
private void addToTimer(Timer hdfsKeyValueTimer){
  _writeLock.lock();
  try {
    try {
      cleanupOldFiles();
    }
 catch (    IOException e) {
      LOG.error("String_Node_Str",e);
    }
  }
  finally {
    _writeLock.unlock();
  }
  hdfsKeyValueTimer.schedule(new TimerTask(){
    @Override public void run(){
      _writeLock.lock();
      try {
        if (_output != null && _lastWrite.get() + MAX_OPEN_FOR_WRITING < System.currentTimeMillis()) {
          try {
            cleanupOldFiles();
          }
 catch (          IOException e) {
            LOG.error("String_Node_Str",e);
          }
          LOG.info("String_Node_Str",_path);
          try {
            _output.close();
          }
 catch (          IOException e) {
            LOG.error("String_Node_Str",e);
          }
 finally {
            _output=null;
          }
        }
      }
  finally {
        _writeLock.unlock();
      }
    }
  }
,DAEMON_POLL_TIME,DAEMON_POLL_TIME);
}
Program: 82226
Project: 82226
Buggy source:
public Parameter(Object name,Object value){
  _name=name;
  _value=value;
}

Fixed version (ground truth):
public Parameter(String name,Object value){
  _name=name;
  _value=value;
}
Program: 82227
Project: 82227
Buggy source:
public JSONObject toJsonObject() throws JSONException {
  JSONObject jsonObject=new JSONObject();
  jsonObject.put("String_Node_Str",_id);
  jsonObject.put("String_Node_Str",_traceScope);
  jsonObject.put("String_Node_Str",_name);
  jsonObject.put("String_Node_Str",_threadName);
  jsonObject.put("String_Node_Str",(_ended - _start));
  jsonObject.put("String_Node_Str",_start);
  jsonObject.put("String_Node_Str",_ended);
  if (_traceCollector != null) {
    jsonObject.put("String_Node_Str",_traceCollector.toJsonObject());
  }
  if (_parameters != null) {
    jsonObject.put("String_Node_Str",getParametersJsonObject());
  }
  return jsonObject;
}

Fixed version (ground truth):
public JSONObject toJsonObject() throws JSONException {
  JSONObject jsonObject=new JSONObject();
  jsonObject.put("String_Node_Str",_id);
  jsonObject.put("String_Node_Str",_traceScope);
  jsonObject.put("String_Node_Str",_name);
  jsonObject.put("String_Node_Str",_threadName);
  jsonObject.put("String_Node_Str",(_ended - _start));
  jsonObject.put("String_Node_Str",_start);
  jsonObject.put("String_Node_Str",_ended);
  if (_traceCollector != null) {
    jsonObject.put("String_Node_Str",_traceCollector.toJsonObject());
  }
  if (_parameters != null) {
    jsonObject.put("String_Node_Str",getParametersJSONArray());
  }
  return jsonObject;
}
Program: 82228
Project: 82228
Buggy source:
private String toString(Object o){
  if (o == null) {
    return null;
  }
  return o.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + _name + "String_Node_Str"+ _id+ "String_Node_Str"+ _threadName+ "String_Node_Str"+ _start+ "String_Node_Str"+ (_ended - _start)+ "String_Node_Str";
}
Program: 82229
Project: 82229
Buggy source:
public BaseCommandManager(String tmpPath,String commandPath,int workerThreadCount,int driverThreadCount,long connectionTimeout,Configuration configuration) throws IOException {
  _configuration=configuration;
  lookForCommandsToRegisterInClassPath();
  _tmpPath=tmpPath;
  _commandPath=commandPath;
  _executorService=Executors.newThreadPool("String_Node_Str",workerThreadCount);
  _executorServiceDriver=Executors.newThreadPool("String_Node_Str",driverThreadCount);
  _connectionTimeout=connectionTimeout / 2;
  _timer=new Timer("String_Node_Str",true);
  _timer.schedule(getTimerTaskForRemovalOfOldCommands(),_pollingPeriod,_pollingPeriod);
  if (_tmpPath == null || _commandPath == null) {
    LOG.info("String_Node_Str",_tmpPath,_commandPath);
  }
 else {
    loadNewCommandsFromCommandPath();
    _timer.schedule(getNewCommandTimerTask(),_pollingPeriod,_pollingPeriod);
  }
}

Fixed version (ground truth):
public BaseCommandManager(File tmpPath,String commandPath,int workerThreadCount,int driverThreadCount,long connectionTimeout,Configuration configuration) throws IOException {
  _configuration=configuration;
  lookForCommandsToRegisterInClassPath();
  _tmpPath=tmpPath;
  _commandPath=commandPath;
  _executorService=Executors.newThreadPool("String_Node_Str",workerThreadCount);
  _executorServiceDriver=Executors.newThreadPool("String_Node_Str",driverThreadCount);
  _connectionTimeout=connectionTimeout / 2;
  _timer=new Timer("String_Node_Str",true);
  _timer.schedule(getTimerTaskForRemovalOfOldCommands(),_pollingPeriod,_pollingPeriod);
  if (_tmpPath == null || _commandPath == null) {
    LOG.info("String_Node_Str",_tmpPath,_commandPath);
  }
 else {
    loadNewCommandsFromCommandPath();
    _timer.schedule(getNewCommandTimerTask(),_pollingPeriod,_pollingPeriod);
  }
}
Program: 82230
Project: 82230
Buggy source:
public ControllerCommandManager(String tmpPath,String commandPath,int workerThreadCount,int driverThreadCount,long connectionTimeout,Configuration configuration) throws IOException {
  super(tmpPath,commandPath,workerThreadCount,driverThreadCount,connectionTimeout,configuration);
}

Fixed version (ground truth):
public ControllerCommandManager(File tmpPath,String commandPath,int workerThreadCount,int driverThreadCount,long connectionTimeout,Configuration configuration) throws IOException {
  super(tmpPath,commandPath,workerThreadCount,driverThreadCount,connectionTimeout,configuration);
}
Program: 82231
Project: 82231
Buggy source:
public ShardCommandManager(IndexServer indexServer,String tmpPath,String commandPath,int workerThreadCount,int driverThreadCount,long connectionTimeout,Configuration configuration) throws IOException {
  super(tmpPath,commandPath,workerThreadCount,driverThreadCount,connectionTimeout,configuration);
  _indexServer=indexServer;
}

Fixed version (ground truth):
public ShardCommandManager(IndexServer indexServer,File tmpPath,String commandPath,int workerThreadCount,int driverThreadCount,long connectionTimeout,Configuration configuration) throws IOException {
  super(tmpPath,commandPath,workerThreadCount,driverThreadCount,connectionTimeout,configuration);
  _indexServer=indexServer;
}
Program: 82234
Project: 82234
Buggy source:
public static String getDefaultTmpPath(String propName) throws IOException {
  String blurHomeDir=getBlurHomeDir();
  File tmp;
  if (blurHomeDir == null) {
    tmp=getTmpDir();
    LOG.info("String_Node_Str",tmp);
  }
 else {
    tmp=new File(blurHomeDir,"String_Node_Str");
    LOG.info("String_Node_Str",tmp);
    if (!tmp.mkdirs()) {
      tmp=getTmpDir();
      LOG.info("String_Node_Str",tmp);
    }
  }
  if (!tmp.exists() && !tmp.mkdirs()) {
    throw new IOException("String_Node_Str" + tmp.toURI() + "String_Node_Str"+ propName+ "String_Node_Str");
  }
  File file=new File(tmp,UUID.randomUUID().toString());
  if (!file.createNewFile()) {
    throw new IOException("String_Node_Str" + tmp.toURI() + "String_Node_Str");
  }
  file.delete();
  return tmp.toURI().toString();
}

Fixed version (ground truth):
public static File getDefaultTmpPath(String propName) throws IOException {
  String blurHomeDir=getBlurHomeDir();
  File tmp;
  if (blurHomeDir == null) {
    tmp=getTmpDir();
    LOG.info("String_Node_Str",tmp);
  }
 else {
    tmp=new File(blurHomeDir,"String_Node_Str");
    LOG.info("String_Node_Str",tmp);
    if (!tmp.mkdirs()) {
      tmp=getTmpDir();
      LOG.info("String_Node_Str",tmp);
    }
  }
  if (!tmp.exists() && !tmp.mkdirs()) {
    throw new IOException("String_Node_Str" + tmp.toURI() + "String_Node_Str"+ propName+ "String_Node_Str");
  }
  File file=new File(tmp,UUID.randomUUID().toString());
  if (!file.createNewFile()) {
    throw new IOException("String_Node_Str" + tmp.toURI() + "String_Node_Str");
  }
  file.delete();
  return tmp;
}
Program: 82236
Project: 82236
Buggy source:
private static List<String> getOnlineControllers(BlurConfiguration conf){
  String zkConn=conf.getExpected(BLUR_ZOOKEEPER_CONNECTION);
  int zkSessionTimeout=conf.getInt(BLUR_ZOOKEEPER_TIMEOUT,BLUR_ZOOKEEPER_TIMEOUT_DEFAULT);
  ZooKeeper zkClient=null;
  try {
    zkClient=ZkUtils.newZooKeeper(zkConn,zkSessionTimeout);
    return zkClient.getChildren(ZookeeperPathConstants.getOnlineControllersPath(),false);
  }
 catch (  KeeperException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private static List<Connection> getOnlineControllers(BlurConfiguration conf){
  setupZooKeeper(conf);
}
Program: 82237
Project: 82237
Buggy source:
private static List<Connection> getOnlineControllers(BlurConfiguration conf){
  setupZooKeeper(conf);
}

Fixed version (ground truth):
private static List<Connection> getOnlineControllers(BlurConfiguration conf){
  setupZooKeeper(conf);
  return _connections;
}
Program: 82238
Project: 82238
Buggy source:
private static void setupZooKeeper(BlurConfiguration conf){
  String zkConn=conf.getExpected(BLUR_ZOOKEEPER_CONNECTION);
  int zkSessionTimeout=conf.getInt(BLUR_ZOOKEEPER_TIMEOUT,BLUR_ZOOKEEPER_TIMEOUT_DEFAULT);
  ZooKeeper zkClient=null;
  try {
    zkClient=ZkUtils.newZooKeeper(zkConn,zkSessionTimeout);
    return zkClient.getChildren(ZookeeperPathConstants.getOnlineControllersPath(),false);
  }
 catch (  KeeperException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private static void setupZooKeeper(BlurConfiguration conf){
  if (_zooKeeper == null) {
    String zkConn=conf.getExpected(BLUR_ZOOKEEPER_CONNECTION);
    int zkSessionTimeout=conf.getInt(BLUR_ZOOKEEPER_TIMEOUT,BLUR_ZOOKEEPER_TIMEOUT_DEFAULT);
    try {
      _zooKeeper=ZkUtils.newZooKeeper(zkConn,zkSessionTimeout);
      setConnections(_zooKeeper.getChildren(ZookeeperPathConstants.getOnlineControllersPath(),false));
      _watchConntrollers=new WatchChildren(_zooKeeper,ZookeeperPathConstants.getOnlineControllersPath());
      _watchConntrollers.watch(new OnChange(){
        @Override public void action(        List<String> children){
          setConnections(children);
        }
      }
);
      Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
        @Override public void run(){
          closeZooKeeper();
        }
      }
));
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}
Program: 82240
Project: 82240
Buggy source:
@Test public void combineShouldProperlySum() throws IOException {
  DocumentCountCombiner dc=new DocumentCountCombiner();
  Map<Shard,Integer> shardTotals=Maps.newHashMap(ImmutableMap.of(new Shard("String_Node_Str","String_Node_Str"),10,new Shard("String_Node_Str","String_Node_Str"),20,new Shard("String_Node_Str","String_Node_Str"),30));
  long total=dc.combine(shardTotals);
  assertEquals(60l,total);
}

Fixed version (ground truth):
@Test public void combineShouldProperlySum() throws IOException {
  DocumentCountCombiner dc=new DocumentCountCombiner();
  Map<Shard,Integer> shardTotals=Maps.newHashMap(ImmutableMap.of(new Shard("String_Node_Str","String_Node_Str"),10,new Shard("String_Node_Str","String_Node_Str"),20,new Shard("String_Node_Str","String_Node_Str"),30));
  long total=dc.combine(new TestCombiningContext(),shardTotals);
  assertEquals(60l,total);
}
Program: 82241
Project: 82241
Buggy source:
@Test public void combineEmptyShouldGiveNiceEmptyList() throws IOException {
  Map<Shard,List<String>> execResults=Maps.newHashMap();
  List<String> expected=Lists.newArrayList();
  TermsCommand cmd=new TermsCommand();
  List<String> returned=cmd.combine(execResults);
  assertEquals(expected,returned);
}

Fixed version (ground truth):
@Test public void combineEmptyShouldGiveNiceEmptyList() throws IOException, InterruptedException {
  Map<Shard,List<String>> execResults=Maps.newHashMap();
  List<String> expected=Lists.newArrayList();
  TermsCommand cmd=new TermsCommand();
  List<String> returned=cmd.combine(new TestCombiningContext(),execResults);
  assertEquals(expected,returned);
}