nus-yam/ex-repair huggingface dataset:
Program: 7842
Project: 7842
Buggy source:
@Override public DequeueResult dequeue(int maxBatchSize) throws IOException {
  Preconditions.checkArgument(maxBatchSize > 0,"String_Node_Str");
  List<Entry> dequeueEntries=Lists.newLinkedList();
  while (dequeueEntries.size() < maxBatchSize && getEntries(dequeueEntries,maxBatchSize)) {
    Iterator<Entry> iterator=dequeueEntries.iterator();
    while (iterator.hasNext()) {
      Entry entry=iterator.next();
      if (consumerConfig.getDequeueStrategy() == DequeueStrategy.FIFO && consumerConfig.getGroupSize() > 1) {
        if (entry.getState() == null) {
          Put put=new Put(entry.getRowKey());
          byte[] stateValue=encodeStateColumn(ConsumerEntryState.CLAIMED);
          put.add(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName,stateValue);
          boolean claimed=hTable.checkAndPut(entry.getRowKey(),HBaseQueueConstants.COLUMN_FAMILY,stateColumnName,entry.getState(),put);
          if (!claimed) {
            iterator.remove();
            continue;
          }
          entry=new Entry(entry.getRowKey(),entry.getData(),stateValue);
        }
      }
      consumingEntries.put(entry.getRowKey(),entry);
    }
  }
  if (dequeueEntries.isEmpty()) {
    return EMPTY_RESULT;
  }
  return new DequeueResultImpl(dequeueEntries);
}

Fixed version (ground truth):
@Override public DequeueResult dequeue(int maxBatchSize) throws IOException {
  Preconditions.checkArgument(maxBatchSize > 0,"String_Node_Str");
  while (consumingEntries.size() < maxBatchSize && getEntries(consumingEntries,maxBatchSize)) {
    if (consumerConfig.getDequeueStrategy() == DequeueStrategy.FIFO && consumerConfig.getGroupSize() > 1) {
      Iterator<Map.Entry<byte[],Entry>> iterator=consumingEntries.entrySet().iterator();
      while (iterator.hasNext()) {
        Entry entry=iterator.next().getValue();
        if (entry.getState() == null) {
          Put put=new Put(entry.getRowKey());
          byte[] stateValue=encodeStateColumn(ConsumerEntryState.CLAIMED);
          put.add(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName,stateValue);
          boolean claimed=hTable.checkAndPut(entry.getRowKey(),HBaseQueueConstants.COLUMN_FAMILY,stateColumnName,null,put);
          if (!claimed) {
            iterator.remove();
            continue;
          }
        }
      }
    }
  }
  if (consumingEntries.isEmpty()) {
    return EMPTY_RESULT;
  }
  return new DequeueResultImpl(consumingEntries.values());
}
Program: 7844
Project: 7844
Buggy source:
/** 
 * Try to dequeue (claim) entries up to a maximum size.
 * @param entries For claimed entries to fill in.
 * @param maxBatchSize Maximum number of entries to claim.
 * @return The entries instance.
 * @throws IOException
 */
private boolean getEntries(List<Entry> entries,int maxBatchSize) throws IOException {
  boolean hasEntry=fetchFromCache(entries,maxBatchSize);
  if (entries.size() < maxBatchSize) {
    populateRowCache();
    hasEntry=fetchFromCache(entries,maxBatchSize);
  }
  return hasEntry;
}

Fixed version (ground truth):
/** 
 * Try to dequeue (claim) entries up to a maximum size.
 * @param entries For claimed entries to fill in.
 * @param maxBatchSize Maximum number of entries to claim.
 * @return The entries instance.
 * @throws IOException
 */
private boolean getEntries(SortedMap<byte[],Entry> entries,int maxBatchSize) throws IOException {
  boolean hasEntry=fetchFromCache(entries,maxBatchSize);
  if (entries.size() < maxBatchSize) {
    populateRowCache(entries.keySet());
    hasEntry=fetchFromCache(entries,maxBatchSize) || hasEntry;
  }
  return hasEntry;
}
Program: 7845
Project: 7845
Buggy source:
private boolean fetchFromCache(List<Entry> entries,int maxBatchSize){
  if (entryCache.isEmpty()) {
    return false;
  }
  Iterator<Map.Entry<byte[],Entry>> iterator=entryCache.entrySet().iterator();
  while (entries.size() < maxBatchSize && iterator.hasNext()) {
    entries.add(iterator.next().getValue());
    iterator.remove();
  }
  return true;
}

Fixed version (ground truth):
private boolean fetchFromCache(SortedMap<byte[],Entry> entries,int maxBatchSize){
  if (entryCache.isEmpty()) {
    return false;
  }
  Iterator<Map.Entry<byte[],Entry>> iterator=entryCache.entrySet().iterator();
  while (entries.size() < maxBatchSize && iterator.hasNext()) {
    Map.Entry<byte[],Entry> entry=iterator.next();
    entries.put(entry.getKey(),entry.getValue());
    iterator.remove();
  }
  return true;
}
Program: 7846
Project: 7846
Buggy source:
/** 
 * Given a key prefix, return the smallest key that is greater than all keys starting with that prefix.
 */
private byte[] getStopRow(){
  return Bytes.add(queueName.toBytes(),Bytes.toBytes(transaction.getReadPointer() + 1L));
}

Fixed version (ground truth):
/** 
 * Gets the stop row for scan. Stop row is queueName + (readPointer + 1).
 */
private byte[] getStopRow(){
  return Bytes.add(queueName.toBytes(),Bytes.toBytes(transaction.getReadPointer() + 1L));
}
Program: 7848
Project: 7848
Buggy source:
@Override public StreamWriter getStreamWriter(String streamName){
  QueueName queueName=QueueName.fromStream(idAccount,streamName);
  StreamWriter streamWriter=benchmarkStreamWriterFactory.create(CConfiguration.create(),queueName);
  streamWriters.add((MultiThreadedStreamWriter)streamWriter);
  return streamWriter;
}

Fixed version (ground truth):
@Override public StreamWriter getStreamWriter(String streamName){
  QueueName queueName=QueueName.fromStream(idAccount.getId(),streamName);
  StreamWriter streamWriter=benchmarkStreamWriterFactory.create(CConfiguration.create(),queueName);
  streamWriters.add((MultiThreadedStreamWriter)streamWriter);
  return streamWriter;
}
Program: 7849
Project: 7849
Buggy source:
/** 
 * Decodes the batch request
 * @return a List of String containing all requests from the batch.
 */
