nus-yam/ex-repair huggingface dataset:
Program: 7796
Project: 7796
Buggy source:
/** 
 * Wait for all inflight processes in the queue.
 * @param processQueue list of inflight processes
 */
@SuppressWarnings("String_Node_Str") private void waitForInflight(BlockingQueue<FlowletProcessEntry<?>> processQueue){
  List<FlowletProcessEntry> processList=Lists.newArrayListWithCapacity(processQueue.size());
  boolean hasRetry;
  do {
    hasRetry=false;
    processList.clear();
    processQueue.drainTo(processList);
    for (    FlowletProcessEntry<?> entry : processList) {
      if (!entry.isRetry()) {
        processQueue.offer(entry);
        continue;
      }
      hasRetry=true;
      ProcessMethod processMethod=entry.getProcessSpec().getProcessMethod();
      TransactionAgent txAgent=dataFabricFacade.createAndUpdateTransactionAgentProxy();
      try {
        txAgent.start();
        InputDatum input=entry.getProcessSpec().getQueueReader().dequeue();
        flowletContext.getSystemMetrics().gauge("String_Node_Str",1);
        ProcessMethod.ProcessResult result=processMethod.invoke(input,wrapInputDecoder(input,entry.getProcessSpec().getInputDecoder()));
        postProcess(transactionExecutor,processMethodCallback(processQueue,entry,input),txAgent,input,result);
      }
 catch (      Throwable t) {
        LOG.error("String_Node_Str",flowletContext,t);
        try {
          txAgent.abort();
        }
 catch (        OperationException e) {
          LOG.error("String_Node_Str",flowletContext,e);
        }
      }
    }
  }
 while (hasRetry || inflight.get() != 0);
}

Fixed version (ground truth):
/** 
 * Wait for all inflight processes in the queue.
 * @param processQueue list of inflight processes
 */
@SuppressWarnings("String_Node_Str") private void waitForInflight(BlockingQueue<FlowletProcessEntry<?>> processQueue){
  List<FlowletProcessEntry> processList=Lists.newArrayListWithCapacity(processQueue.size());
  boolean hasRetry;
  do {
    hasRetry=false;
    processList.clear();
    processQueue.drainTo(processList);
    for (    FlowletProcessEntry<?> entry : processList) {
      if (!entry.isRetry()) {
        processQueue.offer(entry);
        continue;
      }
      hasRetry=true;
      ProcessMethod processMethod=entry.getProcessSpec().getProcessMethod();
      TransactionAgent txAgent=dataFabricFacade.createAndUpdateTransactionAgentProxy();
      try {
        txAgent.start();
        InputDatum input=entry.getProcessSpec().getQueueReader().dequeue();
        flowletContext.getSystemMetrics().gauge("String_Node_Str",input.size());
        ProcessMethod.ProcessResult result=processMethod.invoke(input,wrapInputDecoder(input,entry.getProcessSpec().getInputDecoder()));
        postProcess(transactionExecutor,processMethodCallback(processQueue,entry,input),txAgent,input,result);
      }
 catch (      Throwable t) {
        LOG.error("String_Node_Str",flowletContext,t);
        try {
          txAgent.abort();
        }
 catch (        OperationException e) {
          LOG.error("String_Node_Str",flowletContext,e);
        }
      }
    }
  }
 while (hasRetry || inflight.get() != 0);
}
Program: 7797
Project: 7797
Buggy source:
@Override public void onSuccess(Object object,InputContext inputContext){
  try {
    flowletContext.getSystemMetrics().gauge("String_Node_Str",1);
    txCallback.onSuccess(object,inputContext);
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",flowletContext,t);
  }
 finally {
    enqueueEntry();
    inflight.decrementAndGet();
  }
}

