nus-yam/ex-repair huggingface dataset:
Program: 3809
Project: 3809
Buggy source:
public Runnable getOnTimeout(){
  return onTimeout;
}

Fixed version (ground truth):
/** 
 * This is Deprecated.  this will become private.  Builders should be only used to build in a local scope so this is something that you should have just set.
 * @return
 */
@Deprecated public Runnable getOnTimeout(){
  return onTimeout;
}
Program: 3810
Project: 3810
Buggy source:
public CallbackBuilder(){
}

Fixed version (ground truth):
/** 
 * Deprecated.  this will become private.  Use the static method to get one.
 */
@Deprecated public CallbackBuilder(){
}
Program: 3811
Project: 3811
Buggy source:
public CallbackBuilder setOnTimeout(Runnable onTimeout){
  this.onTimeout=onTimeout;
  return this;
}

Fixed version (ground truth):
/** 
 * Deprecated.  use withTimeoutHandler instead.
 * @param onTimeout onTimeout
 * @return
 */
@Deprecated public CallbackBuilder setOnTimeout(final Runnable onTimeout){
  this.onTimeout=onTimeout;
  return this;
}
Program: 3812
Project: 3812
Buggy source:
public TimeUnit getTimeoutTimeUnit(){
  return timeoutTimeUnit;
}

Fixed version (ground truth):
/** 
 * This is Deprecated.  this will become private.  Builders should be only used to build in a local scope so this is something that you should have just set.
 * @return
 */
@Deprecated public TimeUnit getTimeoutTimeUnit(){
  return timeoutTimeUnit;
}
Program: 3813
Project: 3813
Buggy source:
public static CallbackBuilder callbackBuilder(){
  return new CallbackBuilder();
}

Fixed version (ground truth):
/** 
 * Deprecated.  use newBuilder() instead
 * @return
 */
@Deprecated public static CallbackBuilder callbackBuilder(){
  return new CallbackBuilder();
}
Program: 3814
Project: 3814
Buggy source:
public Reactor getReactor(){
  return reactor;
}

Fixed version (ground truth):
/** 
 * This is Deprecated. this will become private. Builders should be only used to build in a local scope so this is something that you should have just set.
 * @return
 */
@Deprecated public Reactor getReactor(){
  return reactor;
}
Program: 3815
Project: 3815
Buggy source:
public long getTimeoutDuration(){
  return timeoutDuration;
}

Fixed version (ground truth):
/** 
 * This is Deprecated.  this will become private.  Builders should be only used to build in a local scope so this is something that you should have just set.
 * @return
 */
@Deprecated public long getTimeoutDuration(){
  return timeoutDuration;
}
Program: 3816
Project: 3816
Buggy source:
public Consumer<Throwable> getOnError(){
  return onError;
}

Fixed version (ground truth):
/** 
 * This is Deprecated.  this will become private.  Builders should be only used to build in a local scope so this is something that you should have just set.
 * @return
 */
@Deprecated public Consumer<Throwable> getOnError(){
  return onError;
}
Program: 3817
Project: 3817
Buggy source:
public <T>Callback<T> getCallback(){
  return callback;
}

Fixed version (ground truth):
/** 
 * This is Deprecated.  this will become private.  Builders should be only used to build in a local scope so this is something that you should have just set.
 * @return callback
 */
@Deprecated public <T>Callback<T> getCallback(){
  return callback;
}
Program: 3818
Project: 3818
Buggy source:
public CallbackBuilder setOnError(Consumer<Throwable> onError){
  this.onError=onError;
  return this;
}

Fixed version (ground truth):
/** 
 * Deprecated. use withErrorHandler instead.
 * @return
 */
@Deprecated public CallbackBuilder setOnError(Consumer<Throwable> onError){
  this.onError=onError;
  return this;
}
Program: 3819
Project: 3819
Buggy source:
public CallbackBuilder setTimeoutTimeUnit(TimeUnit timeoutTimeUnit){
  this.timeoutTimeUnit=timeoutTimeUnit;
  return this;
}

Fixed version (ground truth):
/** 
 * Deprecated.  use withTimeoutTimeUnit instead.
 * @param timeoutTimeUnit
 * @return
 */
@Deprecated public CallbackBuilder setTimeoutTimeUnit(TimeUnit timeoutTimeUnit){
  this.timeoutTimeUnit=timeoutTimeUnit;
  return this;
}
Program: 3820
Project: 3820
Buggy source:
private void addClass(final ClassMeta<?> classMeta){
  try {
    if (definitionMap.containsKey(classMeta.name())) {
      return;
    }
    final DefinitionBuilder definitionBuilder=new DefinitionBuilder();
    final String description=getDescription(classMeta);
    definitionBuilder.setDescription(description);
    Map<String,FieldAccess> fieldAccessMap=classMeta.fieldMap();
    fieldAccessMap.entrySet().forEach(fieldAccessEntry -> {
      final FieldAccess fieldAccess=fieldAccessEntry.getValue();
      if (fieldAccess.ignore() || fieldAccess.isStatic()) {
        return;
      }
      definitionBuilder.addProperty(fieldAccess.name(),convertFieldToSchema(fieldAccess));
    }
);
    final Definition definition=definitionBuilder.build();
    definitionMap.put(classMeta.name(),definition);
  }
 catch (  Exception ex) {
    logger.warn("String_Node_Str" + classMeta.longName(),ex);
  }
}