private List<MetricsRequest> decodeRequests(ChannelBuffer content) throws IOException {
  Reader reader=new InputStreamReader(new ChannelBufferInputStream(content),Charsets.UTF_8);
  try {
    List<URI> uris=GSON.fromJson(reader,new TypeToken<List<URI>>(){
    }
.getType());
    LOG.trace("String_Node_Str",uris);
    return ImmutableList.copyOf(Iterables.transform(uris,URI_TO_METRIC_REQUEST));
  }
  finally {
    reader.close();
  }
}

Fixed version (ground truth):
/** 
 * Decodes the batch request.
 * @return a List of String containing all requests from the batch.
 */
private List<MetricsRequest> decodeRequests(ChannelBuffer content) throws IOException {
  Reader reader=new InputStreamReader(new ChannelBufferInputStream(content),Charsets.UTF_8);
  try {
    List<URI> uris=GSON.fromJson(reader,new TypeToken<List<URI>>(){
    }
.getType());
    LOG.trace("String_Node_Str",uris);
    return ImmutableList.copyOf(Iterables.transform(uris,URI_TO_METRIC_REQUEST));
  }
  finally {
    reader.close();
  }
}
Program: 7851
Project: 7851
Buggy source:
@Override public void stop(){
  LOG.info("String_Node_Str");
  if (kafkaServer != null) {
    kafkaServer.stopAndWait();
  }
}

Fixed version (ground truth):
@Override public void stop(){
  LOG.info("String_Node_Str");
  if (kafkaServer != null && kafkaServer.isRunning()) {
    kafkaServer.stopAndWait();
  }
}
Program: 7852
Project: 7852
Buggy source:
@Override public void start(){
  LOG.info("String_Node_Str");
  kafkaServer=new EmbeddedKafkaServer(KafkaServerMain.class.getClassLoader(),kafkaProperties);
  kafkaServer.startAndWait();
  LOG.info("String_Node_Str");
}

Fixed version (ground truth):
@Override public void start(){
  LOG.info("String_Node_Str");
  kafkaServer=new EmbeddedKafkaServer(KafkaServerMain.class.getClassLoader(),kafkaProperties);
  Service.State state=kafkaServer.startAndWait();
  if (state != Service.State.RUNNING) {
    throw new IllegalStateException("String_Node_Str");
  }
  LOG.info("String_Node_Str");
}
Program: 7853
Project: 7853
Buggy source:
@Override protected OrderedVersionedColumnarTable createNewTable(byte[] tableName) throws OperationException {
  LevelDBOVCTable table=new LevelDBOVCTable(basePath,Bytes.toString(tableName),blockSize,cacheSize);
  table.initializeTable();
  return table;
}

Fixed version (ground truth):
@Override protected synchronized OrderedVersionedColumnarTable createNewTable(byte[] tableName) throws OperationException {
  LevelDBOVCTable table=new LevelDBOVCTable(basePath,Bytes.toString(tableName),blockSize,cacheSize);
  if (table.openTable()) {
    return table;
  }
  table.initializeTable();
  return table;
}
Program: 7854
Project: 7854
Buggy source:
@Override protected OrderedVersionedColumnarTable createNewTable(byte[] tableName) throws OperationException {
  LevelDBOVCTable table=new LevelDBOVCTable(basePath,Bytes.toString(tableName),blockSize,cacheSize);
  table.initializeTable();
  return table;
}

Fixed version (ground truth):
@Override protected synchronized OrderedVersionedColumnarTable createNewTable(byte[] tableName) throws OperationException {
  LevelDBOVCTable table=new LevelDBOVCTable(basePath,Bytes.toString(tableName),blockSize,cacheSize);
  if (table.openTable()) {
    return table;
  }
  table.initializeTable();
  return table;
}
Program: 7855
Project: 7855
Buggy source:
private Counter getCounter(String counterPath){
  String json="String_Node_Str" + counterPath + "String_Node_Str";
  LOG.info("String_Node_Str" + json);
  String response=sendJSonPostRequest(url,json,null);
  List<MetricsResponse> responseData=GSON.fromJson(response,new TypeToken<List<MetricsResponse>>(){
  }
.getType());
  if (responseData == null || responseData.size() == 0) {
    throw new RuntimeException(String.format("String_Node_Str",counterPath));
  }
  if (responseData.size() > 1) {
    throw new RuntimeException(String.format("String_Node_Str",counterPath));
  }
  return new Counter(responseData.get(0).getPath(),responseData.get(0).getResult().getData());
}

Fixed version (ground truth):
private Counter getCounter(String counterPath){
  String json="String_Node_Str" + counterPath + "String_Node_Str";
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",json);
  }
  String response=sendJSonPostRequest(url,json,null);
  List<MetricsResponse> responseData=GSON.fromJson(response,new TypeToken<List<MetricsResponse>>(){
  }
.getType());
  if (responseData == null || responseData.size() == 0) {
    throw new RuntimeException(String.format("String_Node_Str",counterPath));
  }
  if (responseData.size() > 1) {
    throw new RuntimeException(String.format("String_Node_Str",counterPath));
  }
  return new Counter(responseData.get(0).getPath(),responseData.get(0).getResult().getData());
}
Program: 7856
Project: 7856
Buggy source:
private ConsumerThread(TopicPartition topicPart,long startOffset,MessageCallback callback){
  this.topicPart=topicPart;
  this.startOffset=startOffset;
  this.callback=callback;
  this.running=true;
  this.fetchedMessage=new BasicFetchedMessage(topicPart);
}

Fixed version (ground truth):
private ConsumerThread(TopicPartition topicPart,long startOffset,MessageCallback callback){
  super(String.format("String_Node_Str",topicPart.getTopic(),topicPart.getPartition()));
  this.topicPart=topicPart;
  this.startOffset=startOffset;
  this.callback=callback;
  this.running=true;
  this.fetchedMessage=new BasicFetchedMessage(topicPart);
}
Program: 7857
Project: 7857
Buggy source:
/** 
 * Makes a call to kafka to fetch messages.
 */
private FetchResponse fetchMessages(SimpleConsumer consumer,long offset){
  FetchRequest request=new FetchRequestBuilder().clientId(consumer.clientId()).addFetch(topicPart.getTopic(),topicPart.getPartition(),offset,FETCH_SIZE).build();
  return consumer.fetch(request);
}

Fixed version (ground truth):
/** 
 * Makes a call to kafka to fetch messages.
 */
private FetchResponse fetchMessages(SimpleConsumer consumer,long offset){
  FetchRequest request=new FetchRequestBuilder().clientId(consumer.clientId()).addFetch(topicPart.getTopic(),topicPart.getPartition(),offset,FETCH_SIZE).maxWait(1000).build();
  return consumer.fetch(request);
}
Program: 7858
Project: 7858
Buggy source:
public void terminate(){
  running=false;
  interrupt();
}