Fixed version (ground truth):
@Override public void onSuccess(Object object,InputContext inputContext){
  try {
    flowletContext.getSystemMetrics().gauge("String_Node_Str",input.size());
    txCallback.onSuccess(object,inputContext);
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",flowletContext,t);
  }
 finally {
    enqueueEntry();
    inflight.decrementAndGet();
  }
}
Program: 7800
Project: 7800
Buggy source:
private Queue2Consumer createConsumer(Queue2Consumer oldConsumer){
  try {
    if (oldConsumer != null && oldConsumer instanceof Closeable) {
      ((Closeable)oldConsumer).close();
    }
  }
 catch (  IOException e) {
    LOG.warn("String_Node_Str",e);
  }
  try {
    return clientFactory.createConsumer(queueName,consumerConfig,numGroups);
  }
 catch (  IOException e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
private Queue2Consumer createConsumer(Queue2Consumer oldConsumer){
  try {
    if (oldConsumer != null && oldConsumer instanceof Closeable) {
      TransactionAgent txAgent=dataFabricFacade.createTransactionAgent();
      txAgent.start();
      try {
        ((Closeable)oldConsumer).close();
        txAgent.finish();
      }
 catch (      OperationException e) {
        LOG.warn("String_Node_Str");
        txAgent.abort();
      }
    }
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str",e);
  }
  try {
    return dataFabricFacade.createConsumer(queueName,consumerConfig,numGroups);
  }
 catch (  IOException e) {
    throw Throwables.propagate(e);
  }
}
Program: 7801
Project: 7801
Buggy source:
QueueConsumerSupplier(QueueClientFactory clientFactory,QueueName queueName,ConsumerConfig consumerConfig,int numGroups){
  this.clientFactory=clientFactory;
  this.queueName=queueName;
  this.consumerConfig=consumerConfig;
  this.numGroups=numGroups;
  this.consumer=createConsumer(null);
}

Fixed version (ground truth):
QueueConsumerSupplier(DataFabricFacade dataFabricFacade,QueueName queueName,ConsumerConfig consumerConfig,int numGroups){
  this.dataFabricFacade=dataFabricFacade;
  this.queueName=queueName;
  this.consumerConfig=consumerConfig;
  this.numGroups=numGroups;
  this.consumer=createConsumer(null);
}
Program: 7802
Project: 7802
Buggy source:
@Override public boolean commitTx() throws Exception {
  if (consumingEntries.isEmpty()) {
    return true;
  }
  byte[] stateContent=encodeStateColumn(ConsumerEntryState.PROCESSED);
  updateState(consumingEntries.keySet(),stateColumnName,stateContent);
  committed=true;
  return true;
}

Fixed version (ground truth):
@Override public boolean commitTx() throws Exception {
  if (consumingEntries.isEmpty()) {
    return true;
  }
  byte[] stateContent=encodeStateColumn(ConsumerEntryState.PROCESSED);
  updateState(consumingEntries.keySet(),stateColumnName,stateContent);
  commitCount+=consumingEntries.size();
  committed=true;
  return true;
}
Program: 7803
Project: 7803
Buggy source:
@Override public boolean rollbackTx() throws Exception {
  if (consumingEntries.isEmpty()) {
    return true;
  }
  entryCache.putAll(consumingEntries);
  if (!committed) {
    return true;
  }
  if (consumerConfig.getDequeueStrategy() == DequeueStrategy.FIFO && consumerConfig.getGroupSize() > 1) {
    byte[] stateContent=encodeStateColumn(ConsumerEntryState.CLAIMED);
    updateState(consumingEntries.keySet(),stateColumnName,stateContent);
  }
 else {
    undoState(consumingEntries.keySet(),stateColumnName);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean rollbackTx() throws Exception {
  if (consumingEntries.isEmpty()) {
    return true;
  }
  entryCache.putAll(consumingEntries);
  if (!committed) {
    return true;
  }
  commitCount-=consumingEntries.size();
  if (consumerConfig.getDequeueStrategy() == DequeueStrategy.FIFO && consumerConfig.getGroupSize() > 1) {
    byte[] stateContent=encodeStateColumn(ConsumerEntryState.CLAIMED);
    updateState(consumingEntries.keySet(),stateColumnName,stateContent);
  }
 else {
    undoState(consumingEntries.keySet(),stateColumnName);
  }
  return true;
}
Program: 7804
Project: 7804
Buggy source:
@Override public void postTxCommit(){
  commitCount++;
  if (commitCount >= EVICTION_LIMIT) {
    commitCount=0;
    queueEvictor.evict(transaction);
  }
}

Fixed version (ground truth):
@Override public void postTxCommit(){
  if (commitCount >= EVICTION_LIMIT) {
    commitCount=0;
    queueEvictor.evict(transaction);
  }
}
Program: 7805
Project: 7805
Buggy source:
public static byte[] getQueueRowPrefix(QueueName queueName){
  byte[] bytes=Arrays.copyOf(queueName.toBytes(),queueName.toBytes().length);
  int i=0;
  int j=bytes.length - 1;
  while (i < j) {
    byte tmp=bytes[i];
    bytes[i]=bytes[j];
    bytes[j]=tmp;
    i++;
    j--;
  }
  return bytes;
}

Fixed version (ground truth):
/** 
 * Returns a byte array representing prefix of a queue. The prefix is formed by first two bytes of MD5 of the queue name followed by the queue name.
 */
public static byte[] getQueueRowPrefix(QueueName queueName){
  byte[] queueBytes=queueName.toBytes();
  byte[] bytes=new byte[queueBytes.length + 2];
  Hashing.md5().hashBytes(queueBytes).writeBytesTo(bytes,0,2);
  System.arraycopy(queueBytes,0,bytes,2,queueBytes.length);
  return bytes;
}
Program: 7807
Project: 7807
Buggy source:
@Override public boolean accept(String className,final URL classUrl,URL classPathUrl){
  if (acceptClasses.contains(className)) {
    try {
      jarOutput.putNextEntry(new JarEntry(className.replace('.',File.separatorChar) + "String_Node_Str"));
      ByteStreams.copy(new InputSupplier<InputStream>(){
        @Override public InputStream getInput() throws IOException {
          return classUrl.openStream();
        }
      }
,jarOutput);
      return true;
    }
 catch (    IOException e) {
      throw Throwables.propagate(e);
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean accept(String className,final URL classUrl,URL classPathUrl){
  if (className.startsWith("String_Node_Str")) {
    try {
      jarOutput.putNextEntry(new JarEntry(className.replace('.',File.separatorChar) + "String_Node_Str"));
      InputStream inputStream=classUrl.openStream();
      try {
        int len=inputStream.read(buffer);
        while (len >= 0) {
          hasher.putBytes(buffer,0,len);
          jarOutput.write(buffer,0,len);
          len=inputStream.read(buffer);
        }
      }
  finally {
        inputStream.close();
      }
      return true;
    }
 catch (    IOException e) {
      throw Throwables.propagate(e);
    }
  }
  return false;
}
Program: 7808
Project: 7808
Buggy source:
private boolean isCommittedProcessed(KeyValue stateColumn,long readPointer,long[] excludes){
  long writePointer=Bytes.toLong(stateColumn.getBuffer(),stateColumn.getValueOffset(),Longs.BYTES);
  if (writePointer > readPointer || Arrays.binarySearch(excludes,writePointer) >= 0) {
    return false;
  }
  byte state=stateColumn.getBuffer()[stateColumn.getValueOffset() + Longs.BYTES + Ints.BYTES];
  return state == ConsumerEntryState.PROCESSED.getState();
}

Fixed version (ground truth):
private boolean isCommittedProcessed(KeyValue stateColumn,long readPointer,long[] excludes){
  long writePointer=Bytes.toLong(stateColumn.getBuffer(),stateColumn.getValueOffset(),LONG_SIZE);
  if (writePointer > readPointer || Arrays.binarySearch(excludes,writePointer) >= 0) {
    return false;
  }
  byte state=stateColumn.getBuffer()[stateColumn.getValueOffset() + LONG_SIZE + INT_SIZE];
  return state == ConsumerEntryState.PROCESSED.getState();
}
Program: 7809
Project: 7809
Buggy source:
/** 
 * Call the appropriate handler for handling the httprequest. 404 if path is not found. 405 if path is found but httpMethod does not match what's configured.
 * @param request instance of {@code HttpRequest}
 * @param responder instance of {@code HttpResponder} to handle the request.
 */
public void handle(HttpRequest request,HttpResponder responder){
  Map<String,String> groupValues=Maps.newHashMap();
  List<HttpResourceModel> resourceModels=patternRouter.getDestinations(request.getUri(),groupValues);
  HttpResourceModel httpResourceModel=getMatchedResourceModel(resourceModels,request.getMethod());
  if (httpResourceModel != null) {
    httpResourceModel.handle(request,responder,groupValues);
  }
 else   if (resourceModels.size() > 0) {
    responder.sendError(HttpResponseStatus.METHOD_NOT_ALLOWED,String.format("String_Node_Str",request.getUri()));
  }
 else {
    responder.sendError(HttpResponseStatus.NOT_FOUND,String.format("String_Node_Str",request.getUri()));
  }
}

Fixed version (ground truth):
/** 
 * Call the appropriate handler for handling the httprequest. 404 if path is not found. 405 if path is found but httpMethod does not match what's configured.
 * @param request instance of {@code HttpRequest}
 * @param responder instance of {@code HttpResponder} to handle the request.
 */
public void handle(HttpRequest request,HttpResponder responder){
  Map<String,String> groupValues=Maps.newHashMap();
  String path=request.getUri().split("String_Node_Str")[0];
  List<HttpResourceModel> resourceModels=patternRouter.getDestinations(path,groupValues);
  HttpResourceModel httpResourceModel=getMatchedResourceModel(resourceModels,request.getMethod());
  try {
    if (httpResourceModel != null) {
      httpResourceModel.handle(request,responder,groupValues);
    }
 else     if (resourceModels.size() > 0) {
      responder.sendError(HttpResponseStatus.METHOD_NOT_ALLOWED,String.format("String_Node_Str",request.getUri()));
    }
 else {
      responder.sendError(HttpResponseStatus.NOT_FOUND,String.format("String_Node_Str",request.getUri()));
    }
  }
 catch (  Throwable t) {
    responder.sendError(HttpResponseStatus.INTERNAL_SERVER_ERROR,String.format("String_Node_Str",t.getMessage()));
  }
}
Program: 7810
Project: 7810
Buggy source:
/** 
 * Handle http Request.
 * @param request  HttpRequest to be handled.
 * @param responder HttpResponder to write the response.
 * @param groupValues Values needed for the invocation.
 */
public void handle(HttpRequest request,HttpResponder responder,Map<String,String> groupValues){
  try {
    if (httpMethods.contains(request.getMethod())) {
      Object[] args=new Object[method.getParameterTypes().length];
      int index=0;
      args[index]=request;
      index++;
      args[index]=responder;
      if (method.getParameterTypes().length > 2) {
        Class<?>[] parameterTypes=method.getParameterTypes();
        for (        Map.Entry<String,String> entry : groupValues.entrySet()) {
          index++;
          args[index]=ConvertUtils.convert(entry.getValue(),parameterTypes[index]);
        }
      }
      method.invoke(handler,args);
    }
 else {
      responder.sendError(HttpResponseStatus.METHOD_NOT_ALLOWED,String.format("String_Node_Str",request.getUri()));
    }
  }
 catch (  Throwable e) {
    LOG.error("String_Node_Str",request.getUri(),e,e);
    responder.sendError(HttpResponseStatus.INTERNAL_SERVER_ERROR,String.format("String_Node_Str",request.getUri()));
  }
}

Fixed version (ground truth):
/** 
 * Handle http Request.
 * @param request  HttpRequest to be handled.
 * @param responder HttpResponder to write the response.
 * @param groupValues Values needed for the invocation.
 */
public void handle(HttpRequest request,HttpResponder responder,Map<String,String> groupValues){
  try {
    if (httpMethods.contains(request.getMethod())) {
      Object[] args=new Object[method.getParameterTypes().length];
      int parameterIndex=0;
      args[parameterIndex]=request;
      parameterIndex++;
      args[parameterIndex]=responder;
      if (method.getParameterTypes().length > 2) {
        Class<?>[] parameterTypes=method.getParameterTypes();
        for (        Annotation[] annotations : method.getParameterAnnotations()) {
          for (          Annotation annotation : annotations) {
            if (annotation.annotationType().isAssignableFrom(PathParam.class)) {
              PathParam param=(PathParam)annotation;
              String value=groupValues.get(param.value());
              Preconditions.checkArgument(value != null,"String_Node_Str",param.value());
              parameterIndex++;
              args[parameterIndex]=ConvertUtils.convert(value,parameterTypes[parameterIndex]);
            }
          }
        }
        Preconditions.checkArgument(method.getParameterTypes().length == parameterIndex + 1,"String_Node_Str",method.getName());
      }
      method.invoke(handler,args);
    }
 else {
      responder.sendError(HttpResponseStatus.METHOD_NOT_ALLOWED,String.format("String_Node_Str",request.getUri()));
    }
  }
 catch (  Throwable e) {
    LOG.error("String_Node_Str",request.getUri(),e,e);
    responder.sendError(HttpResponseStatus.INTERNAL_SERVER_ERROR,String.format("String_Node_Str",request.getUri()));
  }
}
Program: 7811
Project: 7811
Buggy source:
/** 
 * Call the appropriate handler for handling the httprequest. 404 if path is not found. 405 if path is found but httpMethod does not match what's configured.
 * @param request instance of {@code HttpRequest}
 * @param responder instance of {@code HttpResponder} to handle the request.
 */
public void handle(HttpRequest request,HttpResponder responder){
  Map<String,String> groupValues=Maps.newHashMap();
  List<HttpResourceModel> resourceModels=patternRouter.getDestinations(request.getUri(),groupValues);
  HttpResourceModel httpResourceModel=getMatchedResourceModel(resourceModels,request.getMethod());
  if (httpResourceModel != null) {
    httpResourceModel.handle(request,responder,groupValues);
  }
 else   if (resourceModels.size() > 0) {
    responder.sendError(HttpResponseStatus.METHOD_NOT_ALLOWED,String.format("String_Node_Str",request.getUri()));
  }
 else {
    responder.sendError(HttpResponseStatus.NOT_FOUND,String.format("String_Node_Str",request.getUri()));
  }
}

Fixed version (ground truth):
/** 
 * Call the appropriate handler for handling the httprequest. 404 if path is not found. 405 if path is found but httpMethod does not match what's configured.
 * @param request instance of {@code HttpRequest}
 * @param responder instance of {@code HttpResponder} to handle the request.
 */
public void handle(HttpRequest request,HttpResponder responder){
  Map<String,String> groupValues=Maps.newHashMap();
  String path;
  try {
    URI uri=new URI(request.getUri());
    path=uri.getPath();
  }
 catch (  URISyntaxException e) {
    responder.sendError(HttpResponseStatus.NOT_FOUND,String.format("String_Node_Str",request.getUri()));
    return;
  }
  List<HttpResourceModel> resourceModels=patternRouter.getDestinations(path,groupValues);
  HttpResourceModel httpResourceModel=getMatchedResourceModel(resourceModels,request.getMethod());
  if (httpResourceModel != null) {
    httpResourceModel.handle(request,responder,groupValues);
  }
 else   if (resourceModels.size() > 0) {
    responder.sendError(HttpResponseStatus.METHOD_NOT_ALLOWED,String.format("String_Node_Str",request.getUri()));
  }
 else {
    responder.sendError(HttpResponseStatus.NOT_FOUND,String.format("String_Node_Str",request.getUri()));
  }
}
Program: 7812
Project: 7812
Buggy source:
@Override public TimeSeriesTable load(Integer key) throws Exception {
  return metricsTableFactory.createTimeSeries(MetricsScope.REACTOR.name(),key);
}

Fixed version (ground truth):
@Override public TimeSeriesTable load(Integer key) throws Exception {
  return metricsTableFactory.createTimeSeries(scope.name(),key);
}
Program: 7813
Project: 7813
Buggy source:
@Inject public BatchMetricsHandler(final MetricsTableFactory metricsTableFactory){
  this.metricsTableCaches=Maps.newHashMap();
  this.aggregatesTables=Maps.newHashMap();
  for (  MetricsScope scope : MetricsScope.values()) {
    LoadingCache<Integer,TimeSeriesTable> cache=CacheBuilder.newBuilder().build(new CacheLoader<Integer,TimeSeriesTable>(){
      @Override public TimeSeriesTable load(      Integer key) throws Exception {
        return metricsTableFactory.createTimeSeries(MetricsScope.REACTOR.name(),key);
      }
    }
);
    this.metricsTableCaches.put(scope,cache);
    this.aggregatesTables.put(scope,metricsTableFactory.createAggregates(scope.name()));
  }
}

Fixed version (ground truth):
@Inject public BatchMetricsHandler(final MetricsTableFactory metricsTableFactory){
  this.metricsTableCaches=Maps.newHashMap();
  this.aggregatesTables=Maps.newHashMap();
  for (  final MetricsScope scope : MetricsScope.values()) {
    LoadingCache<Integer,TimeSeriesTable> cache=CacheBuilder.newBuilder().build(new CacheLoader<Integer,TimeSeriesTable>(){
      @Override public TimeSeriesTable load(      Integer key) throws Exception {
        return metricsTableFactory.createTimeSeries(scope.name(),key);
      }
    }
);
    this.metricsTableCaches.put(scope,cache);
    this.aggregatesTables.put(scope,metricsTableFactory.createAggregates(scope.name()));
  }
}
Program: 7814
Project: 7814
Buggy source:
private JsonArray getMetrics(HttpRequest request,String contextPrefix){
  Map<String,List<String>> queryParams=new QueryStringDecoder(request.getUri()).getParameters();
  List<String> prefixEntity=queryParams.get("String_Node_Str");
  String metricPrefix=(prefixEntity == null) ? "String_Node_Str" : prefixEntity.get(0);
  Map<String,ContextNode> metricContextsMap=Maps.newHashMap();
  AggregatesScanner scanner=this.aggregatesTable.scan(contextPrefix,metricPrefix);
  while (scanner.hasNext()) {
    AggregatesScanResult result=scanner.next();
    addContext(result.getContext(),result.getMetric(),metricContextsMap);
  }
  JsonArray output=new JsonArray();
  List<String> sortedMetrics=Lists.newArrayList(metricContextsMap.keySet());
  Collections.sort(sortedMetrics);
  for (  String metric : sortedMetrics) {
    JsonObject metricNode=new JsonObject();
    metricNode.addProperty("String_Node_Str",metric);
    ContextNode metricContexts=metricContextsMap.get(metric);
    JsonObject tmp=metricContexts.toJson();
    metricNode.add("String_Node_Str",tmp.getAsJsonArray("String_Node_Str"));
    output.add(metricNode);
  }
  return output;
}

Fixed version (ground truth):
private JsonArray getMetrics(HttpRequest request,String contextPrefix){
  Map<String,List<String>> queryParams=new QueryStringDecoder(request.getUri()).getParameters();
  List<String> prefixEntity=queryParams.get("String_Node_Str");
  String metricPrefix=(prefixEntity == null) ? "String_Node_Str" : prefixEntity.get(0);
  Map<String,ContextNode> metricContextsMap=Maps.newHashMap();
  for (  AggregatesTable table : aggregatesTables.values()) {
    AggregatesScanner scanner=table.scan(contextPrefix,metricPrefix);
    while (scanner.hasNext()) {
      AggregatesScanResult result=scanner.next();
      addContext(result.getContext(),result.getMetric(),metricContextsMap);
    }
  }
  JsonArray output=new JsonArray();
  List<String> sortedMetrics=Lists.newArrayList(metricContextsMap.keySet());
  Collections.sort(sortedMetrics);
  for (  String metric : sortedMetrics) {
    JsonObject metricNode=new JsonObject();
    metricNode.addProperty("String_Node_Str",metric);
    ContextNode metricContexts=metricContextsMap.get(metric);
    JsonObject tmp=metricContexts.toJson();
    metricNode.add("String_Node_Str",tmp.getAsJsonArray("String_Node_Str"));
    output.add(metricNode);
  }
  return output;
}
Program: 7815
Project: 7815
Buggy source:
@Inject public MetricsDiscoveryHandler(final MetricsTableFactory metricsTableFactory){
  this.aggregatesTable=metricsTableFactory.createAggregates(MetricsScope.USER.name());
}

Fixed version (ground truth):
@Inject public MetricsDiscoveryHandler(final MetricsTableFactory metricsTableFactory){
  this.aggregatesTables=Maps.newHashMap();
  for (  MetricsScope scope : scopesToDiscover) {
    aggregatesTables.put(scope,metricsTableFactory.createAggregates(scope.name()));
  }
}
Program: 7816
Project: 7816
Buggy source:
@Override public Queue2Consumer createConsumer(int groupSize){
  DequeueStrategy strategy=DequeueStrategy.valueOf(queueInfo.getPartitionerType().name());
  try {
    return queueClientFactory.createConsumer(new ConsumerConfig(groupId,instanceId,groupSize,strategy,queueInfo.getPartitionKey()));
  }
 catch (  IOException e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
@Override public Queue2Consumer createConsumer(int groupSize){
  DequeueStrategy strategy=DequeueStrategy.valueOf(queueInfo.getPartitionerType().name());
  try {
    return queueClientFactory.createConsumer(queueName,new ConsumerConfig(groupId,instanceId,groupSize,strategy,queueInfo.getPartitionKey()));
  }
 catch (  IOException e) {
    throw Throwables.propagate(e);
  }
}
Program: 7817
Project: 7817
Buggy source:
public static synchronized boolean commit(Transaction tx){
  Set<byte[]> changeSet=committingChangeSets.remove(tx.getWritePointer());
  if (changeSet != null) {
    if (hasConflicts(tx,changeSet)) {
      return false;
    }
    if (committedChangeSets.containsKey(nextWritePointer)) {
      committedChangeSets.get(nextWritePointer).addAll(changeSet);
    }
 else {
      committedChangeSets.put(nextWritePointer,Sets.newHashSet(changeSet));
    }
  }
  makeVisible(tx);
  committedChangeSets.headMap(excludedList.isEmpty() ? Long.MAX_VALUE : excludedList.get(0)).clear();
  return true;
}

Fixed version (ground truth):
public static synchronized boolean commit(Transaction tx){
  Set<byte[]> changeSet=committingChangeSets.remove(tx.getWritePointer());
  if (changeSet != null) {
    if (hasConflicts(tx,changeSet)) {
      return false;
    }
    if (committedChangeSets.containsKey(nextWritePointer)) {
      committedChangeSets.get(nextWritePointer).addAll(changeSet);
    }
 else {
      TreeSet<byte[]> committedChangeSet=Sets.newTreeSet(Bytes.BYTES_COMPARATOR);
      committedChangeSet.addAll(changeSet);
      committedChangeSets.put(nextWritePointer,committedChangeSet);
    }
  }
  makeVisible(tx);
  committedChangeSets.headMap(excludedList.isEmpty() ? Long.MAX_VALUE : excludedList.get(0)).clear();
  return true;
}
Program: 7818
Project: 7818
Buggy source:
private static boolean hasConflicts(Transaction tx,Collection<byte[]> changeIds){
  if (changeIds.isEmpty()) {
    return false;
  }
  for (  Map.Entry<Long,Set<byte[]>> changeSet : committedChangeSets.entrySet()) {
    if (changeSet.getKey() > tx.getReadPointer()) {
      if (containsAny(changeSet.getValue(),changeIds)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private static boolean hasConflicts(Transaction tx,Collection<byte[]> changeIds){
  if (changeIds.isEmpty()) {
    return false;
  }
  for (  Map.Entry<Long,Set<byte[]>> changeSet : committedChangeSets.entrySet()) {
    if (changeSet.getKey() > tx.getWritePointer()) {
      if (containsAny(changeSet.getValue(),changeIds)) {
        return true;
      }
    }
  }
  return false;
}
Program: 7819
Project: 7819
Buggy source:
@Override public List<TLogResult> getLogPrev(String accountId,String applicationId,String entityId,TEntityType entityType,long fromOffset,int maxEvents,String filterStr) throws MetricsServiceException, TException {
  LoggingContext loggingContext=LoggingContextHelper.getLoggingContext(accountId,applicationId,entityId,getEntityType(entityType));
  LogCallback logCallback=new LogCallback(maxEvents,logPattern);
  try {
    Filter filter=FilterParser.parse(filterStr);
    logReader.getLogPrev(loggingContext,fromOffset,maxEvents,filter,logCallback);
    logCallback.await();
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
  return logCallback.getLogResults();
}

Fixed version (ground truth):
@Override public List<TLogResult> getLogPrev(String accountId,String applicationId,String entityId,TEntityType entityType,long fromOffset,int maxEvents,String filterStr) throws MetricsServiceException, TException {
  LoggingContext loggingContext=LoggingContextHelper.getLoggingContext(accountId,applicationId,entityId,getEntityType(entityType));
  LogCallback logCallback=new LogCallback(maxEvents,logPattern);
  try {
    Filter filter=FilterParser.parse(filterStr);
    logReader.getLogPrev(loggingContext,fromOffset,maxEvents,filter,logCallback);
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
  return logCallback.getLogResults();
}
Program: 7820
Project: 7820
Buggy source:
@Override public List<TLogResult> getLogNext(String accountId,String applicationId,String entityId,TEntityType entityType,long fromOffset,int maxEvents,String filterStr) throws MetricsServiceException, TException {
  LoggingContext loggingContext=LoggingContextHelper.getLoggingContext(accountId,applicationId,entityId,getEntityType(entityType));
  LogCallback logCallback=new LogCallback(maxEvents,logPattern);
  try {
    Filter filter=FilterParser.parse(filterStr);
    logReader.getLogNext(loggingContext,fromOffset,maxEvents,filter,logCallback);
    logCallback.await();
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
  return logCallback.getLogResults();
}

Fixed version (ground truth):
@Override public List<TLogResult> getLogNext(String accountId,String applicationId,String entityId,TEntityType entityType,long fromOffset,int maxEvents,String filterStr) throws MetricsServiceException, TException {
  LoggingContext loggingContext=LoggingContextHelper.getLoggingContext(accountId,applicationId,entityId,getEntityType(entityType));
  LogCallback logCallback=new LogCallback(maxEvents,logPattern);
  try {
    Filter filter=FilterParser.parse(filterStr);
    logReader.getLogNext(loggingContext,fromOffset,maxEvents,filter,logCallback);
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
  return logCallback.getLogResults();
}
Program: 7821
Project: 7821
Buggy source:
public List<TLogResult> getLogResults(){
  return Collections.unmodifiableList(logResults);
}

Fixed version (ground truth):
public List<TLogResult> getLogResults(){
  try {
    doneLatch.await();
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
  }
  return Collections.unmodifiableList(logResults);
}
Program: 7822
Project: 7822
Buggy source:
private void rotate(long ts) throws IOException {
  long timeInterval=getMinuteInterval(ts);
  if ((currentTimeInterval != timeInterval && timeInterval % fileRotateIntervalMs == 0) || dataFileWriter == null) {
    close();
    create(timeInterval);
    currentTimeInterval=timeInterval;
    cleanUp();
  }
}

Fixed version (ground truth):
private void rotate(long ts) throws IOException {
  if ((currentTimeInterval != ts && ts % fileRotateIntervalMs == 0) || dataFileWriter == null) {
    close();
    create(ts);
    currentTimeInterval=ts;
    cleanUp();
  }
}
Program: 7823
Project: 7823
Buggy source:
@Override public void getLogNext(final LoggingContext loggingContext,final long fromOffset,final int maxEvents,final Filter filter,final Callback callback){
  if (fromOffset < 0) {
    getLogPrev(loggingContext,-1,maxEvents,filter,callback);
  }
  executor.submit(new Runnable(){
    @Override public void run(){
      Filter logFilter=new AndFilter(ImmutableList.of(LoggingContextHelper.createFilter(loggingContext),filter));
      long fromTimeMs=fromOffset + 1;
      SortedMap<Long,FileStatus> sortedFiles=getFiles(null);
      if (sortedFiles.isEmpty()) {
        return;
      }
      long prevInterval=-1;
      Path prevPath=null;
      List<Path> tailFiles=Lists.newArrayListWithExpectedSize(sortedFiles.size());
      for (      Map.Entry<Long,FileStatus> entry : sortedFiles.entrySet()) {
        if (entry.getKey() >= fromTimeMs && prevPath != null) {
          tailFiles.add(prevPath);
        }
        prevInterval=entry.getKey();
        prevPath=entry.getValue().getPath();
      }
      if (prevInterval != -1) {
        tailFiles.add(prevPath);
      }
      callback.init();
      final List<ILoggingEvent> loggingEvents=Lists.newLinkedList();
      AvroFileLogReader logReader=new AvroFileLogReader(hConf,schema);
      for (      Path file : tailFiles) {
        logReader.readLog(file,logFilter,fromTimeMs,Long.MAX_VALUE,maxEvents - loggingEvents.size(),callback);
        if (loggingEvents.size() >= maxEvents) {
          break;
        }
      }
      callback.close();
    }
  }
);
}

Fixed version (ground truth):
@Override public void getLogNext(final LoggingContext loggingContext,final long fromOffset,final int maxEvents,final Filter filter,final Callback callback){
  if (fromOffset < 0) {
    getLogPrev(loggingContext,-1,maxEvents,filter,callback);
    return;
  }
  executor.submit(new Runnable(){
    @Override public void run(){
      Filter logFilter=new AndFilter(ImmutableList.of(LoggingContextHelper.createFilter(loggingContext),filter));
      long fromTimeMs=fromOffset + 1;
      SortedMap<Long,FileStatus> sortedFiles=getFiles(null);
      if (sortedFiles.isEmpty()) {
        return;
      }
      long prevInterval=-1;
      Path prevPath=null;
      List<Path> tailFiles=Lists.newArrayListWithExpectedSize(sortedFiles.size());
      for (      Map.Entry<Long,FileStatus> entry : sortedFiles.entrySet()) {
        if (entry.getKey() >= fromTimeMs && prevPath != null) {
          tailFiles.add(prevPath);
        }
        prevInterval=entry.getKey();
        prevPath=entry.getValue().getPath();
      }
      if (prevInterval != -1) {
        tailFiles.add(prevPath);
      }
      callback.init();
      final List<ILoggingEvent> loggingEvents=Lists.newLinkedList();
      AvroFileLogReader logReader=new AvroFileLogReader(hConf,schema);
      for (      Path file : tailFiles) {
        logReader.readLog(file,logFilter,fromTimeMs,Long.MAX_VALUE,maxEvents - loggingEvents.size(),callback);
        if (loggingEvents.size() >= maxEvents) {
          break;
        }
      }
      callback.close();
    }
  }
);
}
Program: 7824
Project: 7824
Buggy source:
public static synchronized boolean commit(Transaction tx){
  Set<byte[]> changeSet=committingChangeSets.remove(tx.getWritePointer());
  if (changeSet != null) {
    if (hasConflicts(tx,changeSet)) {
      return false;
    }
    committedChangeSets.put(nextWritePointer,changeSet);
  }
  makeVisible(tx);
  committedChangeSets.headMap(excludedList.isEmpty() ? Long.MAX_VALUE : excludedList.get(0)).clear();
  return true;
}

Fixed version (ground truth):
public static synchronized boolean commit(Transaction tx){
  Set<byte[]> changeSet=committingChangeSets.remove(tx.getWritePointer());
  if (changeSet != null) {
    if (hasConflicts(tx,changeSet)) {
      return false;
    }
    if (committedChangeSets.containsKey(nextWritePointer)) {
      committedChangeSets.get(nextWritePointer).addAll(changeSet);
    }
 else {
      committedChangeSets.put(nextWritePointer,Sets.newHashSet(changeSet));
    }
  }
  makeVisible(tx);
  committedChangeSets.headMap(excludedList.isEmpty() ? Long.MAX_VALUE : excludedList.get(0)).clear();
  return true;
}
Program: 7825
Project: 7825
Buggy source:
private RuntimeInfo addRemover(final RuntimeInfo runtimeInfo){
  runtimeInfo.getController().addListener(new AbstractListener(){
    @Override public void stopped(){
      remove(runtimeInfo);
    }
    @Override public void error(){
      remove(runtimeInfo);
    }
  }
,Threads.SAME_THREAD_EXECUTOR);
  return runtimeInfo;
}

Fixed version (ground truth):
private RuntimeInfo addRemover(final RuntimeInfo runtimeInfo){
  runtimeInfo.getController().addListener(new AbstractListener(){
    @Override public void stopped(){
      remove(runtimeInfo);
    }
    @Override public void error(    Throwable cause){
      remove(runtimeInfo);
    }
  }
,Threads.SAME_THREAD_EXECUTOR);
  return runtimeInfo;
}
Program: 7826
Project: 7826
Buggy source:
@Override public void error(){
  remove(runtimeInfo);
}

Fixed version (ground truth):
@Override public void error(Throwable cause){
  remove(runtimeInfo);
}
Program: 7827
Project: 7827
Buggy source:
void error();

Fixed version (ground truth):
void error(Throwable cause);
Program: 7828
Project: 7828
Buggy source:
@Override public void error(){
}

Fixed version (ground truth):
@Override public void error(Throwable cause){
}
Program: 7829
Project: 7829
Buggy source:
@Override public void run(){
  try {
    listener.error();
  }
 catch (  Throwable t) {
    LOG.info(t.getMessage(),t);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    listener.error(cause);
  }
 catch (  Throwable t) {
    LOG.info(t.getMessage(),t);
  }
}
Program: 7830
Project: 7830
Buggy source:
@Override public void error(){
  executor.execute(new Runnable(){
    @Override public void run(){
      try {
        listener.error();
      }
 catch (      Throwable t) {
        LOG.info(t.getMessage(),t);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void error(final Throwable cause){
  executor.execute(new Runnable(){
    @Override public void run(){
      try {
        listener.error(cause);
      }
 catch (      Throwable t) {
        LOG.info(t.getMessage(),t);
      }
    }
  }
);
}
Program: 7831
Project: 7831
Buggy source:
@Override public void run(){
  LOG.info("String_Node_Str");
  Futures.getUnchecked(Services.chainStart(zkClientService,kafkaClientService,metricsCollectionService));
  LOG.info("String_Node_Str" + name);
  controller=injector.getInstance(getProgramClass()).run(program,programOpts);
  final SettableFuture<ProgramController.State> state=SettableFuture.create();
  controller.addListener(new AbstractListener(){
    @Override public void stopped(){
      state.set(ProgramController.State.STOPPED);
    }
    @Override public void error(){
      state.set(ProgramController.State.ERROR);
    }
  }
,MoreExecutors.sameThreadExecutor());
  LOG.info("String_Node_Str",Futures.getUnchecked(state));
}

Fixed version (ground truth):
@Override public void run(){
  LOG.info("String_Node_Str");
  Futures.getUnchecked(Services.chainStart(zkClientService,kafkaClientService,metricsCollectionService));
  LOG.info("String_Node_Str" + name);
  controller=injector.getInstance(getProgramClass()).run(program,programOpts);
  final SettableFuture<ProgramController.State> state=SettableFuture.create();
  controller.addListener(new AbstractListener(){
    @Override public void stopped(){
      state.set(ProgramController.State.STOPPED);
    }
    @Override public void error(    Throwable cause){
      LOG.error("String_Node_Str",cause);
      state.set(ProgramController.State.ERROR);
    }
  }
,MoreExecutors.sameThreadExecutor());
  LOG.info("String_Node_Str",Futures.getUnchecked(state));
}
Program: 7832
Project: 7832
Buggy source:
@Override public void error(){
  state.set(ProgramController.State.ERROR);
}

Fixed version (ground truth):
@Override public void error(Throwable cause){
  LOG.error("String_Node_Str",cause);
  state.set(ProgramController.State.ERROR);
}
Program: 7833
Project: 7833
Buggy source:
@Override public void handleCommand(Command command) throws Exception {
  if (ProgramCommands.SUSPEND.equals(command)) {
    controller.suspend().get();
    return;
  }
  if (ProgramCommands.RESUME.equals(command)) {
    controller.resume().get();
    return;
  }
  if ("String_Node_Str".equals(command.getCommand())) {
    int instances=Integer.parseInt(command.getOptions().get("String_Node_Str"));
    controller.command("String_Node_Str",instances);
    return;
  }
  LOG.warn("String_Node_Str" + command);
}

Fixed version (ground truth):
@Override public void handleCommand(Command command) throws Exception {
  if (ProgramCommands.SUSPEND.equals(command)) {
    controller.suspend().get();
    return;
  }
  if (ProgramCommands.RESUME.equals(command)) {
    controller.resume().get();
    return;
  }
  if ("String_Node_Str".equals(command.getCommand())) {
    int instances=Integer.parseInt(command.getOptions().get("String_Node_Str"));
    controller.command("String_Node_Str",instances).get();
    return;
  }
  LOG.warn("String_Node_Str" + command);
}
Program: 7834
Project: 7834
Buggy source:
/** 
 * Invoked during shutdown of the thread.
 */
protected void triggerShutdown(){
  server.stop();
}

Fixed version (ground truth):
/** 
 * Invoked during shutdown of the thread.
 */
protected void triggerShutdown(){
  executor.shutdownNow();
  server.stop();
}
Program: 7835
Project: 7835
Buggy source:
@Override public boolean commitTx() throws Exception {
  if (consumingEntries.isEmpty()) {
    return true;
  }
  byte[] stateContent=encodeStateColumn(ConsumerEntryState.PROCESSED);
  List<Put> puts=Lists.newArrayListWithCapacity(consumingEntries.size());
  for (  byte[] rowKey : consumingEntries.keySet()) {
    Put put=new Put(rowKey);
    put.add(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.STATE_COLUMN,stateContent);
    puts.add(put);
  }
  hTable.put(puts);
  hTable.flushCommits();
  return true;
}

Fixed version (ground truth):
@Override public boolean commitTx() throws Exception {
  if (consumingEntries.isEmpty()) {
    return true;
  }
  byte[] stateContent=encodeStateColumn(ConsumerEntryState.PROCESSED);
  List<Put> puts=Lists.newArrayListWithCapacity(consumingEntries.size());
  for (  byte[] rowKey : consumingEntries.keySet()) {
    Put put=new Put(rowKey);
    put.add(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName,stateContent);
    puts.add(put);
  }
  hTable.put(puts);
  hTable.flushCommits();
  return true;
}
Program: 7836
Project: 7836
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) {
        if (entry.getState() == null) {
          Put put=new Put(entry.getRowKey());
          byte[] stateValue=encodeStateColumn(ConsumerEntryState.CLAIMED);
          put.add(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.STATE_COLUMN,stateValue);
          boolean claimed=hTable.checkAndPut(entry.getRowKey(),HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.STATE_COLUMN,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");
  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);
}
Program: 7837
Project: 7837
Buggy source:
@Override public boolean rollbackTx() throws Exception {
  if (consumingEntries.isEmpty()) {
    return true;
  }
  entryCache.putAll(consumingEntries);
  List<Row> ops=Lists.newArrayListWithCapacity(consumingEntries.size());
  if (consumerConfig.getDequeueStrategy() == DequeueStrategy.FIFO) {
    byte[] stateContent=encodeStateColumn(ConsumerEntryState.CLAIMED);
    for (    byte[] rowKey : consumingEntries.keySet()) {
      Put put=new Put(rowKey);
      put.add(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.STATE_COLUMN,stateContent);
      ops.add(put);
    }
  }
 else {
    for (    byte[] rowKey : consumingEntries.keySet()) {
      Delete delete=new Delete(rowKey);
      delete.deleteColumn(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.STATE_COLUMN);
      ops.add(delete);
    }
  }
  hTable.batch(ops);
  hTable.flushCommits();
  return true;
}

Fixed version (ground truth):
@Override public boolean rollbackTx() throws Exception {
  if (consumingEntries.isEmpty()) {
    return true;
  }
  entryCache.putAll(consumingEntries);
  List<Row> ops=Lists.newArrayListWithCapacity(consumingEntries.size());
  if (consumerConfig.getDequeueStrategy() == DequeueStrategy.FIFO && consumerConfig.getGroupSize() > 1) {
    byte[] stateContent=encodeStateColumn(ConsumerEntryState.CLAIMED);
    for (    byte[] rowKey : consumingEntries.keySet()) {
      Put put=new Put(rowKey);
      put.add(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName,stateContent);
      ops.add(put);
    }
  }
 else {
    for (    byte[] rowKey : consumingEntries.keySet()) {
      Delete delete=new Delete(rowKey);
      delete.deleteColumn(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName);
      ops.add(delete);
    }
  }
  hTable.batch(ops);
  hTable.flushCommits();
  return true;
}
Program: 7838
Project: 7838
Buggy source:
HBaseQueueConsumer(ConsumerConfig consumerConfig,HTable hTable,QueueName queueName){
  this.consumerConfig=consumerConfig;
  this.hTable=hTable;
  this.queueName=queueName;
  this.entryCache=Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
  this.consumingEntries=Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
  this.startRow=queueName.toBytes();
  byte[] tableName=hTable.getTableName();
  final byte[] changeTxPrefix=ByteBuffer.allocate(tableName.length + 1).put((byte)tableName.length).put(tableName).array();
  rowKeyToChangeTx=new Function<byte[],byte[]>(){
    @Override public byte[] apply(    byte[] rowKey){
      return Bytes.add(changeTxPrefix,rowKey);
    }
  }
;
}

Fixed version (ground truth):
HBaseQueueConsumer(ConsumerConfig consumerConfig,HTable hTable,QueueName queueName){
  this.consumerConfig=consumerConfig;
  this.hTable=hTable;
  this.queueName=queueName;
  this.entryCache=Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
  this.consumingEntries=Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
  this.startRow=queueName.toBytes();
  this.stateColumnName=Bytes.add(HBaseQueueConstants.STATE_COLUMN_PREFIX,Bytes.toBytes(consumerConfig.getGroupId()));
  byte[] tableName=hTable.getTableName();
  final byte[] changeTxPrefix=ByteBuffer.allocate(tableName.length + 1).put((byte)tableName.length).put(tableName).array();
  rowKeyToChangeTx=new Function<byte[],byte[]>(){
    @Override public byte[] apply(    byte[] rowKey){
      return Bytes.add(changeTxPrefix,rowKey);
    }
  }
;
}
Program: 7840
Project: 7840
Buggy source:
@Override public void onFailure(Throwable t){
  LOG.warn(StackTraceUtil.toStringStackTrace(t));
  LOG.warn(t.getCause().toString());
  DeployStatus status=DeployStatus.FAILED;
  Throwable cause=t.getCause();
  if (cause instanceof ClassNotFoundException) {
    status.setMessage(String.format(UserMessages.getMessage("String_Node_Str"),t.getMessage()));
  }
 else   if (cause instanceof IllegalArgumentException) {
    status.setMessage(String.format(UserMessages.getMessage("String_Node_Str"),t.getMessage()));
  }
 else {
    status.setMessage(t.getMessage());
  }
  save(sessionInfo.setStatus(status));
  sessions.remove(resource.getAccountId());
}

Fixed version (ground truth):
@Override public void onFailure(Throwable t){
  LOG.warn(StackTraceUtil.toStringStackTrace(t));
  DeployStatus status=DeployStatus.FAILED;
  Throwable cause=t.getCause();
  if (cause instanceof ClassNotFoundException) {
    status.setMessage(String.format(UserMessages.getMessage("String_Node_Str"),t.getMessage()));
  }
 else   if (cause instanceof IllegalArgumentException) {
    status.setMessage(String.format(UserMessages.getMessage("String_Node_Str"),t.getMessage()));
  }
 else {
    status.setMessage(t.getMessage());
  }
  save(sessionInfo.setStatus(status));
  sessions.remove(resource.getAccountId());
}