Fixed version (ground truth):
private void addClass(final ClassMeta<?> classMeta){
  try {
    if (definitionMap.containsKey(classMeta.name())) {
      return;
    }
    definitionMap.put(classMeta.name(),null);
    final DefinitionBuilder definitionBuilder=new DefinitionBuilder();
    final String description=getDescription(classMeta);
    definitionBuilder.setDescription(description);
    Map<String,FieldAccess> fieldAccessMap=classMeta.fieldMap();
    fieldAccessMap.entrySet().forEach(fieldAccessEntry -> {
      final FieldAccess fieldAccess=fieldAccessEntry.getValue();
      if (fieldAccess.ignore() || fieldAccess.isStatic()) {
        return;
      }
      definitionBuilder.addProperty(fieldAccess.name(),convertFieldToSchema(fieldAccess));
    }
);
    final Definition definition=definitionBuilder.build();
    definitionMap.put(classMeta.name(),definition);
  }
 catch (  Exception ex) {
    logger.warn("String_Node_Str" + classMeta.longName(),ex);
  }
}
Program: 3821
Project: 3821
Buggy source:
public ServiceBuilder setServiceObject(final Object serviceObject){
  if (serviceObject == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ClassMeta<?> classMeta=ClassMeta.classMeta(serviceObject.getClass());
  Iterable<MethodAccess> methods=classMeta.methods();
  Set<String> methodNames=new HashSet<>();
  int size;
  for (  MethodAccess methodAccess : methods) {
    if (!methodAccess.method().getDeclaringClass().isInterface()) {
      continue;
    }
    size=methodNames.size();
    methodNames.add(methodAccess.name());
    if (size == methodNames.size()) {
      throw new IllegalStateException("String_Node_Str" + methodAccess.name() + "String_Node_Str"+ methodNames+ "String_Node_Str"+ classMeta.longName());
    }
  }
  this.serviceObject=serviceObject;
  return this;
}

Fixed version (ground truth):
public ServiceBuilder setServiceObject(final Object serviceObject){
  if (serviceObject == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ClassMeta<?> classMeta=ClassMeta.classMeta(serviceObject.getClass());
  Iterable<MethodAccess> methods=classMeta.methods();
  Set<String> methodNames=new HashSet<>();
  int size;
  for (  MethodAccess methodAccess : methods) {
    if (methodAccess.method().getDeclaringClass().isInterface()) {
      continue;
    }
    size=methodNames.size();
    methodNames.add(methodAccess.name());
    if (size == methodNames.size()) {
      throw new IllegalStateException("String_Node_Str" + methodAccess.name() + "String_Node_Str"+ methodNames+ "String_Node_Str"+ classMeta.longName());
    }
  }
  this.serviceObject=serviceObject;
  return this;
}
Program: 3823
Project: 3823
Buggy source:
@Test(expected=IllegalStateException.class) public void noOverloading(){
  ServiceQueue serviceQueue=ServiceBuilder.serviceBuilder().setServiceObject(new MyService()).build();
}

Fixed version (ground truth):
@Test public void noOverloading(){
  ServiceQueue serviceQueue=ServiceBuilder.serviceBuilder().setServiceObject(new MyService()).build();
}
Program: 3824
Project: 3824
Buggy source:
@Test(expected=IllegalStateException.class) public void noOverloadingBundle(){
  ServiceBundleBuilder.serviceBundleBuilder().build().addService(new MyService()).start();
}

Fixed version (ground truth):
@Test public void noOverloadingBundle(){
  ServiceBundleBuilder.serviceBundleBuilder().build().addService(new MyService()).start();
}
Program: 3825
Project: 3825
Buggy source:
public ServiceBuilder setServiceObject(final Object serviceObject){
  if (serviceObject == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ClassMeta<?> classMeta=ClassMeta.classMeta(serviceObject.getClass());
  Iterable<MethodAccess> methods=classMeta.methods();
  Set<String> methodNames=new HashSet<>();
  int size;
  for (  MethodAccess methodAccess : methods) {
    if (methodAccess.method().getDeclaringClass().isInterface()) {
      continue;
    }
    size=methodNames.size();
    methodNames.add(methodAccess.name());
    if (size == methodNames.size()) {
      throw new IllegalStateException("String_Node_Str" + methodAccess.name() + "String_Node_Str"+ methodNames+ "String_Node_Str"+ classMeta.longName());
    }
  }
  this.serviceObject=serviceObject;
  return this;
}

Fixed version (ground truth):
public ServiceBuilder setServiceObject(final Object serviceObject){
  if (serviceObject == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ClassMeta<?> classMeta=ClassMeta.classMeta(serviceObject.getClass());
  Iterable<MethodAccess> methods=classMeta.methods();
  Set<String> methodNames=new HashSet<>();
  int size;
  for (  MethodAccess methodAccess : methods) {
    if (methodAccess.method().getDeclaringClass().isInterface()) {
      continue;
    }
    size=methodNames.size();
    methodNames.add(methodAccess.name());
    if (size == methodNames.size()) {
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + methodAccess.name() + "String_Node_Str"+ methodNames+ "String_Node_Str"+ classMeta.longName());
    }
  }
  this.serviceObject=serviceObject;
  return this;
}
Program: 3826
Project: 3826
Buggy source:
public ServiceBuilder setServiceObject(final Object serviceObject){
  if (serviceObject == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ClassMeta<?> classMeta=ClassMeta.classMeta(serviceObject.getClass());
  Iterable<MethodAccess> methods=classMeta.methods();
  Set<String> methodNames=new HashSet<>();
  int size;
  for (  MethodAccess methodAccess : methods) {
    size=methodNames.size();
    methodNames.add(methodAccess.name());
    if (size == methodNames.size()) {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  this.serviceObject=serviceObject;
  return this;
}

Fixed version (ground truth):
public ServiceBuilder setServiceObject(final Object serviceObject){
  if (serviceObject == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ClassMeta<?> classMeta=ClassMeta.classMeta(serviceObject.getClass());
  Iterable<MethodAccess> methods=classMeta.methods();
  Set<String> methodNames=new HashSet<>();
  int size;
  for (  MethodAccess methodAccess : methods) {
    if (!methodAccess.method().getDeclaringClass().isInterface()) {
      continue;
    }
    size=methodNames.size();
    methodNames.add(methodAccess.name());
    if (size == methodNames.size()) {
      throw new IllegalStateException("String_Node_Str" + methodAccess.name() + "String_Node_Str"+ methodNames+ "String_Node_Str"+ classMeta.longName());
    }
  }
  this.serviceObject=serviceObject;
  return this;
}
Program: 3827
Project: 3827
Buggy source:
private void handleDiscoveryCheckInWithHealth(final AtomicLong lastCheckIn,final long checkInDuration){
  final AtomicBoolean ok=new AtomicBoolean(true);
  httpServer.setHttpRequestsIdleConsumer(aVoid -> {
    httpRequestServerHandler.httpRequestQueueIdle(null);
    long now=Timer.clockTime();
    if (now > lastCheckIn.get() + checkInDuration) {
      lastCheckIn.set(now);
      if (ok.get()) {
        serviceDiscovery.checkInOk(endpoint.getId());
      }
 else {
        serviceDiscovery.checkIn(endpoint.getId(),HealthStatus.FAIL);
      }
    }
    healthServiceAsync.ok(ok::set);
    ServiceProxyUtils.flushServiceProxy(healthServiceAsync);
  }
);
}

Fixed version (ground truth):
private void handleDiscoveryCheckInWithHealth(final AtomicLong lastCheckIn,final long checkInDuration){
  final AtomicBoolean ok=new AtomicBoolean(true);
  httpServer.setHttpRequestsIdleConsumer(aVoid -> {
    httpRequestServerHandler.httpRequestQueueIdle(null);
    long now=Timer.clockTime();
    if (now > lastCheckIn.get() + checkInDuration) {
      lastCheckIn.set(now);
      if (ok.get()) {
        serviceDiscovery.checkInOk(endpoint.getId());
      }
 else {
        serviceDiscovery.checkIn(endpoint.getId(),HealthStatus.FAIL);
      }
      healthServiceAsync.ok(ok::set);
      ServiceProxyUtils.flushServiceProxy(healthServiceAsync);
    }
  }
);
}
Program: 3828
Project: 3828
Buggy source:
/** 
 * Register a callbackWithTimeout handler
 * @param methodCall method call
 * @param handler    call back handler to register
 */
private void registerHandlerCallbackForClient(final MethodCall<Object> methodCall,final Callback<Object> handler){
  handlers.put(new HandlerKey(methodCall.returnAddress(),methodCall.id(),now),handler);
}

Fixed version (ground truth):
/** 
 * Register a callbackWithTimeout handler
 * @param methodCall method call
 * @param handler    call back handler to register
 */
private void registerHandlerCallbackForClient(final MethodCall<Object> methodCall,final Callback<Object> handler){
  handlers.put(new HandlerKey(methodCall.returnAddress(),methodCall.address(),methodCall.id(),now),handler);
}
Program: 3829
Project: 3829
Buggy source:
@Override public void process(long currentTime){
  if (!handleTimeouts) {
    return;
  }
  if (currentTime != 0) {
    this.now=currentTime;
  }
 else {
    this.now=timer.now();
  }
  long duration=this.now - lastCheckTime;
  if (duration > checkInterval) {
    checkForTimeOuts();
    lastCheckTime=this.now;
  }
}

Fixed version (ground truth):
@Override public void process(long currentTime){
}
Program: 3830
Project: 3830
Buggy source:
private void checkForTimeOuts(){
  if (debug) {
    logger.debug("String_Node_Str");
  }
  final ArrayList<Map.Entry<HandlerKey,Callback<Object>>> entries=new ArrayList<>(handlers.entrySet());
  for (  Map.Entry<HandlerKey,Callback<Object>> entry : entries) {
    long duration=now - entry.getKey().timestamp;
    if (duration > timeOutMS) {
      if (debug)       logger.debug("String_Node_Str",name,now - entry.getKey().timestamp,entry.getKey().returnAddress,entry.getKey().messageId,new Date(entry.getKey().timestamp));
      handlers.remove(entry.getKey());
      entry.getValue().onTimeout();
    }
  }
}

Fixed version (ground truth):
private void checkForTimeOuts(long timeOutMS){
  if (debug) {
    logger.debug("String_Node_Str");
  }
  final ArrayList<Map.Entry<HandlerKey,Callback<Object>>> entries=new ArrayList<>(handlers.entrySet());
  for (  Map.Entry<HandlerKey,Callback<Object>> entry : entries) {
    long duration=now - entry.getKey().timestamp;
    if (duration > timeOutMS) {
      if (debug)       logger.debug("String_Node_Str",name,now - entry.getKey().timestamp,entry.getKey().returnAddress,entry.getKey().messageId,new Date(entry.getKey().timestamp));
      handlers.remove(entry.getKey());
      entry.getValue().onTimeout();
    }
  }
}
Program: 3831
Project: 3831
Buggy source:
@Override public void handleResponse(final Response<Object> response){
  final HandlerKey handlerKey=new HandlerKey(response.returnAddress(),response.id(),now);
  final Callback<Object> handler=handlers.get(handlerKey);
  handlers.remove(handlerKey);
  if (handler == null) {
    return;
  }
  if (response.wasErrors()) {
    if (debug) {
      logger.debug("String_Node_Str",response.address(),response.returnAddress(),response.id(),response.body());
    }
    if (response.body() instanceof Throwable) {
      handler.onError(((Throwable)response.body()));
    }
 else {
      handler.onError(new Exception(response.body().toString()));
    }
  }
 else {
    handler.accept(response.body());
  }
}

Fixed version (ground truth):
@Override public void handleResponse(final Response<Object> response){
  final HandlerKey handlerKey=new HandlerKey(response.returnAddress(),response.address(),response.id(),now);
  final Callback<Object> handler=handlers.remove(handlerKey);
  if (handler == null) {
    logger.error("String_Node_Str",handlerKey);
    return;
  }
  if (response.wasErrors()) {
    if (debug) {
      logger.debug("String_Node_Str",response.address(),response.returnAddress(),response.id(),response.body());
    }
    if (response.body() instanceof Throwable) {
      handler.onError(((Throwable)response.body()));
    }
 else {
      handler.onError(new Exception(response.body().toString()));
    }
  }
 else {
    handler.accept(response.body());
  }
}
Program: 3832
Project: 3832
Buggy source:
HandlerKey(String returnAddress,long messageId,long now){
  this.returnAddress=returnAddress;
  this.messageId=messageId;
  this.timestamp=now;
}

Fixed version (ground truth):
HandlerKey(String returnAddress,String address,long messageId,long timestamp){
  this.returnAddress=returnAddress;
  this.address=address;
  this.messageId=messageId;
  this.timestamp=timestamp;
}
Program: 3833
Project: 3833
Buggy source:
@Override public int hashCode(){
  int result=returnAddress != null ? returnAddress.hashCode() : 0;
  result=31 * result + (int)(messageId ^ (messageId >>> 32));
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int result=returnAddress != null ? returnAddress.hashCode() : 0;
  result=31 * result + (int)(messageId ^ (messageId >>> 32));
  result=31 * result + (int)(timestamp ^ (timestamp >>> 32));
  return result;
}
Program: 3834
Project: 3834
Buggy source:
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  final HandlerKey that=(HandlerKey)o;
  return messageId == that.messageId && !(returnAddress != null ? !returnAddress.equals(that.returnAddress) : that.returnAddress != null);
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (!(o instanceof HandlerKey))   return false;
  HandlerKey that=(HandlerKey)o;
  if (messageId != that.messageId)   return false;
  if (timestamp != that.timestamp)   return false;
  if (returnAddress != null ? !returnAddress.equals(that.returnAddress) : that.returnAddress != null)   return false;
  return true;
}
Program: 3835
Project: 3835
Buggy source:
public EndpointServerBuilder getEndpointServerBuilder(){
  if (endpointServerBuilder == null) {
    endpointServerBuilder=EndpointServerBuilder.endpointServerBuilder();
    endpointServerBuilder.setEnableHealthEndpoint(isEnableLocalHealth());
    endpointServerBuilder.setHealthService(getHealthService());
    endpointServerBuilder.setSystemManager(this.getSystemManager());
    endpointServerBuilder.setHttpServerBuilder(getHttpServerBuilder());
    endpointServerBuilder.setStatsFlushRateSeconds(getSampleStatFlushRate());
    endpointServerBuilder.setCheckTimingEveryXCalls(getCheckTimingEveryXCalls());
    endpointServerBuilder.setServiceDiscovery(getServiceDiscovery());
    endpointServerBuilder.setUri(getRootURI());
    endpointServerBuilder.setupHealthAndStats(getHttpServerBuilder());
    if (isEnableStats()) {
      endpointServerBuilder.setStatsCollector(getStatServiceBuilder().buildStatsCollectorWithAutoFlush());
    }
    if (isEnableLocalStats()) {
      endpointServerBuilder.setEnableStatEndpoint(true);
      endpointServerBuilder.setStatsCollection(getLocalStatsCollectorBuilder().build());
    }
    if (endpointServices != null) {
      endpointServerBuilder.setServices(endpointServices);
    }
  }
  return endpointServerBuilder;
}

Fixed version (ground truth):
public EndpointServerBuilder getEndpointServerBuilder(){
  if (endpointServerBuilder == null) {
    endpointServerBuilder=EndpointServerBuilder.endpointServerBuilder();
    endpointServerBuilder.setEnableHealthEndpoint(isEnableLocalHealth());
    endpointServerBuilder.setEnableStatEndpoint(isEnableLocalStats());
    endpointServerBuilder.setHealthService(getHealthService());
    endpointServerBuilder.setSystemManager(this.getSystemManager());
    endpointServerBuilder.setHttpServerBuilder(getHttpServerBuilder());
    endpointServerBuilder.setStatsFlushRateSeconds(getSampleStatFlushRate());
    endpointServerBuilder.setCheckTimingEveryXCalls(getCheckTimingEveryXCalls());
    endpointServerBuilder.setServiceDiscovery(getServiceDiscovery());
    endpointServerBuilder.setUri(getRootURI());
    if (isEnableStats()) {
      endpointServerBuilder.setStatsCollector(getStatServiceBuilder().buildStatsCollectorWithAutoFlush());
    }
    if (isEnableLocalStats()) {
      endpointServerBuilder.setEnableStatEndpoint(true);
      endpointServerBuilder.setStatsCollection(getLocalStatsCollectorBuilder().build());
    }
    endpointServerBuilder.setupHealthAndStats(getHttpServerBuilder());
    if (endpointServices != null) {
      endpointServerBuilder.setServices(endpointServices);
    }
  }
  return endpointServerBuilder;
}
Program: 3836
Project: 3836
Buggy source:
public RequestContinuePredicate add(Predicate<HttpRequest> predicate){
  predicates.add(predicate);
  return this;
}

Fixed version (ground truth):
public RequestContinuePredicate add(final Predicate<HttpRequest> predicate){
  predicates.add(predicate);
  return this;
}
Program: 3837
Project: 3837
Buggy source:
private void buildQueue(){
  final StatsDReplicator statsDReplicator=createStatsDReplicator();
  final ServiceBuilder serviceBuilder=this.getServiceBuilder();
  serviceBuilder.setServiceObject(statsDReplicator);
  this.serviceQueue=serviceBuilder.build();
}

Fixed version (ground truth):
private void buildQueue(){
  final StatsDReplicator statsDReplicator=createStatsDReplicator();
  final ServiceBuilder serviceBuilder=this.getServiceBuilder();
  serviceBuilder.getRequestQueueBuilder().setUnableToEnqueueHandler(new UnableToEnqueueHandler(){
    @Override public boolean unableToEnqueue(    BlockingQueue<Object> queue,    String queueName){
      final Logger logger=LoggerFactory.getLogger(StatsDReplicator.class);
      logger.error("String_Node_Str" + queueName);
      queue.clear();
      return false;
    }
  }
);
  serviceBuilder.getResponseQueueBuilder().setUnableToEnqueueHandler(new UnableToEnqueueHandler(){
    @Override public boolean unableToEnqueue(    BlockingQueue<Object> queue,    String queueName){
      final Logger logger=LoggerFactory.getLogger(StatsDReplicator.class);
      logger.error("String_Node_Str" + queueName);
      queue.clear();
      return false;
    }
  }
);
  serviceBuilder.setServiceObject(statsDReplicator);
  this.serviceQueue=serviceBuilder.buildAndStartAll();
}
Program: 3838
Project: 3838
Buggy source:
public StatReplicator buildAndStart(){
  buildQueue();
  final StatReplicator proxyWithAutoFlush=serviceQueue.createProxyWithAutoFlush(StatReplicator.class,100,TimeUnit.MILLISECONDS);
  serviceQueue.start();
  return proxyWithAutoFlush;
}

Fixed version (ground truth):
public StatReplicator buildAndStart(){
  buildQueue();
  final StatReplicator proxyWithAutoFlush=serviceQueue.createProxyWithAutoFlush(StatReplicator.class,100,TimeUnit.MILLISECONDS);
  return proxyWithAutoFlush;
}
Program: 3839
Project: 3839
Buggy source:
public <T>Queue<T> build(){
  return new BasicQueue<>(this.getName(),this.getPollWait(),this.getPollTimeUnit(),this.getEnqueueTimeout(),this.getEnqueueTimeoutTimeUnit(),this.getBatchSize(),this.queueClass,this.isCheckIfBusy(),this.getSize(),this.getCheckEvery(),this.isTryTransfer());
}

Fixed version (ground truth):
public <T>Queue<T> build(){
  return new BasicQueue<>(this.getName(),this.getPollWait(),this.getPollTimeUnit(),this.getEnqueueTimeout(),this.getEnqueueTimeoutTimeUnit(),this.getBatchSize(),this.getQueueClass(),this.isCheckIfBusy(),this.getSize(),this.getCheckEvery(),this.isTryTransfer(),this.getUnableToEnqueueHandler());
}
Program: 3840
Project: 3840
Buggy source:
void send(T item);

Fixed version (ground truth):
boolean send(T item);
Program: 3841
Project: 3841
Buggy source:
@Override public void send(T item){
  try {
    lock.lock();
    sendQueue.send(item);
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override public boolean send(T item){
  try {
    lock.lock();
    return sendQueue.send(item);
  }
  finally {
    lock.unlock();
  }
}
Program: 3842
Project: 3842
Buggy source:
/** 
 * This returns a new instance of SendQueue every time you call it so call it only once per thread.
 * @return sendQueue.
 */
@Override public SendQueue<T> sendQueue(){
  logger.info("String_Node_Str",name);
  return new BasicSendQueue<>(name,batchSize,queue,checkIfBusy,checkEvery,tryTransfer,enqueueTimeoutTimeUnit,enqueueTimeout);
}

Fixed version (ground truth):
/** 
 * This returns a new instance of SendQueue every time you call it so call it only once per thread.
 * @return sendQueue.
 */
@Override public SendQueue<T> sendQueue(){
  logger.info("String_Node_Str",name);
  return new BasicSendQueue<>(name,batchSize,queue,checkIfBusy,checkEvery,tryTransfer,enqueueTimeoutTimeUnit,enqueueTimeout,unableToEnqueueHandler);
}
Program: 3844
Project: 3844
Buggy source:
/** 
 * Add a task that gets repeated. 
 */
public void addRepeatingTask(final long repeatEvery,final TimeUnit timeUnit,final Runnable task){
  repeatingTasks.add(new RepeatingTask(task,timeUnit,repeatEvery));
}

Fixed version (ground truth):
/** 
 * Add a task that gets repeated.
 * @param repeatEvery repeat Every time period
 * @param timeUnit unit for repeatEvery
 * @param task task to perform
 */
public void addRepeatingTask(final long repeatEvery,final TimeUnit timeUnit,final Runnable task){
  repeatingTasks.add(new RepeatingTask(task,timeUnit,repeatEvery));
}
Program: 3845
Project: 3845
Buggy source:
void pickSuggestions2(Callback<String> returnValue,String username){
  count++;
  totalCount.incrementAndGet();
  returnValue.accept(username);
}

Fixed version (ground truth):
void pickSuggestions2(Callback<String> returnValue,String username){
  count++;
  returnValue.accept(username);
}
Program: 3846
Project: 3846
Buggy source:
@Test public void test(){
  final MultiWorkerClient worker=bundle.createLocalProxy(MultiWorkerClient.class,"String_Node_Str");
  for (int index=0; index < 200; index++) {
    worker.pickSuggestions("String_Node_Str" + index);
  }
  worker.clientProxyFlush();
  Sys.sleep(1000);
  super.waitForTrigger(10,o -> ContentRulesEngine.totalCount.get() >= 200);
  ok=ContentRulesEngine.totalCount.get() == 200 || die(ContentRulesEngine.totalCount);
}

Fixed version (ground truth):
@Test public void test(){
  final MultiWorkerClient worker=bundle.createLocalProxy(MultiWorkerClient.class,"String_Node_Str");
  for (int index=0; index < 200; index++) {
    worker.pickSuggestions("String_Node_Str" + index);
  }
  worker.clientProxyFlush();
  Sys.sleep(1000);
  super.waitForTrigger(10,o -> ContentRulesEngine.totalCount.get() >= 200);
  assertEquals(200,ContentRulesEngine.totalCount.get());
}
Program: 3847
Project: 3847
Buggy source:
@Test public void testCheckInOk() throws Exception {
  healthService.register("String_Node_Str",1,TimeUnit.SECONDS);
  healthService.checkInOk("String_Node_Str");
  countDownLatch=new CountDownLatch(1);
  result=new AtomicBoolean();
  healthService.findHealthyNodes(names -> {
    result.set(names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  countDownLatch.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
}

Fixed version (ground truth):
@Test public void testCheckInOk() throws Exception {
  final CountDownLatch countDownLatch=new CountDownLatch(1);
  final AtomicBoolean result=new AtomicBoolean();
  healthService.register("String_Node_Str",1,TimeUnit.SECONDS);
  healthService.checkInOk("String_Node_Str");
  healthService.findHealthyNodes(names -> {
    result.set(names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  countDownLatch.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
}
Program: 3848
Project: 3848
Buggy source:
@Test public void forceTTLExpire() throws Exception {
  healthService.register("String_Node_Str",1,TimeUnit.SECONDS);
  healthService.checkIn("String_Node_Str",HealthStatus.PASS);
  countDownLatch=new CountDownLatch(1);
  result=new AtomicBoolean();
  healthService.findAllNodes(names -> {
    result.set(names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  countDownLatch.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
  timer.setTime();
  timer.minutes(1);
  Sys.sleep(1000);
  healthService.clientProxyFlush();
  countDownLatch=new CountDownLatch(1);
  result=new AtomicBoolean();
  healthService.findHealthyNodes(names -> {
    result.set(!names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  countDownLatch.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
}

Fixed version (ground truth):
@Test public void forceTTLExpire() throws Exception {
  final CountDownLatch countDownLatch=new CountDownLatch(1);
  final AtomicBoolean result=new AtomicBoolean();
  healthService.register("String_Node_Str",1,TimeUnit.SECONDS);
  healthService.checkIn("String_Node_Str",HealthStatus.PASS);
  healthService.findAllNodes(names -> {
    result.set(names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  countDownLatch.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
  timer.setTime();
  timer.minutes(1);
  Sys.sleep(1000);
  healthService.clientProxyFlush();
  final CountDownLatch countDownLatch2=new CountDownLatch(1);
  result.set(false);
  healthService.findHealthyNodes(names -> {
    result.set(!names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch2.countDown();
  }
);
  countDownLatch2.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
}
Program: 3849
Project: 3849
Buggy source:
@Test public void testRegister() throws Exception {
  healthService.register("String_Node_Str",1,TimeUnit.SECONDS);
  healthService.clientProxyFlush();
  countDownLatch=new CountDownLatch(1);
  result=new AtomicBoolean();
  healthService.findAllNodes(names -> {
    result.set(names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  healthService.clientProxyFlush();
  countDownLatch.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
  countDownLatch=new CountDownLatch(1);
  result=new AtomicBoolean();
  healthService.findHealthyNodes(names -> {
    result.set(!names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  countDownLatch=new CountDownLatch(1);
  result=new AtomicBoolean();
  healthService.findHealthyNodes(names -> {
    result.set(names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  countDownLatch.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
}

Fixed version (ground truth):
@Test public void testRegister() throws Exception {
  final AtomicBoolean result=new AtomicBoolean();
  healthService.register("String_Node_Str",1,TimeUnit.SECONDS);
  final CountDownLatch countDownLatch=new CountDownLatch(1);
  healthService.findAllNodes(names -> {
    result.set(names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  countDownLatch.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
  healthService.unregister("String_Node_Str");
  final CountDownLatch countDownLatch2=new CountDownLatch(1);
  result.set(false);
  healthService.findAllNodes(names -> {
    result.set(!names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch2.countDown();
  }
);
  countDownLatch2.await(10,TimeUnit.SECONDS);
}
Program: 3850
Project: 3850
Buggy source:
@Test public void transitionFromPassToFail() throws Exception {
  healthService.register("String_Node_Str",1,TimeUnit.SECONDS);
  healthService.checkIn("String_Node_Str",HealthStatus.PASS);
  countDownLatch=new CountDownLatch(1);
  result=new AtomicBoolean();
  healthService.findHealthyNodes(names -> {
    result.set(names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  countDownLatch.await(10,TimeUnit.SECONDS);
  healthService.checkIn("String_Node_Str",HealthStatus.FAIL);
  countDownLatch=new CountDownLatch(1);
  result=new AtomicBoolean();
  healthService.findHealthyNodes(names -> {
    result.set(!names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  countDownLatch.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
}

Fixed version (ground truth):
@Test public void transitionFromPassToFail() throws Exception {
  final CountDownLatch countDownLatch=new CountDownLatch(1);
  final AtomicBoolean result=new AtomicBoolean();
  healthService.register("String_Node_Str",1,TimeUnit.SECONDS);
  healthService.checkIn("String_Node_Str",HealthStatus.PASS);
  healthService.findHealthyNodes(names -> {
    result.set(names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  countDownLatch.await(10,TimeUnit.SECONDS);
  healthService.checkIn("String_Node_Str",HealthStatus.FAIL);
  final CountDownLatch countDownLatch2=new CountDownLatch(1);
  result.set(false);
  healthService.findHealthyNodes(names -> {
    result.set(!names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch2.countDown();
  }
);
  countDownLatch2.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
}
Program: 3851
Project: 3851
Buggy source:
@Test public void testCheckInOkUsingCheckIn() throws Exception {
  healthService.register("String_Node_Str",1,TimeUnit.SECONDS);
  healthService.checkIn("String_Node_Str",HealthStatus.PASS);
  countDownLatch=new CountDownLatch(1);
  result=new AtomicBoolean();
  healthService.findHealthyNodes(names -> {
    result.set(names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  countDownLatch.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
}

Fixed version (ground truth):
@Test public void testCheckInOkUsingCheckIn() throws Exception {
  final CountDownLatch countDownLatch=new CountDownLatch(1);
  final AtomicBoolean result=new AtomicBoolean();
  healthService.register("String_Node_Str",1,TimeUnit.SECONDS);
  healthService.checkIn("String_Node_Str",HealthStatus.PASS);
  healthService.findHealthyNodes(names -> {
    result.set(names.stream().anyMatch(s -> s.equals("String_Node_Str")));
    countDownLatch.countDown();
  }
);
  ServiceProxyUtils.flushServiceProxy(healthService);
  countDownLatch.await(10,TimeUnit.SECONDS);
  assertTrue("String_Node_Str",result.get());
}
Program: 3852
Project: 3852
Buggy source:
@Test public void testUsingProxyWithAutoFlush(){
  ServiceQueue serviceQueue=serviceBuilder().setServiceAddress("String_Node_Str").setServiceObject(new TodoService()).build();
  serviceQueue.startServiceQueue().startCallBackHandler();
  TodoServiceClient todoServiceClient=serviceQueue.createProxyWithAutoFlush(TodoServiceClient.class,50,TimeUnit.MILLISECONDS);
  todoServiceClient.add(new TodoItem("String_Node_Str","String_Node_Str",null));
  AtomicReference<List<TodoItem>> items=new AtomicReference<>();
  todoServiceClient.list(todoItems -> items.set(todoItems));
  Sys.sleep(2000);
  ok=items.get() != null || die();
  ok=items.get().size() > 0 || die();
  ok=items.get().get(0).getDescription().equals("String_Node_Str") || die();
}

Fixed version (ground truth):
@Test public void testUsingProxyWithAutoFlush(){
  ServiceQueue serviceQueue=serviceBuilder().setServiceAddress("String_Node_Str").setServiceObject(new TodoService()).build();
  TodoServiceClient todoServiceClient=serviceQueue.createProxyWithAutoFlush(TodoServiceClient.class,25,TimeUnit.MILLISECONDS);
  serviceQueue.start();
  serviceQueue.startServiceQueue().startCallBackHandler();
  todoServiceClient.add(new TodoItem("String_Node_Str","String_Node_Str",null));
  AtomicReference<List<TodoItem>> items=new AtomicReference<>();
  todoServiceClient.list(todoItems -> items.set(todoItems));
  Sys.sleep(2000);
  ok=items.get() != null || die();
  ok=items.get().size() > 0 || die();
  ok=items.get().get(0).getDescription().equals("String_Node_Str") || die();
}
Program: 3853
Project: 3853
Buggy source:
@Override public void unregisterServices(final ConcurrentHashSet<EndpointDefinition> endpointDefinitions){
  for (  EndpointDefinition definition : endpointDefinitions) {
    Consul consul=consulThreadLocal.get();
    try {
      consul.agent().deregister(definition.getId());
    }
 catch (    Exception ex) {
      handleConsulRecovery(consul,ex);
    }
  }
}

Fixed version (ground truth):
@Override public void unregisterServices(final ConcurrentHashSet<EndpointDefinition> endpointDefinitions){
  for (  EndpointDefinition definition : endpointDefinitions) {
    Consul consul=consul();
    try {
      consul.agent().deregister(definition.getId());
    }
 catch (    Exception ex) {
      handleConsulRecovery(consul,ex);
    }
 finally {
      shutDownConsul(consul);
    }
  }
}
Program: 3854
Project: 3854
Buggy source:
private void shutDownConsul(Consul consul){
  try {
    consul.stop();
  }
 catch (  Exception ex) {
    logger.warn("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
private void shutDownConsul(Consul consul){
  try {
    if (consul != null) {
      consul.stop();
    }
  }
 catch (  Exception ex) {
    logger.warn("String_Node_Str",ex);
  }
}
Program: 3855
Project: 3855
Buggy source:
@Override public void registerServices(final Queue<EndpointDefinition> registerQueue){
  if (trace) {
    logger.trace(sputs("String_Node_Str",registerQueue));
  }
  EndpointDefinition endpointDefinition=registerQueue.poll();
  if (endpointDefinition != null) {
    Consul consul=consulThreadLocal.get();
    while (endpointDefinition != null) {
      try {
        consul.agent().registerService(endpointDefinition.getPort(),endpointDefinition.getTimeToLive(),endpointDefinition.getName(),endpointDefinition.getId(),tags);
      }
 catch (      Exception ex) {
        handleConsulRecovery(consul,ex);
      }
      endpointDefinition=registerQueue.poll();
    }
  }
}

Fixed version (ground truth):
@Override public void registerServices(final Queue<EndpointDefinition> registerQueue){
  if (trace) {
    logger.trace(sputs("String_Node_Str",registerQueue));
  }
  EndpointDefinition endpointDefinition=registerQueue.poll();
  if (endpointDefinition != null) {
    final Consul consul=consul();
    try {
      while (endpointDefinition != null) {
        try {
          consul.agent().registerService(endpointDefinition.getPort(),endpointDefinition.getTimeToLive(),endpointDefinition.getName(),endpointDefinition.getId(),tags);
        }
 catch (        Exception ex) {
          handleConsulRecovery(consul,ex);
        }
        endpointDefinition=registerQueue.poll();
      }
    }
  finally {
      shutDownConsul(consul);
    }
  }
}
Program: 3856
Project: 3856
Buggy source:
@Override public void checkIn(final Queue<ServiceHealthCheckIn> checkInsQueue){
  if (trace) {
    logger.trace(sputs("String_Node_Str",checkInsQueue));
  }
  ServiceHealthCheckIn checkIn=checkInsQueue.poll();
  if (checkIn != null) {
    Consul consul=consulThreadLocal.get();
    while (checkIn != null) {
      Status status=convertStatus(checkIn.getHealthStatus());
      try {
        consul.agent().checkTtl(checkIn.getServiceId(),status,"String_Node_Str" + checkIn.getHealthStatus());
      }
 catch (      Exception ex) {
        handleConsulRecovery(consul,ex);
      }
      checkIn=checkInsQueue.poll();
    }
  }
}

Fixed version (ground truth):
@Override public void checkIn(final Queue<ServiceHealthCheckIn> checkInsQueue){
  if (trace) {
    logger.trace(sputs("String_Node_Str",checkInsQueue));
  }
  ServiceHealthCheckIn checkIn=checkInsQueue.poll();
  if (checkIn != null) {
    Consul consul=consul();
    try {
      while (checkIn != null) {
        Status status=convertStatus(checkIn.getHealthStatus());
        consul.agent().checkTtl(checkIn.getServiceId(),status,"String_Node_Str" + checkIn.getHealthStatus());
        checkIn=checkInsQueue.poll();
      }
    }
 catch (    Exception ex) {
      handleConsulRecovery(consul,ex);
    }
 finally {
      shutDownConsul(consul);
    }
  }
}
Program: 3857
Project: 3857
Buggy source:
private List<ServiceHealth> getHealthyServices(final String serviceName){
  Consul consul=consulThreadLocal.get();
  try {
    String tag=tags.length > 1 ? tags[0] : null;
    final ConsulResponse<List<ServiceHealth>> consulResponse=consul.health().getHealthyServices(serviceName,datacenter,tag,buildRequestOptions());
    this.lastIndex.set(consulResponse.getIndex());
    final List<ServiceHealth> healthyServices=consulResponse.getResponse();
    return healthyServices;
  }
 catch (  HttpClientClosedConnectionException ex) {
    handleConsulRecovery(consul,ex);
    return Collections.emptyList();
  }
}

Fixed version (ground truth):
private List<ServiceHealth> getHealthyServices(final String serviceName){
  Consul consul=consul();
  try {
    String tag=tags.length > 1 ? tags[0] : null;
    final ConsulResponse<List<ServiceHealth>> consulResponse=consul.health().getHealthyServices(serviceName,datacenter,tag,buildRequestOptions());
    this.lastIndex.set(consulResponse.getIndex());
    final List<ServiceHealth> healthyServices=consulResponse.getResponse();
    return healthyServices;
  }
 catch (  HttpClientClosedConnectionException ex) {
    handleConsulRecovery(consul,ex);
    return Collections.emptyList();
  }
 finally {
    shutDownConsul(consul);
  }
}
Program: 3858
Project: 3858
Buggy source:
public HttpRequestServiceServerHandlerUsingMetaImpl(int timeoutInSeconds,ServiceBundle serviceBundle,JsonMapper jsonMapper,final int numberOfOutstandingRequests,int flushInterval){
  this.timeoutInSeconds=timeoutInSeconds;
  lastTimeoutCheckTime=Timer.timer().now() + (timeoutInSeconds * 1000);
  this.numberOfOutstandingRequests=numberOfOutstandingRequests;
  this.jsonMapper=jsonMapper;
  this.methodCallSendQueue=serviceBundle.methodSendQueue();
  this.flushInterval=flushInterval;
  contextMetaBuilder=ContextMetaBuilder.contextMetaBuilder();
}

Fixed version (ground truth):
public HttpRequestServiceServerHandlerUsingMetaImpl(int timeoutInSeconds,ServiceBundle serviceBundle,JsonMapper jsonMapper,final int numberOfOutstandingRequests,int flushInterval){
  this.timeoutInSeconds=timeoutInSeconds;
  lastTimeoutCheckTime.set(Timer.timer().now() + (timeoutInSeconds * 1000));
  this.numberOfOutstandingRequests=numberOfOutstandingRequests;
  this.jsonMapper=jsonMapper;
  this.methodCallSendQueue=serviceBundle.methodSendQueue();
  this.flushInterval=flushInterval;
  contextMetaBuilder=ContextMetaBuilder.contextMetaBuilder();
}
Program: 3859
Project: 3859
Buggy source:
@Override public void checkTimeoutsForRequests(){
  final long now=Timer.timer().now();
  final long durationSinceLastCheck=now - lastTimeoutCheckTime;
  final long timeoutInMS=timeoutInSeconds * 1000;
  final boolean timedOut=durationSinceLastCheck > timeoutInMS;
  if (!(timedOut)) {
    return;
  }
  if (debug) {
    puts("String_Node_Str","String_Node_Str",durationSinceLastCheck,"String_Node_Str",timeoutInMS);
  }
  executorService.submit(new Runnable(){
    @Override public void run(){
      lastTimeoutCheckTime=now;
      long duration;
      final Set<Map.Entry<String,Request<Object>>> entries=outstandingRequestMap.entrySet();
      for (      Map.Entry<String,Request<Object>> requestEntry : entries) {
        final Request<Object> request=requestEntry.getValue();
        duration=now - request.timestamp();
        if (duration > timeoutInMS) {
          if (!request.isHandled()) {
            if (debug) {
              puts("String_Node_Str","String_Node_Str",duration,"String_Node_Str",timeoutInMS);
            }
            handleMethodTimedOut(requestEntry.getKey(),request);
          }
        }
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void checkTimeoutsForRequests(){
  final long now=Timer.timer().now();
  final long durationSinceLastCheck=now - lastTimeoutCheckTime.get();
  final long timeoutInMS=timeoutInSeconds * 1000;
  final boolean timedOut=durationSinceLastCheck > timeoutInMS;
  if (!(timedOut)) {
    return;
  }
  lastTimeoutCheckTime.set(now);
  long duration;
  final Set<Map.Entry<String,Request<Object>>> entries=outstandingRequestMap.entrySet();
  for (  Map.Entry<String,Request<Object>> requestEntry : entries) {
    final Request<Object> request=requestEntry.getValue();
    final String key=requestEntry.getKey();
    if (request.isHandled()) {
      request.handled();
      outstandingRequestMap.remove(key);
      continue;
    }
    duration=now - request.timestamp();
    if (duration > timeoutInMS) {
      final HttpResponseReceiver httpResponse=((HttpRequest)request).getReceiver();
      try {
        httpResponse.response(408,"String_Node_Str","String_Node_Str");
      }
 catch (      Exception ex) {
        logger.debug("String_Node_Str" + request,ex);
      }
    }
  }
}
Program: 3860
Project: 3860
Buggy source:
@Override public void handleResponseFromServiceToHttpResponse(Response<Object> response,HttpRequest originatingRequest){
  String key=Str.add("String_Node_Str" + originatingRequest.id(),"String_Node_Str",originatingRequest.returnAddress());
  this.outstandingRequestMap.remove(key);
  final HttpRequest httpRequest=originatingRequest;
  if (response.wasErrors()) {
    Object obj=response.body();
    if (obj instanceof ServiceMethodNotFoundException) {
      writeResponse(httpRequest.getReceiver(),404,"String_Node_Str",jsonMapper.toJson(response.body()),httpRequest.getHeaders());
    }
 else {
      writeResponse(httpRequest.getReceiver(),500,"String_Node_Str",jsonMapper.toJson(response.body()),httpRequest.getHeaders());
    }
  }
 else {
    writeResponse(httpRequest.getReceiver(),200,"String_Node_Str",jsonMapper.toJson(response.body()),httpRequest.getHeaders());
  }
}

Fixed version (ground truth):
@Override public void handleResponseFromServiceToHttpResponse(final Response<Object> response,final HttpRequest originatingRequest){
  String key=Str.add("String_Node_Str" + originatingRequest.id(),"String_Node_Str",originatingRequest.returnAddress());
  this.outstandingRequestMap.remove(key);
  final HttpRequest httpRequest=originatingRequest;
  if (response.wasErrors()) {
    Object obj=response.body();
    if (obj instanceof ServiceMethodNotFoundException) {
      writeResponse(httpRequest.getReceiver(),404,"String_Node_Str",jsonMapper.toJson(response.body()),httpRequest.getHeaders());
    }
 else {
      writeResponse(httpRequest.getReceiver(),500,"String_Node_Str",jsonMapper.toJson(response.body()),httpRequest.getHeaders());
    }
  }
 else {
    writeResponse(httpRequest.getReceiver(),200,"String_Node_Str",jsonMapper.toJson(response.body()),httpRequest.getHeaders());
  }
}
Program: 3861
Project: 3861
Buggy source:
@Override public boolean isHandled(){
  return handled;
}

Fixed version (ground truth):
@Override public synchronized boolean isHandled(){
  return handled;
}
Program: 3862
Project: 3862
Buggy source:
@Override public void handled(){
  handled=true;
}

Fixed version (ground truth):
@Override public synchronized void handled(){
  handled=true;
}
Program: 3863
Project: 3863
Buggy source:
private void flushEventManagerCalls(){
  final EventManager eventManager=factory().eventManagerProxy();
  if (eventManager != null) {
    ServiceProxyUtils.flushServiceProxy(eventManager);
    factory().clearEventManagerProxy();
  }
}

Fixed version (ground truth):
private void flushEventManagerCalls(){
  final EventManager eventManager=factory.eventManagerProxy();
  if (eventManager != null) {
    ServiceProxyUtils.flushServiceProxy(eventManager);
    factory.clearEventManagerProxy();
  }
}