Fixed version (ground truth):
public void terminate(){
  LOG.info("String_Node_Str",getName());
  running=false;
  interrupt();
}
Program: 7859
Project: 7859
Buggy source:
private void subscribe(){
  LOG.info("String_Node_Str");
  KafkaConsumer.Preparer preparer=kafkaClient.getConsumer().prepare();
  for (  MetricsScope scope : MetricsScope.values()) {
    String topic=topicPrefix + "String_Node_Str" + scope.name();
    for (int i=0; i < partitionSize; i++) {
      long offset=getOffset(topic,i);
      if (offset >= 0) {
        preparer.add(topic,i,offset);
      }
 else {
        preparer.addFromBeginning(topic,i);
      }
    }
    unsubscribes.add(preparer.consume(callbackFactory.create(metaTable,scope)));
    LOG.info("String_Node_Str",topic,partitionSize);
  }
  LOG.info("String_Node_Str");
}

Fixed version (ground truth):
private void subscribe(){
  LOG.info("String_Node_Str");
  for (  MetricsScope scope : MetricsScope.values()) {
    KafkaConsumer.Preparer preparer=kafkaClient.getConsumer().prepare();
    String topic=topicPrefix + "String_Node_Str" + scope.name();
    for (int i=0; i < partitionSize; i++) {
      long offset=getOffset(topic,i);
      if (offset >= 0) {
        preparer.add(topic,i,offset);
      }
 else {
        preparer.addFromBeginning(topic,i);
      }
    }
    unsubscribes.add(preparer.consume(callbackFactory.create(metaTable,scope)));
    LOG.info("String_Node_Str",topic,partitionSize);
  }
  LOG.info("String_Node_Str");
}
Program: 7860
Project: 7860
Buggy source:
@Override public void onReceived(Iterator<FetchedMessage> messages){
  final ByteBufferInputStream is=new ByteBufferInputStream(null);
  List<MetricsRecord> records=ImmutableList.copyOf(Iterators.filter(Iterators.transform(messages,new Function<FetchedMessage,MetricsRecord>(){
    @Override public MetricsRecord apply(    FetchedMessage input){
      try {
        return recordReader.read(new BinaryDecoder(is.reset(input.getPayload())),recordSchema);
      }
 catch (      IOException e) {
        LOG.warn("String_Node_Str",e.getMessage(),e);
        return null;
      }
    }
  }
),Predicates.notNull()));
  for (  MetricsProcessor processor : processors) {
    processor.process(scope,records.iterator());
  }
}

Fixed version (ground truth):
@Override public void onReceived(Iterator<FetchedMessage> messages){
  final ByteBufferInputStream is=new ByteBufferInputStream(null);
  List<MetricsRecord> records=ImmutableList.copyOf(Iterators.filter(Iterators.transform(messages,new Function<FetchedMessage,MetricsRecord>(){
    @Override public MetricsRecord apply(    FetchedMessage input){
      try {
        return recordReader.read(new BinaryDecoder(is.reset(input.getPayload())),recordSchema);
      }
 catch (      IOException e) {
        LOG.warn("String_Node_Str",e.getMessage(),e);
        return null;
      }
    }
  }
),Predicates.notNull()));
  if (records.isEmpty()) {
    LOG.info("String_Node_Str");
    return;
  }
  for (  MetricsProcessor processor : processors) {
    processor.process(scope,records.iterator());
  }
  recordProcessed+=records.size();
  if (recordProcessed % 1000 == 0) {
    LOG.info("String_Node_Str",scope,recordProcessed);
    LOG.info("String_Node_Str",records.get(records.size() - 1).getTimestamp());
  }
}
Program: 7861
Project: 7861
Buggy source:
private ConsumerThread(TopicPartition topicPart,long startOffset,MessageCallback callback){
  this.topicPart=topicPart;
  this.startOffset=startOffset;
  this.callback=callback;
  this.running=true;
  this.fetchedMessage=new BasicFetchedMessage(topicPart);
}

Fixed version (ground truth):
private ConsumerThread(TopicPartition topicPart,long startOffset,MessageCallback callback){
  super(String.format("String_Node_Str",topicPart.getTopic(),topicPart.getPartition()));
  this.topicPart=topicPart;
  this.startOffset=startOffset;
  this.callback=callback;
  this.running=true;
  this.fetchedMessage=new BasicFetchedMessage(topicPart);
}
Program: 7862
Project: 7862
Buggy source:
/** 
 * Makes a call to kafka to fetch messages.
 */
private FetchResponse fetchMessages(SimpleConsumer consumer,long offset){
  FetchRequest request=new FetchRequestBuilder().clientId(consumer.clientId()).addFetch(topicPart.getTopic(),topicPart.getPartition(),offset,FETCH_SIZE).build();
  return consumer.fetch(request);
}

Fixed version (ground truth):
/** 
 * Makes a call to kafka to fetch messages.
 */
private FetchResponse fetchMessages(SimpleConsumer consumer,long offset){
  FetchRequest request=new FetchRequestBuilder().clientId(consumer.clientId()).addFetch(topicPart.getTopic(),topicPart.getPartition(),offset,FETCH_SIZE).maxWait(1000).build();
  return consumer.fetch(request);
}
Program: 7863
Project: 7863
Buggy source:
public void terminate(){
  running=false;
  interrupt();
}

Fixed version (ground truth):
public void terminate(){
  LOG.info("String_Node_Str",getName());
  running=false;
  interrupt();
}
Program: 7864
Project: 7864
Buggy source:
private void subscribe(){
  LOG.info("String_Node_Str");
  KafkaConsumer.Preparer preparer=kafkaClient.getConsumer().prepare();
  for (  MetricsScope scope : MetricsScope.values()) {
    String topic=topicPrefix + "String_Node_Str" + scope.name();
    for (int i=0; i < partitionSize; i++) {
      long offset=getOffset(topic,i);
      if (offset >= 0) {
        preparer.add(topic,i,offset);
      }
 else {
        preparer.addFromBeginning(topic,i);
      }
    }
    unsubscribes.add(preparer.consume(callbackFactory.create(metaTable,scope)));
    LOG.info("String_Node_Str",topic,partitionSize);
  }
  LOG.info("String_Node_Str");
}

Fixed version (ground truth):
private void subscribe(){
  LOG.info("String_Node_Str");
  for (  MetricsScope scope : MetricsScope.values()) {
    KafkaConsumer.Preparer preparer=kafkaClient.getConsumer().prepare();
    String topic=topicPrefix + "String_Node_Str" + scope.name();
    for (int i=0; i < partitionSize; i++) {
      long offset=getOffset(topic,i);
      if (offset >= 0) {
        preparer.add(topic,i,offset);
      }
 else {
        preparer.addFromBeginning(topic,i);
      }
    }
    unsubscribes.add(preparer.consume(callbackFactory.create(metaTable,scope)));
    LOG.info("String_Node_Str",topic,partitionSize);
  }
  LOG.info("String_Node_Str");
}
Program: 7865
Project: 7865
Buggy source:
@Override public void onReceived(Iterator<FetchedMessage> messages){
  final ByteBufferInputStream is=new ByteBufferInputStream(null);
  List<MetricsRecord> records=ImmutableList.copyOf(Iterators.filter(Iterators.transform(messages,new Function<FetchedMessage,MetricsRecord>(){
    @Override public MetricsRecord apply(    FetchedMessage input){
      try {
        return recordReader.read(new BinaryDecoder(is.reset(input.getPayload())),recordSchema);
      }
 catch (      IOException e) {
        LOG.warn("String_Node_Str",e.getMessage(),e);
        return null;
      }
    }
  }
),Predicates.notNull()));
  for (  MetricsProcessor processor : processors) {
    processor.process(scope,records.iterator());
  }
}

Fixed version (ground truth):
@Override public void onReceived(Iterator<FetchedMessage> messages){
  final ByteBufferInputStream is=new ByteBufferInputStream(null);
  List<MetricsRecord> records=ImmutableList.copyOf(Iterators.filter(Iterators.transform(messages,new Function<FetchedMessage,MetricsRecord>(){
    @Override public MetricsRecord apply(    FetchedMessage input){
      try {
        return recordReader.read(new BinaryDecoder(is.reset(input.getPayload())),recordSchema);
      }
 catch (      IOException e) {
        LOG.warn("String_Node_Str",e.getMessage(),e);
        return null;
      }
    }
  }
),Predicates.notNull()));
  if (records.isEmpty()) {
    LOG.info("String_Node_Str");
    return;
  }
  for (  MetricsProcessor processor : processors) {
    processor.process(scope,records.iterator());
  }
  recordProcessed+=records.size();
  if (recordProcessed % 1000 == 0) {
    LOG.info("String_Node_Str",scope,recordProcessed);
    LOG.info("String_Node_Str",records.get(records.size() - 1).getTimestamp());
  }
}
Program: 7866
Project: 7866
Buggy source:
@Override public void cancel(){
  if (!cancelled.compareAndSet(false,true)) {
    return;
  }
  consumerCancels.remove(this);
  for (  ConsumerThread consumerThread : pollers) {
    consumerThread.terminate();
  }
  for (  ConsumerThread consumerThread : pollers) {
    try {
      consumerThread.join();
    }
 catch (    InterruptedException e) {
      LOG.warn("String_Node_Str",e);
    }
  }
  executor.shutdown();
}

Fixed version (ground truth):
@Override public void cancel(){
  if (!cancelled.compareAndSet(false,true)) {
    return;
  }
  consumerCancels.remove(this);
  LOG.info("String_Node_Str");
  for (  ConsumerThread consumerThread : pollers) {
    consumerThread.terminate();
  }
  LOG.info("String_Node_Str");
  for (  ConsumerThread consumerThread : pollers) {
    try {
      consumerThread.join();
    }
 catch (    InterruptedException e) {
      LOG.warn("String_Node_Str",e);
    }
  }
  LOG.info("String_Node_Str");
  executor.shutdown();
}
Program: 7867
Project: 7867
Buggy source:
@Override public Cancellable consume(MessageCallback callback){
  final ExecutorService executor=Executors.newSingleThreadExecutor(threadFactory);
  final List<ConsumerThread> pollers=Lists.newArrayList();
  final AtomicBoolean cancelled=new AtomicBoolean();
  Cancellable cancellable=new Cancellable(){
    @Override public void cancel(){
      if (!cancelled.compareAndSet(false,true)) {
        return;
      }
      consumerCancels.remove(this);
      for (      ConsumerThread consumerThread : pollers) {
        consumerThread.terminate();
      }
      for (      ConsumerThread consumerThread : pollers) {
        try {
          consumerThread.join();
        }
 catch (        InterruptedException e) {
          LOG.warn("String_Node_Str",e);
        }
      }
      executor.shutdown();
    }
  }
;
  MessageCallback messageCallback=wrapCallback(callback,executor,cancellable);
  for (  Map.Entry<TopicPartition,Long> entry : requests.entrySet()) {
    ConsumerThread consumerThread=new ConsumerThread(entry.getKey(),entry.getValue(),messageCallback);
    consumerThread.setDaemon(true);
    consumerThread.start();
    pollers.add(consumerThread);
  }
  consumerCancels.add(cancellable);
  return cancellable;
}

Fixed version (ground truth):
@Override public Cancellable consume(MessageCallback callback){
  final ExecutorService executor=Executors.newSingleThreadExecutor(threadFactory);
  final List<ConsumerThread> pollers=Lists.newArrayList();
  final AtomicBoolean cancelled=new AtomicBoolean();
  Cancellable cancellable=new Cancellable(){
    @Override public void cancel(){
      if (!cancelled.compareAndSet(false,true)) {
        return;
      }
      consumerCancels.remove(this);
      LOG.info("String_Node_Str");
      for (      ConsumerThread consumerThread : pollers) {
        consumerThread.terminate();
      }
      LOG.info("String_Node_Str");
      for (      ConsumerThread consumerThread : pollers) {
        try {
          consumerThread.join();
        }
 catch (        InterruptedException e) {
          LOG.warn("String_Node_Str",e);
        }
      }
      LOG.info("String_Node_Str");
      executor.shutdown();
    }
  }
;
  MessageCallback messageCallback=wrapCallback(callback,executor,cancellable);
  for (  Map.Entry<TopicPartition,Long> entry : requests.entrySet()) {
    ConsumerThread consumerThread=new ConsumerThread(entry.getKey(),entry.getValue(),messageCallback);
    consumerThread.setDaemon(true);
    consumerThread.start();
    pollers.add(consumerThread);
  }
  consumerCancels.add(cancellable);
  return cancellable;
}
Program: 7868
Project: 7868
Buggy source:
@Override public void run(){
  final AtomicLong offset=new AtomicLong(startOffset);
  Map.Entry<BrokerInfo,SimpleConsumer> consumerEntry=null;
  Throwable errorCause=null;
  while (running) {
    if (consumerEntry == null && (consumerEntry=getConsumerEntry()) == null) {
      LOG.error("String_Node_Str",topicPart,FAILURE_RETRY_INTERVAL);
      Uninterruptibles.sleepUninterruptibly(FAILURE_RETRY_INTERVAL,TimeUnit.MILLISECONDS);
      continue;
    }
    SimpleConsumer consumer=consumerEntry.getValue();
    FetchResponse response=fetchMessages(consumer,offset.get());
    if (response.hasError()) {
      short errorCode=response.errorCode(topicPart.getTopic(),topicPart.getPartition());
      LOG.info("String_Node_Str",topicPart,errorCode);
      if (errorCode == ErrorMapping.OffsetOutOfRangeCode()) {
        errorCause=new OffsetOutOfRangeException("String_Node_Str" + offset.get());
        break;
      }
      consumers.refresh(consumerEntry.getKey());
      consumerEntry=null;
      continue;
    }
    ByteBufferMessageSet messages=response.messageSet(topicPart.getTopic(),topicPart.getPartition());
    if (sleepIfEmpty(messages)) {
      continue;
    }
    invokeCallback(messages,offset);
  }
  try {
    callback.finished(running,errorCause);
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",running,t);
  }
}

Fixed version (ground truth):
@Override public void run(){
  final AtomicLong offset=new AtomicLong(startOffset);
  Map.Entry<BrokerInfo,SimpleConsumer> consumerEntry=null;
  Throwable errorCause=null;
  while (running) {
    if (consumerEntry == null && (consumerEntry=getConsumerEntry()) == null) {
      try {
        TimeUnit.MICROSECONDS.sleep(CONSUMER_FAILER_RETRY_INTERVAL);
      }
 catch (      InterruptedException e) {
        LOG.debug("String_Node_Str",e);
      }
      continue;
    }
    SimpleConsumer consumer=consumerEntry.getValue();
    FetchResponse response=fetchMessages(consumer,offset.get());
    if (response.hasError()) {
      short errorCode=response.errorCode(topicPart.getTopic(),topicPart.getPartition());
      LOG.info("String_Node_Str",topicPart,errorCode);
      if (errorCode == ErrorMapping.OffsetOutOfRangeCode()) {
        errorCause=new OffsetOutOfRangeException("String_Node_Str" + offset.get());
        break;
      }
      consumers.refresh(consumerEntry.getKey());
      consumerEntry=null;
      continue;
    }
    ByteBufferMessageSet messages=response.messageSet(topicPart.getTopic(),topicPart.getPartition());
    if (sleepIfEmpty(messages)) {
      continue;
    }
    invokeCallback(messages,offset);
  }
  try {
    callback.finished(running,errorCause);
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",running,t);
  }
}
Program: 7869
Project: 7869
Buggy source:
private void subscribe(){
  KafkaConsumer.Preparer preparer=kafkaClient.getConsumer().prepare();
  for (  MetricsScope scope : MetricsScope.values()) {
    String topic=topicPrefix + "String_Node_Str" + scope.name();
    for (int i=0; i < partitionSize; i++) {
      long offset=getOffset(topic,i);
      if (offset >= 0) {
        preparer.add(topic,i,offset);
      }
 else {
        preparer.addFromBeginning(topic,i);
      }
    }
    unsubscribes.add(preparer.consume(callbackFactory.create(metaTable,scope)));
    LOG.info("String_Node_Str",topic);
  }
}

Fixed version (ground truth):
private void subscribe(){
  LOG.info("String_Node_Str");
  KafkaConsumer.Preparer preparer=kafkaClient.getConsumer().prepare();
  for (  MetricsScope scope : MetricsScope.values()) {
    String topic=topicPrefix + "String_Node_Str" + scope.name();
    for (int i=0; i < partitionSize; i++) {
      long offset=getOffset(topic,i);
      if (offset >= 0) {
        preparer.add(topic,i,offset);
      }
 else {
        preparer.addFromBeginning(topic,i);
      }
    }
    unsubscribes.add(preparer.consume(callbackFactory.create(metaTable,scope)));
    LOG.info("String_Node_Str",topic,partitionSize);
  }
  LOG.info("String_Node_Str");
}
Program: 7870
Project: 7870
Buggy source:
private long getOffset(String topic,int partition){
  try {
    return metaTable.get(new TopicPartition(topic,partition));
  }
 catch (  OperationException e) {
    LOG.error("String_Node_Str",e.getMessage(),e);
  }
  return -1;
}

Fixed version (ground truth):
private long getOffset(String topic,int partition){
  LOG.info("String_Node_Str",topic,partition);
  try {
    long offset=metaTable.get(new TopicPartition(topic,partition));
    LOG.info("String_Node_Str",topic,partition,offset);
    return offset;
  }
 catch (  OperationException e) {
    LOG.error("String_Node_Str",e.getMessage(),e);
  }
  return -1L;
}
Program: 7871
Project: 7871
Buggy source:
private void checkPoint(boolean force) throws IOException, OperationException {
  long currentTs=System.currentTimeMillis();
  if (!force && currentTs - lastCheckpointTime < checkpointIntervalMs) {
    return;
  }
  long checkpointOffset=Long.MAX_VALUE;
  Set<String> files=Sets.newHashSetWithExpectedSize(fileMap.size());
  for (Iterator<Map.Entry<String,AvroFile>> it=fileMap.entrySet().iterator(); it.hasNext(); ) {
    AvroFile avroFile=it.next().getValue();
    avroFile.flush();
    if (currentTs - avroFile.getLastModifiedTs() > inactiveIntervalMs) {
      avroFile.close();
      it.remove();
    }
    files.add(avroFile.getPath().toUri().toString());
    if (checkpointOffset > avroFile.getMaxOffsetSeen()) {
      checkpointOffset=avroFile.getMaxOffsetSeen();
    }
  }
  if (checkpointOffset != Long.MAX_VALUE) {
    checkpointManager.saveCheckpoint(new CheckpointInfo(checkpointOffset,files));
  }
  lastCheckpointTime=currentTs;
}

Fixed version (ground truth):
private void checkPoint(boolean force) throws IOException, OperationException {
  long currentTs=System.currentTimeMillis();
  if (!force && currentTs - lastCheckpointTime < checkpointIntervalMs) {
    return;
  }
  long checkpointOffset=Long.MAX_VALUE;
  Set<String> files=Sets.newHashSetWithExpectedSize(fileMap.size());
  for (Iterator<Map.Entry<String,AvroFile>> it=fileMap.entrySet().iterator(); it.hasNext(); ) {
    AvroFile avroFile=it.next().getValue();
    avroFile.flush();
    if (currentTs - avroFile.getLastModifiedTs() > inactiveIntervalMs) {
      avroFile.close();
      it.remove();
    }
    files.add(avroFile.getPath().toUri().toString());
    if (checkpointOffset > avroFile.getMaxOffsetSeen()) {
      checkpointOffset=avroFile.getMaxOffsetSeen();
    }
  }
  if (checkpointOffset != Long.MAX_VALUE) {
    LOG.info(String.format("String_Node_Str",checkpointOffset,files.size()));
    checkpointManager.saveCheckpoint(new CheckpointInfo(checkpointOffset,files));
  }
  lastCheckpointTime=currentTs;
}
Program: 7872
Project: 7872
Buggy source:
@Override public void close() throws IOException {
  if (dataFileWriter != null) {
    dataFileWriter.close();
  }
  if (outputStream != null) {
    outputStream.close();
  }
}

Fixed version (ground truth):
@Override public void close() throws IOException {
  try {
    if (dataFileWriter != null) {
      dataFileWriter.close();
    }
  }
  finally {
    if (outputStream != null) {
      outputStream.close();
    }
  }
}
Program: 7873
Project: 7873
Buggy source:
private void rotateFile(AvroFile avroFile,LoggingContext loggingContext,long timestamp) throws IOException, OperationException {
  if (avroFile.getPos() > maxFileSize) {
    avroFile.close();
    createAvroFile(loggingContext,timestamp);
    checkPoint(true);
  }
}

Fixed version (ground truth):
private void rotateFile(AvroFile avroFile,LoggingContext loggingContext,long timestamp) throws IOException, OperationException {
  if (avroFile.getPos() > maxFileSize) {
    LOG.info(String.format("String_Node_Str",avroFile.getPath()));
    avroFile.close();
    createAvroFile(loggingContext,timestamp);
    checkPoint(true);
  }
}
Program: 7875
Project: 7875
Buggy source:
@Override public void stop(){
  weaveController.stopAndWait();
}

Fixed version (ground truth):
@Override public void stop(){
  if (weaveController != null) {
    weaveController.stopAndWait();
  }
}
Program: 7876
Project: 7876
Buggy source:
@Override public void destroy(){
  weaveRunnerService.stopAndWait();
}

Fixed version (ground truth):
@Override public void destroy(){
  if (weaveRunnerService != null) {
    weaveRunnerService.stopAndWait();
  }
}
Program: 7877
Project: 7877
Buggy source:
/** 
 * Returns a list of log files for a logging context.
 * @param loggingContext logging context.
 * @return Sorted map containing key as start time, and value as log file.
 * @throws OperationException
 */
public SortedMap<Long,Path> listFiles(LoggingContext loggingContext) throws OperationException {
  OperationResult<Map<byte[],byte[]>> cols=opex.execute(operationContext,new ReadColumnRange(Bytes.add(ROW_KEY_PREFIX,Bytes.toBytes(loggingContext.getLogPartition())),Bytes.toBytes(0)));
  if (cols.isEmpty() || cols.getValue() != null) {
    return ImmutableSortedMap.of();
  }
  SortedMap<Long,Path> files=Maps.newTreeMap();
  for (  Map.Entry<byte[],byte[]> entry : cols.getValue().entrySet()) {
    files.put(Bytes.toLong(entry.getKey()),new Path(Bytes.toString(entry.getValue())));
  }
  return files;
}

Fixed version (ground truth):
/** 
 * Returns a list of log files for a logging context.
 * @param loggingContext logging context.
 * @return Sorted map containing key as start time, and value as log file.
 * @throws OperationException
 */
public SortedMap<Long,Path> listFiles(LoggingContext loggingContext) throws OperationException {
  OperationResult<Map<byte[],byte[]>> cols=opex.execute(operationContext,new ReadColumnRange(table,Bytes.add(ROW_KEY_PREFIX,Bytes.toBytes(loggingContext.getLogPartition())),null,null));
  if (cols.isEmpty() || cols.getValue() == null) {
    return ImmutableSortedMap.of();
  }
  SortedMap<Long,Path> files=Maps.newTreeMap();
  for (  Map.Entry<byte[],byte[]> entry : cols.getValue().entrySet()) {
    files.put(Bytes.toLong(entry.getKey()),new Path(Bytes.toString(entry.getValue())));
  }
  return files;
}
Program: 7878
Project: 7878
Buggy source:
public synchronized static int getTracker(String table,String op){
  String key=table + "String_Node_Str" + op;
  String value=System.getProperty(key,"String_Node_Str");
  return Integer.valueOf(value);
}

Fixed version (ground truth):
public static synchronized int getTracker(String table,String op){
  String key=table + "String_Node_Str" + op;
  String value=System.getProperty(key,"String_Node_Str");
  return Integer.valueOf(value);
}
Program: 7879
Project: 7879
Buggy source:
private synchronized static void track(String table,String op){
  String key=table + "String_Node_Str" + op;
  String value=System.getProperty(key,"String_Node_Str");
  String newValue=Integer.toString(Integer.valueOf(value) + 1);
  System.setProperty(key,newValue);
}

Fixed version (ground truth):
private static synchronized void track(String table,String op){
  String key=table + "String_Node_Str" + op;
  String value=System.getProperty(key,"String_Node_Str");
  String newValue=Integer.toString(Integer.valueOf(value) + 1);
  System.setProperty(key,newValue);
}
Program: 7880
Project: 7880
Buggy source:
public synchronized static void resetTracker(){
  for (  String table : Arrays.asList("String_Node_Str","String_Node_Str")) {
    for (    String op : Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str")) {
      String key=table + "String_Node_Str" + op;
      System.clearProperty(key);
    }
  }
}

Fixed version (ground truth):
public static synchronized void resetTracker(){
  for (  String table : Arrays.asList("String_Node_Str","String_Node_Str")) {
    for (    String op : Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str")) {
      String key=table + "String_Node_Str" + op;
      System.clearProperty(key);
    }
  }
}
Program: 7881
Project: 7881
Buggy source:
@Override public Flow makeFromEntry(MetaDataEntry entry){
  Flow fl=new Flow(entry.getId(),entry.getApplication());
  fl.setName(entry.getTextField(FieldTypes.Flow.NAME));
  fl.setStreams(StringToList(entry.getTextField(FieldTypes.Flow.STREAMS)));
  fl.setDatasets(StringToList(entry.getTextField(FieldTypes.Flow.DATASETS)));
  return fl;
}

Fixed version (ground truth):
@Override public Flow makeFromEntry(MetaDataEntry entry){
  Flow fl=new Flow(entry.getId(),entry.getApplication());
  fl.setName(entry.getTextField(FieldTypes.Flow.NAME));
  fl.setStreams(stringToList(entry.getTextField(FieldTypes.Flow.STREAMS)));
  fl.setDatasets(stringToList(entry.getTextField(FieldTypes.Flow.DATASETS)));
  return fl;
}
Program: 7882
Project: 7882
Buggy source:
@Override public MetaDataEntry makeEntry(Account account,Flow flow){
  MetaDataEntry entry=new MetaDataEntry(account.getId(),flow.getApplication(),FieldTypes.Flow.ID,flow.getId());
  entry.addField(FieldTypes.Flow.NAME,flow.getName());
  entry.addField(FieldTypes.Flow.STREAMS,ListToString(flow.getStreams()));
  entry.addField(FieldTypes.Flow.DATASETS,ListToString(flow.getDatasets()));
  return entry;
}

Fixed version (ground truth):
@Override public MetaDataEntry makeEntry(Account account,Flow flow){
  MetaDataEntry entry=new MetaDataEntry(account.getId(),flow.getApplication(),FieldTypes.Flow.ID,flow.getId());
  entry.addField(FieldTypes.Flow.NAME,flow.getName());
  entry.addField(FieldTypes.Flow.STREAMS,listToString(flow.getStreams()));
  entry.addField(FieldTypes.Flow.DATASETS,listToString(flow.getDatasets()));
  return entry;
}
Program: 7883
Project: 7883
Buggy source:
@Override public List<Mapreduce> getMapreducesByDataset(String account,String dataset) throws MetadataServiceException, TException {
  validateAccount(account);
  List<Mapreduce> mapreduces=getMapreduces(new Account(account));
  List<Mapreduce> queriesForDS=Lists.newLinkedList();
  for (  Mapreduce mapreduce : mapreduces) {
    if (mapreduce.getDatasets().contains(dataset))     queriesForDS.add(mapreduce);
  }
  return queriesForDS;
}

Fixed version (ground truth):
@Override public List<Mapreduce> getMapreducesByDataset(String account,String dataset) throws MetadataServiceException, TException {
  validateAccount(account);
  List<Mapreduce> mapreduces=getMapreduces(new Account(account));
  List<Mapreduce> queriesForDS=Lists.newLinkedList();
  for (  Mapreduce mapreduce : mapreduces) {
    if (mapreduce.getDatasets().contains(dataset)) {
      queriesForDS.add(mapreduce);
    }
  }
  return queriesForDS;
}
Program: 7886
Project: 7886
Buggy source:
private static AppFabricService.Client getAppFabricClient() throws TTransportException {
  CConfiguration config=CConfiguration.create();
  return new AppFabricService.Client(getThriftProtocol(config.get(Constants.CFG_APP_FABRIC_SERVER_ADDRESS,Constants.DEFAULT_APP_FABRIC_SERVER_ADDRESS),config.getInt(Constants.CFG_APP_FABRIC_SERVER_PORT,Constants.DEFAULT_APP_FABRIC_SERVER_PORT)));
}

Fixed version (ground truth):
private static AppFabricService.Client getAppFabricClient() throws TTransportException {
  CConfiguration config=CConfiguration.create();
  String host=config.get(Constants.CFG_APP_FABRIC_SERVER_ADDRESS,Constants.DEFAULT_APP_FABRIC_SERVER_ADDRESS);
  int port=config.getInt(Constants.CFG_APP_FABRIC_SERVER_PORT,Constants.DEFAULT_APP_FABRIC_SERVER_PORT);
  return new AppFabricService.Client(getThriftProtocol(config.get(Constants.CFG_APP_FABRIC_SERVER_ADDRESS,Constants.DEFAULT_APP_FABRIC_SERVER_ADDRESS),config.getInt(Constants.CFG_APP_FABRIC_SERVER_PORT,Constants.DEFAULT_APP_FABRIC_SERVER_PORT)));
}
Program: 7887
Project: 7887
Buggy source:
private void beforeClass() throws ClassNotFoundException {
  init(config);
  Context runManager=Context.getInstance(this);
  Class<? extends Application>[] apps=getApplications(testClass);
  if (apps != null && apps.length != 0) {
    for (    Class<? extends Application> each : apps) {
      appManager=deployApplication(each);
      runManager.addApplicationManager(each.getSimpleName(),appManager);
    }
  }
  if ("String_Node_Str".equalsIgnoreCase(config.get("String_Node_Str"))) {
    String metrics=config.get("String_Node_Str");
    if (StringUtils.isNotEmpty(metrics)) {
      List<String> metricList=ImmutableList.copyOf(metrics.replace("String_Node_Str","String_Node_Str").split("String_Node_Str"));
      String tags="String_Node_Str";
      int interval=10;
      if (StringUtils.isNotEmpty(config.get("String_Node_Str"))) {
        interval=Integer.valueOf(config.get("String_Node_Str"));
      }
      Context.report(metricList,tags,interval);
    }
  }
}

Fixed version (ground truth):
private void beforeClass() throws ClassNotFoundException {
  init(config);
  Context runManager=Context.getInstance(this);
  Class<? extends Application>[] apps=getApplications(testClass);
  if (apps != null && apps.length != 0) {
    clearAppFabric();
    for (    Class<? extends Application> each : apps) {
      appManager=deployApplication(each);
      runManager.addApplicationManager(each.getSimpleName(),appManager);
    }
  }
  if ("String_Node_Str".equalsIgnoreCase(config.get("String_Node_Str"))) {
    String metrics=config.get("String_Node_Str");
    if (StringUtils.isNotEmpty(metrics)) {
      List<String> metricList=ImmutableList.copyOf(metrics.replace("String_Node_Str","String_Node_Str").split("String_Node_Str"));
      String tags="String_Node_Str";
      int interval=10;
      if (StringUtils.isNotEmpty(config.get("String_Node_Str"))) {
        interval=Integer.valueOf(config.get("String_Node_Str"));
      }
      Context.report(metricList,tags,interval);
    }
  }
}
Program: 7889
Project: 7889
Buggy source:
public ApplicationManager deployApplication(Class<? extends Application> applicationClz){
  Preconditions.checkNotNull(applicationClz,"String_Node_Str");
  Application application;
  try {
    application=applicationClz.newInstance();
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
  ApplicationSpecification appSpec=application.configure();
  final String applicationId=appSpec.getName();
  File jarFile=createDeploymentJar(applicationClz,appSpec);
  LOG.debug("String_Node_Str",jarFile.getAbsolutePath());
  Location deployedJar=locationFactory.create(jarFile.getAbsolutePath());
  try {
    final AuthToken token=new AuthToken("String_Node_Str");
    ResourceIdentifier id=appFabricServer.init(token,new ResourceInfo(accountId,"String_Node_Str",applicationId,0,System.currentTimeMillis()));
    BufferFileInputStream is=new BufferFileInputStream(deployedJar.getInputStream(),100 * 1024);
    try {
      byte[] chunk=is.read();
      while (chunk.length > 0) {
        appFabricServer.chunk(token,id,ByteBuffer.wrap(chunk));
        chunk=is.read();
        DeploymentStatus status=appFabricServer.dstatus(token,id);
        Preconditions.checkState(status.getOverall() == 2,"String_Node_Str");
      }
    }
  finally {
      is.close();
    }
    appFabricServer.deploy(token,id);
    int status=appFabricServer.dstatus(token,id).getOverall();
    while (status == 3) {
      status=appFabricServer.dstatus(token,id).getOverall();
      TimeUnit.MILLISECONDS.sleep(100);
    }
    Preconditions.checkState(status == 5,"String_Node_Str");
    ApplicationManager appManager=(ApplicationManager)injector.getInstance(BenchmarkManagerFactory.class).create(token,accountId,applicationId,appFabricServer,deployedJar,appSpec);
    Preconditions.checkNotNull(appManager,"String_Node_Str");
    LOG.debug("String_Node_Str",jarFile.getAbsolutePath());
    return appManager;
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",jarFile.getAbsolutePath());
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
public ApplicationManager deployApplication(Class<? extends Application> applicationClz){
  Preconditions.checkNotNull(applicationClz,"String_Node_Str");
  try {
    ApplicationSpecification appSpec=applicationClz.newInstance().configure();
    Location deployedJar=TestHelper.deployApplication(appFabricServer,locationFactory,new Id.Account(accountId),TestHelper.DUMMY_AUTH_TOKEN,"String_Node_Str",appSpec.getName(),applicationClz);
    return injector.getInstance(BenchmarkManagerFactory.class).create(TestHelper.DUMMY_AUTH_TOKEN,accountId,appSpec.getName(),appFabricServer,deployedJar,appSpec);
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
}
Program: 7890
Project: 7890
Buggy source:
@Override public synchronized RuntimeInfo lookup(final RunId runId){
  RuntimeInfo runtimeInfo=super.lookup(runId);
  if (runtimeInfo != null) {
    return runtimeInfo;
  }
  Optional<WeaveRunner.LiveInfo> result=Iterables.tryFind(weaveRunner.lookupLive(),new Predicate<WeaveRunner.LiveInfo>(){
    @Override public boolean apply(    WeaveRunner.LiveInfo input){
      return Iterables.indexOf(input.getRunIds(),Predicates.equalTo(runId)) != -1;
    }
  }
);
  if (!result.isPresent()) {
    LOG.info("String_Node_Str",runId);
    return null;
  }
  WeaveRunner.LiveInfo liveInfo=result.get();
  String appName=liveInfo.getApplicationName();
  Matcher matcher=APP_NAME_PATTERN.matcher(appName);
  if (!matcher.matches()) {
    LOG.warn("String_Node_Str",appName);
    return null;
  }
  Type type=getType(matcher.group(1));
  if (type == null) {
    LOG.warn("String_Node_Str",appName);
    return null;
  }
  Id.Program programId=Id.Program.from(matcher.group(2),matcher.group(3),matcher.group(4));
  WeaveController weaveController=weaveRunner.lookup(appName,runId);
  if (weaveController == null) {
    LOG.info("String_Node_Str",runId);
    return null;
  }
  return createRuntimeInfo(type,programId,weaveController);
}

Fixed version (ground truth):
@Override public synchronized RuntimeInfo lookup(final RunId runId){
  RuntimeInfo runtimeInfo=super.lookup(runId);
  if (runtimeInfo != null) {
    return runtimeInfo;
  }
  Optional<WeaveRunner.LiveInfo> result=Iterables.tryFind(weaveRunner.lookupLive(),new Predicate<WeaveRunner.LiveInfo>(){
    @Override public boolean apply(    WeaveRunner.LiveInfo input){
      return Iterables.indexOf(input.getRunIds(),Predicates.equalTo(runId)) != -1;
    }
  }
);
  if (!result.isPresent()) {
    LOG.info("String_Node_Str",runId);
    return null;
  }
  WeaveRunner.LiveInfo liveInfo=result.get();
  String appName=liveInfo.getApplicationName();
  Matcher matcher=APP_NAME_PATTERN.matcher(appName);
  if (!matcher.matches()) {
    LOG.warn("String_Node_Str",appName);
    return null;
  }
  Type type=getType(matcher.group(1));
  if (type == null) {
    LOG.warn("String_Node_Str",appName);
    return null;
  }
  Id.Program programId=Id.Program.from(matcher.group(2),matcher.group(3),matcher.group(4));
  WeaveController weaveController=weaveRunner.lookup(appName,runId);
  if (weaveController == null) {
    LOG.info("String_Node_Str",runId);
    return null;
  }
  runtimeInfo=createRuntimeInfo(type,programId,weaveController);
  updateRuntimeInfo(type,runId,runtimeInfo);
  return runtimeInfo;
}
Program: 7891
Project: 7891
Buggy source:
@Override public synchronized Map<RunId,RuntimeInfo> list(Type type){
  Map<RunId,RuntimeInfo> result=Maps.newHashMap();
  result.putAll(super.list(type));
  for (  WeaveRunner.LiveInfo liveInfo : weaveRunner.lookupLive()) {
    String appName=liveInfo.getApplicationName();
    Matcher matcher=APP_NAME_PATTERN.matcher(appName);
    if (!matcher.matches()) {
      continue;
    }
    Type appType=getType(matcher.group(1));
    if (appType != type) {
      continue;
    }
    for (    RunId runId : liveInfo.getRunIds()) {
      if (result.containsKey(runId)) {
        continue;
      }
      Id.Program programId=Id.Program.from(matcher.group(2),matcher.group(3),matcher.group(4));
      WeaveController weaveController=weaveRunner.lookup(appName,runId);
      if (weaveController != null) {
        result.put(runId,createRuntimeInfo(type,programId,weaveController));
      }
    }
  }
  return ImmutableMap.copyOf(result);
}

Fixed version (ground truth):
@Override public synchronized Map<RunId,RuntimeInfo> list(Type type){
  Map<RunId,RuntimeInfo> result=Maps.newHashMap();
  result.putAll(super.list(type));
  for (  WeaveRunner.LiveInfo liveInfo : weaveRunner.lookupLive()) {
    String appName=liveInfo.getApplicationName();
    Matcher matcher=APP_NAME_PATTERN.matcher(appName);
    if (!matcher.matches()) {
      continue;
    }
    Type appType=getType(matcher.group(1));
    if (appType != type) {
      continue;
    }
    for (    RunId runId : liveInfo.getRunIds()) {
      if (result.containsKey(runId)) {
        continue;
      }
      Id.Program programId=Id.Program.from(matcher.group(2),matcher.group(3),matcher.group(4));
      WeaveController weaveController=weaveRunner.lookup(appName,runId);
      if (weaveController != null) {
        RuntimeInfo runtimeInfo=createRuntimeInfo(type,programId,weaveController);
        result.put(runId,runtimeInfo);
        updateRuntimeInfo(type,runId,runtimeInfo);
      }
    }
  }
  return ImmutableMap.copyOf(result);
}