nus-yam/ex-repair huggingface dataset:
Program: 45729
Project: 45729
Buggy source:
@Override protected void processMessage() throws Exception {
  ClientEndpoint endpoint=getEndpoint();
  OperationFactory operationFactory=new OperationFactoryWrapper(createOperationFactory(),endpoint.getUuid());
  final InternalOperationService operationService=nodeEngine.getOperationService();
  Map<Integer,Object> map=operationService.invokeOnAllPartitions(getServiceName(),operationFactory);
  sendResponse(reduce(map));
}

Fixed version (ground truth):
@Override protected void processMessage() throws Exception {
  OperationFactory operationFactory=new OperationFactoryWrapper(createOperationFactory(),endpoint.getUuid());
  final InternalOperationService operationService=nodeEngine.getOperationService();
  Map<Integer,Object> map=operationService.invokeOnAllPartitions(getServiceName(),operationFactory);
  sendResponse(reduce(map));
}
Program: 45730
Project: 45730
Buggy source:
@Override protected void processMessage(){
  final ClientEndpoint endpoint=getEndpoint();
  Operation op=prepareOperation();
  op.setCallerUuid(endpoint.getUuid());
  InvocationBuilder builder=getInvocationBuilder(op).setExecutionCallback(this).setResultDeserialized(false);
  builder.invoke();
}

Fixed version (ground truth):
@Override protected void processMessage(){
  Operation op=prepareOperation();
  op.setCallerUuid(endpoint.getUuid());
  InvocationBuilder builder=getInvocationBuilder(op).setExecutionCallback(this).setResultDeserialized(false);
  builder.invoke();
}
Program: 45731
Project: 45731
Buggy source:
protected AbstractMessageTask(ClientMessage clientMessage,Node node,Connection connection){
  this.clientMessage=clientMessage;
  this.logger=node.getLogger(getClass());
  this.node=node;
  this.nodeEngine=node.nodeEngine;
  this.serializationService=node.getSerializationService();
  this.connection=connection;
  this.clientEngine=node.clientEngine;
  this.endpointManager=clientEngine.getEndpointManager();
  this.endpoint=getEndpoint();
}

Fixed version (ground truth):
protected AbstractMessageTask(ClientMessage clientMessage,Node node,Connection connection){
  this.clientMessage=clientMessage;
  this.logger=node.getLogger(getClass());
  this.node=node;
  this.nodeEngine=node.nodeEngine;
  this.serializationService=node.getSerializationService();
  this.connection=connection;
  this.clientEngine=node.clientEngine;
  this.endpointManager=clientEngine.getEndpointManager();
  this.endpoint=initEndpoint();
}
Program: 45732
Project: 45732
Buggy source:
@Override public void run(){
  try {
    if (isAuthenticationMessage()) {
      initializeAndProcessMessage();
    }
 else {
      ClientEndpoint endpoint=getEndpoint();
      if (endpoint == null) {
        handleMissingEndpoint();
      }
 else       if (!endpoint.isAuthenticated()) {
        handleAuthenticationFailure();
      }
 else {
        initializeAndProcessMessage();
      }
    }
  }
 catch (  Throwable e) {
    handleProcessingFailure(e);
  }
}

Fixed version (ground truth):
@Override public final void run(){
  try {
    doRun();
  }
 catch (  Throwable e) {
    handleProcessingFailure(e);
  }
}
Program: 45733
Project: 45733
Buggy source:
private void initializeAndProcessMessage() throws Throwable {
  if (!node.getNodeExtension().isStartCompleted()) {
    throw new HazelcastInstanceNotActiveException("String_Node_Str");
  }
  parameters=decodeClientMessage(clientMessage);
  Credentials credentials=endpoint.getCredentials();
  interceptBefore(credentials);
  checkPermissions(endpoint);
  processMessage();
  interceptAfter(credentials);
}

Fixed version (ground truth):
void initializeAndProcessMessage() throws Throwable {
  if (!node.getNodeExtension().isStartCompleted()) {
    throw new HazelcastInstanceNotActiveException("String_Node_Str");
  }
  parameters=decodeClientMessage(clientMessage);
  Credentials credentials=endpoint.getCredentials();
  interceptBefore(credentials);
  checkPermissions(endpoint);
  processMessage();
  interceptAfter(credentials);
}
Program: 45734
Project: 45734
Buggy source:
@Override protected Object call() throws Exception {
  ClientEndpoint endpoint=getEndpoint();
  OperationFactory operationFactory=new OperationFactoryWrapper(createOperationFactory(),endpoint.getUuid());
  final InternalOperationService operationService=nodeEngine.getOperationService();
  Map<Integer,Object> map=operationService.invokeOnPartitions(getServiceName(),operationFactory,getPartitions());
  return reduce(map);
}

Fixed version (ground truth):
@Override protected Object call() throws Exception {
  OperationFactory operationFactory=new OperationFactoryWrapper(createOperationFactory(),endpoint.getUuid());
  final InternalOperationService operationService=nodeEngine.getOperationService();
  Map<Integer,Object> map=operationService.invokeOnPartitions(getServiceName(),operationFactory,getPartitions());
  return reduce(map);
}
Program: 45735
Project: 45735
Buggy source:
@Override protected Object call(){
  String serviceName=ClusterServiceImpl.SERVICE_NAME;
  ClusterServiceImpl service=getService(serviceName);
  ClientEndpoint endpoint=getEndpoint();
  String registrationId=service.addMembershipListener(new MembershipListenerImpl(endpoint));
  endpoint.addListenerDestroyAction(serviceName,serviceName,registrationId);
  return registrationId;
}

Fixed version (ground truth):
@Override protected Object call(){
  String serviceName=ClusterServiceImpl.SERVICE_NAME;
  ClusterServiceImpl service=getService(serviceName);
  String registrationId=service.addMembershipListener(new MembershipListenerImpl(endpoint));
  endpoint.addListenerDestroyAction(serviceName,serviceName,registrationId);
  return registrationId;
}
Program: 45736
Project: 45736
Buggy source:
public AuthenticationBaseMessageTask(ClientMessage clientMessage,Node node,Connection connection){
  super(clientMessage,node,connection);
}

Fixed version (ground truth):
AuthenticationBaseMessageTask(ClientMessage clientMessage,Node node,Connection connection){
  super(clientMessage,node,connection);
}
Program: 45737
Project: 45737
Buggy source:
@Override protected Object call() throws Exception {
  getEndpoint().setClientStatistics(parameters.stats);
  return null;
}

Fixed version (ground truth):
@Override protected Object call() throws Exception {
  endpoint.setClientStatistics(parameters.stats);
  return null;
}
Program: 45738
Project: 45738
Buggy source:
@Override protected Object call(){
  ClientEndpoint endpoint=getEndpoint();
  CacheService cacheService=getService(CacheService.SERVICE_NAME);
  CacheContext cacheContext=cacheService.getOrCreateCacheContext(parameters.name);
  NearCacheInvalidationListener listener=new NearCacheInvalidationListener(endpoint,cacheContext,nodeEngine.getLocalMember().getUuid(),clientMessage.getCorrelationId());
  String registrationId=cacheService.addInvalidationListener(parameters.name,listener,parameters.localOnly);
  endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME,parameters.name,registrationId);
  return registrationId;
}

Fixed version (ground truth):
@Override protected Object call(){
  CacheService cacheService=getService(CacheService.SERVICE_NAME);
  CacheContext cacheContext=cacheService.getOrCreateCacheContext(parameters.name);
  NearCacheInvalidationListener listener=new NearCacheInvalidationListener(endpoint,cacheContext,nodeEngine.getLocalMember().getUuid(),clientMessage.getCorrelationId());
  String registrationId=cacheService.addInvalidationListener(parameters.name,listener,parameters.localOnly);
  endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME,parameters.name,registrationId);
  return registrationId;
}
Program: 45739
Project: 45739
Buggy source:
@Override protected Object call(){
  final ClientEndpoint endpoint=getEndpoint();
  CachePartitionLostListener listener=new CachePartitionLostListener(){
    @Override public void partitionLost(    CachePartitionLostEvent event){
      if (endpoint.isAlive()) {
        ClientMessage eventMessage=CacheAddPartitionLostListenerCodec.encodeCachePartitionLostEvent(event.getPartitionId(),event.getMember().getUuid());
        sendClientMessage(null,eventMessage);
      }
    }
  }
;
  InternalCachePartitionLostListenerAdapter listenerAdapter=new InternalCachePartitionLostListenerAdapter(listener);
  EventFilter filter=new CachePartitionLostEventFilter();
  CacheService service=getService(CacheService.SERVICE_NAME);
  EventService eventService=service.getNodeEngine().getEventService();
  EventRegistration registration;
  if (parameters.localOnly) {
    registration=eventService.registerLocalListener(ICacheService.SERVICE_NAME,parameters.name,filter,listenerAdapter);
  }
 else {
    registration=eventService.registerListener(ICacheService.SERVICE_NAME,parameters.name,filter,listenerAdapter);
  }
  String registrationId=registration.getId();
  endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME,parameters.name,registrationId);
  return registrationId;
}

Fixed version (ground truth):
@Override protected Object call(){
  CachePartitionLostListener listener=new CachePartitionLostListener(){
    @Override public void partitionLost(    CachePartitionLostEvent event){
      if (endpoint.isAlive()) {
        ClientMessage eventMessage=CacheAddPartitionLostListenerCodec.encodeCachePartitionLostEvent(event.getPartitionId(),event.getMember().getUuid());
        sendClientMessage(null,eventMessage);
      }
    }
  }
;
  InternalCachePartitionLostListenerAdapter listenerAdapter=new InternalCachePartitionLostListenerAdapter(listener);
  EventFilter filter=new CachePartitionLostEventFilter();
  CacheService service=getService(CacheService.SERVICE_NAME);
  EventService eventService=service.getNodeEngine().getEventService();
  EventRegistration registration;
  if (parameters.localOnly) {
    registration=eventService.registerLocalListener(ICacheService.SERVICE_NAME,parameters.name,filter,listenerAdapter);
  }
 else {
    registration=eventService.registerListener(ICacheService.SERVICE_NAME,parameters.name,filter,listenerAdapter);
  }
  String registrationId=registration.getId();
  endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME,parameters.name,registrationId);
  return registrationId;
}
Program: 45740
Project: 45740
Buggy source:
private CacheConfig extractCacheConfigFromMessage(){
  int clientVersion=getClientVersion();
  if (BuildInfo.UNKNOWN_HAZELCAST_VERSION == clientVersion) {
    boolean compatibilityEnabled=nodeEngine.getProperties().getBoolean(GroupProperty.COMPATIBILITY_3_6_CLIENT_ENABLED);
    if (compatibilityEnabled) {
      LegacyCacheConfig legacyCacheConfig=nodeEngine.toObject(parameters.cacheConfig,LegacyCacheConfig.class);
      if (null == legacyCacheConfig) {
        return null;
      }
      return legacyCacheConfig.getConfigAndReset();
    }
  }
  return (CacheConfig)nodeEngine.toObject(parameters.cacheConfig);
}

Fixed version (ground truth):
private CacheConfig extractCacheConfigFromMessage(){
  int clientVersion=endpoint.getClientVersion();
  if (BuildInfo.UNKNOWN_HAZELCAST_VERSION == clientVersion) {
    boolean compatibilityEnabled=nodeEngine.getProperties().getBoolean(GroupProperty.COMPATIBILITY_3_6_CLIENT_ENABLED);
    if (compatibilityEnabled) {
      LegacyCacheConfig legacyCacheConfig=nodeEngine.toObject(parameters.cacheConfig,LegacyCacheConfig.class);
      if (null == legacyCacheConfig) {
        return null;
      }
      return legacyCacheConfig.getConfigAndReset();
    }
  }
  return (CacheConfig)nodeEngine.toObject(parameters.cacheConfig);
}
Program: 45741
Project: 45741
Buggy source:
private Data serializeCacheConfig(Object response){
  Data responseData=null;
  if (BuildInfo.UNKNOWN_HAZELCAST_VERSION == getClientVersion()) {
    boolean compatibilityEnabled=nodeEngine.getProperties().getBoolean(GroupProperty.COMPATIBILITY_3_6_CLIENT_ENABLED);
    if (compatibilityEnabled) {
      responseData=nodeEngine.toData(response == null ? null : new LegacyCacheConfig((CacheConfig)response));
    }
  }
  if (null == responseData) {
    responseData=nodeEngine.toData(response);
  }
  return responseData;
}

Fixed version (ground truth):
private Data serializeCacheConfig(Object response){
  Data responseData=null;
  if (BuildInfo.UNKNOWN_HAZELCAST_VERSION == endpoint.getClientVersion()) {
    boolean compatibilityEnabled=nodeEngine.getProperties().getBoolean(GroupProperty.COMPATIBILITY_3_6_CLIENT_ENABLED);
    if (compatibilityEnabled) {
      responseData=nodeEngine.toData(response == null ? null : new LegacyCacheConfig((CacheConfig)response));
    }
  }
  if (null == responseData) {
    responseData=nodeEngine.toData(response);
  }
  return responseData;
}
Program: 45742
Project: 45742
Buggy source:
private Data serializeCacheConfig(Object response){
  Data responseData=null;
  if (BuildInfo.UNKNOWN_HAZELCAST_VERSION == getClientVersion()) {
    boolean compatibilityEnabled=nodeEngine.getProperties().getBoolean(GroupProperty.COMPATIBILITY_3_6_CLIENT_ENABLED);
    if (compatibilityEnabled) {
      responseData=nodeEngine.toData(response == null ? null : new LegacyCacheConfig((CacheConfig)response));
    }
  }
  if (null == responseData) {
    responseData=nodeEngine.toData(response);
  }
  return responseData;
}

Fixed version (ground truth):
private Data serializeCacheConfig(Object response){
  Data responseData=null;
  if (BuildInfo.UNKNOWN_HAZELCAST_VERSION == endpoint.getClientVersion()) {
    boolean compatibilityEnabled=nodeEngine.getProperties().getBoolean(GroupProperty.COMPATIBILITY_3_6_CLIENT_ENABLED);
    if (compatibilityEnabled) {
      responseData=nodeEngine.toData(response == null ? null : new LegacyCacheConfig((CacheConfig)response));
    }
  }
  if (null == responseData) {
    responseData=nodeEngine.toData(response);
  }
  return responseData;
}
Program: 45743
Project: 45743
Buggy source:
@Override protected Object call(){
  ClientEndpoint endpoint=getEndpoint();
  CacheService cacheService=getService(CacheService.SERVICE_NAME);
  CacheContext cacheContext=cacheService.getOrCreateCacheContext(parameters.name);
  String uuid=nodeEngine.getLocalMember().getUuid();
  long correlationId=clientMessage.getCorrelationId();
  Pre38NearCacheInvalidationListener listener=new Pre38NearCacheInvalidationListener(endpoint,cacheContext,uuid,correlationId);
  String registrationId=cacheService.addInvalidationListener(parameters.name,listener,parameters.localOnly);
  endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME,parameters.name,registrationId);
  return registrationId;
}

Fixed version (ground truth):
@Override protected Object call(){
  CacheService cacheService=getService(CacheService.SERVICE_NAME);
  CacheContext cacheContext=cacheService.getOrCreateCacheContext(parameters.name);
  String uuid=nodeEngine.getLocalMember().getUuid();
  long correlationId=clientMessage.getCorrelationId();
  Pre38NearCacheInvalidationListener listener=new Pre38NearCacheInvalidationListener(endpoint,cacheContext,uuid,correlationId);
  String registrationId=cacheService.addInvalidationListener(parameters.name,listener,parameters.localOnly);
  endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME,parameters.name,registrationId);
  return registrationId;
}
Program: 45744
Project: 45744
Buggy source:
@Override protected Operation prepareOperation(){
  SecurityContext securityContext=clientEngine.getSecurityContext();
  Data callableData=parameters.callable;
  if (securityContext != null) {
    Callable callable=serializationService.toObject(parameters.callable);
    Subject subject=getEndpoint().getSubject();
    callable=securityContext.createSecureCallable(subject,callable);
    callableData=serializationService.toData(callable);
  }
  MemberCallableTaskOperation op=new MemberCallableTaskOperation(parameters.name,parameters.uuid,callableData);
  op.setCallerUuid(endpoint.getUuid());
  return op;
}

Fixed version (ground truth):
@Override protected Operation prepareOperation(){
  SecurityContext securityContext=clientEngine.getSecurityContext();
  Data callableData=parameters.callable;
  if (securityContext != null) {
    Callable callable=serializationService.toObject(parameters.callable);
    Subject subject=endpoint.getSubject();
    callable=securityContext.createSecureCallable(subject,callable);
    callableData=serializationService.toData(callable);
  }
  MemberCallableTaskOperation op=new MemberCallableTaskOperation(parameters.name,parameters.uuid,callableData);
  op.setCallerUuid(endpoint.getUuid());
  return op;
}
Program: 45745
Project: 45745
Buggy source:
@Override protected Operation prepareOperation(){
  SecurityContext securityContext=clientEngine.getSecurityContext();
  Data callableData=parameters.callable;
  if (securityContext != null) {
    Subject subject=getEndpoint().getSubject();
    Callable callable=serializationService.toObject(parameters.callable);
    callable=securityContext.createSecureCallable(subject,callable);
    callableData=serializationService.toData(callable);
  }
  return new CallableTaskOperation(parameters.name,parameters.uuid,callableData);
}

Fixed version (ground truth):
@Override protected Operation prepareOperation(){
  SecurityContext securityContext=clientEngine.getSecurityContext();
  Data callableData=parameters.callable;
  if (securityContext != null) {
    Subject subject=endpoint.getSubject();
    Callable callable=serializationService.toObject(parameters.callable);
    callable=securityContext.createSecureCallable(subject,callable);
    callableData=serializationService.toData(callable);
  }
  return new CallableTaskOperation(parameters.name,parameters.uuid,callableData);
}
Program: 45746
Project: 45746
Buggy source:
@Override protected Operation prepareOperation(){
  SecurityContext securityContext=clientEngine.getSecurityContext();
  Data callableData=parameters.callable;
  if (securityContext != null) {
    Subject subject=getEndpoint().getSubject();
    Callable callable=serializationService.toObject(parameters.callable);
    callable=securityContext.createSecureCallable(subject,callable);
    callableData=serializationService.toData(callable);
  }
  return new TaskOperation(parameters.name,callableData);
}

Fixed version (ground truth):
@Override protected Operation prepareOperation(){
  SecurityContext securityContext=clientEngine.getSecurityContext();
  Data callableData=parameters.callable;
  if (securityContext != null) {
    Subject subject=endpoint.getSubject();
    Callable callable=serializationService.toObject(parameters.callable);
    callable=securityContext.createSecureCallable(subject,callable);
    callableData=serializationService.toData(callable);
  }
  return new TaskOperation(parameters.name,callableData);
}
Program: 45747
Project: 45747
Buggy source:
@Override protected Object call(){
  ClientEndpoint endpoint=getEndpoint();
  Data partitionKey=serializationService.toData(parameters.name);
  ItemListener listener=createItemListener(endpoint,partitionKey);
  EventService eventService=clientEngine.getEventService();
  CollectionEventFilter filter=new CollectionEventFilter(parameters.includeValue);
  EventRegistration registration;
  if (parameters.localOnly) {
    registration=eventService.registerLocalListener(getServiceName(),parameters.name,filter,listener);
  }
 else {
    registration=eventService.registerListener(getServiceName(),parameters.name,filter,listener);
  }
  String registrationId=registration.getId();
  endpoint.addListenerDestroyAction(getServiceName(),parameters.name,registrationId);
  return registrationId;
}

Fixed version (ground truth):
@Override protected Object call(){
  Data partitionKey=serializationService.toData(parameters.name);
  ItemListener listener=createItemListener(endpoint,partitionKey);
  EventService eventService=clientEngine.getEventService();
  CollectionEventFilter filter=new CollectionEventFilter(parameters.includeValue);
  EventRegistration registration;
  if (parameters.localOnly) {
    registration=eventService.registerLocalListener(getServiceName(),parameters.name,filter,listener);
  }
 else {
    registration=eventService.registerListener(getServiceName(),parameters.name,filter,listener);
  }
  String registrationId=registration.getId();
  endpoint.addListenerDestroyAction(getServiceName(),parameters.name,registrationId);
  return registrationId;
}
Program: 45748
Project: 45748
Buggy source:
@Override protected Object call(){
  final ClientEndpoint endpoint=getEndpoint();
  final MapService mapService=getService(MapService.SERVICE_NAME);
  Object listener=newMapListener();
  MapServiceContext mapServiceContext=mapService.getMapServiceContext();
  String name=getDistributedObjectName();
  EventFilter eventFilter=getEventFilter();
  String registrationId;
  if (isLocalOnly()) {
    registrationId=mapServiceContext.addLocalEventListener(listener,eventFilter,name);
  }
 else {
    registrationId=mapServiceContext.addEventListener(listener,eventFilter,name);
  }
  endpoint.addListenerDestroyAction(MapService.SERVICE_NAME,name,registrationId);
  return registrationId;
}

Fixed version (ground truth):
@Override protected Object call(){
  final MapService mapService=getService(MapService.SERVICE_NAME);
  Object listener=newMapListener();
  MapServiceContext mapServiceContext=mapService.getMapServiceContext();
  String name=getDistributedObjectName();
  EventFilter eventFilter=getEventFilter();
  String registrationId;
  if (isLocalOnly()) {
    registrationId=mapServiceContext.addLocalEventListener(listener,eventFilter,name);
  }
 else {
    registrationId=mapServiceContext.addEventListener(listener,eventFilter,name);
  }
  endpoint.addListenerDestroyAction(MapService.SERVICE_NAME,name,registrationId);
  return registrationId;
}
Program: 45749
Project: 45749
Buggy source:
@Override protected Object call() throws Exception {
  ClientEndpoint endpoint=getEndpoint();
  return registerListener(endpoint,this);
}

Fixed version (ground truth):
@Override protected Object call() throws Exception {
  return registerListener(endpoint,this);
}
Program: 45750
Project: 45750
Buggy source:
@Override protected Object call(){
  final ClientEndpoint endpoint=getEndpoint();
  final MapService mapService=getService(MapService.SERVICE_NAME);
  final MapPartitionLostListener listener=new MapPartitionLostListener(){
    @Override public void partitionLost(    MapPartitionLostEvent event){
      if (endpoint.isAlive()) {
        ClientMessage eventMessage=MapAddPartitionLostListenerCodec.encodeMapPartitionLostEvent(event.getPartitionId(),event.getMember().getUuid());
        sendClientMessage(null,eventMessage);
      }
    }
  }
;
  MapServiceContext mapServiceContext=mapService.getMapServiceContext();
  String registrationId;
  if (parameters.localOnly) {
    registrationId=mapServiceContext.addLocalPartitionLostListener(listener,parameters.name);
  }
 else {
    registrationId=mapServiceContext.addPartitionLostListener(listener,parameters.name);
  }
  endpoint.addListenerDestroyAction(MapService.SERVICE_NAME,parameters.name,registrationId);
  return registrationId;
}

Fixed version (ground truth):
@Override protected Object call(){
  final MapService mapService=getService(MapService.SERVICE_NAME);
  final MapPartitionLostListener listener=new MapPartitionLostListener(){
    @Override public void partitionLost(    MapPartitionLostEvent event){
      if (endpoint.isAlive()) {
        ClientMessage eventMessage=MapAddPartitionLostListenerCodec.encodeMapPartitionLostEvent(event.getPartitionId(),event.getMember().getUuid());
        sendClientMessage(null,eventMessage);
      }
    }
  }
;
  MapServiceContext mapServiceContext=mapService.getMapServiceContext();
  String registrationId;
  if (parameters.localOnly) {
    registrationId=mapServiceContext.addLocalPartitionLostListener(listener,parameters.name);
  }
 else {
    registrationId=mapServiceContext.addPartitionLostListener(listener,parameters.name);
  }
  endpoint.addListenerDestroyAction(MapService.SERVICE_NAME,parameters.name,registrationId);
  return registrationId;
}
Program: 45751
Project: 45751
Buggy source:
@Override protected Object call() throws Exception {
  ClientEndpoint endpoint=getEndpoint();
  InternalOperationService operationService=nodeEngine.getOperationService();
  Predicate predicate=serializationService.toObject(parameters.predicate);
  if (predicate instanceof PartitionPredicate) {
    return invokeOnPartition((PartitionPredicate)predicate,operationService);
  }
  OperationFactory operationFactory=new OperationFactoryWrapper(createOperationFactory(predicate),endpoint.getUuid());
  Map<Integer,Object> map=operationService.invokeOnAllPartitions(getServiceName(),operationFactory);
  return reduce(map);
}

Fixed version (ground truth):
@Override protected Object call() throws Exception {
  InternalOperationService operationService=nodeEngine.getOperationService();
  Predicate predicate=serializationService.toObject(parameters.predicate);
  if (predicate instanceof PartitionPredicate) {
    return invokeOnPartition((PartitionPredicate)predicate,operationService);
  }
  OperationFactory operationFactory=new OperationFactoryWrapper(createOperationFactory(predicate),endpoint.getUuid());
  Map<Integer,Object> map=operationService.invokeOnAllPartitions(getServiceName(),operationFactory);
  return reduce(map);
}
Program: 45752
Project: 45752
Buggy source:
private void createInvocations(Collection<MemberImpl> members,List<Future> futures){
  final InternalOperationService operationService=nodeEngine.getOperationService();
  final ClientEndpoint endpoint=getEndpoint();
  for (  MemberImpl member : members) {
    Predicate predicate=serializationService.toObject(parameters.predicate);
    AccumulatorInfo accumulatorInfo=AccumulatorInfo.createAccumulatorInfo(parameters.mapName,parameters.cacheName,predicate,parameters.batchSize,parameters.bufferSize,parameters.delaySeconds,false,parameters.populate,parameters.coalesce);
    PublisherCreateOperation operation=new PublisherCreateOperation(accumulatorInfo);
    operation.setCallerUuid(endpoint.getUuid());
    Address address=member.getAddress();
    InvocationBuilder invocationBuilder=operationService.createInvocationBuilder(SERVICE_NAME,operation,address);
    Future future=invocationBuilder.invoke();
    futures.add(future);
  }
}

Fixed version (ground truth):
private void createInvocations(Collection<MemberImpl> members,List<Future> futures){
  final InternalOperationService operationService=nodeEngine.getOperationService();
  for (  MemberImpl member : members) {
    Predicate predicate=serializationService.toObject(parameters.predicate);
    AccumulatorInfo accumulatorInfo=AccumulatorInfo.createAccumulatorInfo(parameters.mapName,parameters.cacheName,predicate,parameters.batchSize,parameters.bufferSize,parameters.delaySeconds,false,parameters.populate,parameters.coalesce);
    PublisherCreateOperation operation=new PublisherCreateOperation(accumulatorInfo);
    operation.setCallerUuid(endpoint.getUuid());
    Address address=member.getAddress();
    InvocationBuilder invocationBuilder=operationService.createInvocationBuilder(SERVICE_NAME,operation,address);
    Future future=invocationBuilder.invoke();
    futures.add(future);
  }
}
Program: 45753
Project: 45753
Buggy source:
private Queue<OutboundFrame> getOutboundQueue(TcpIpConnection connection,boolean priority){
  if (connection.getChannel() instanceof NioChannel) {
    NioChannel nioChannel=(NioChannel)connection.getChannel();
    NioOutboundPipeline outboundPipeline=nioChannel.outboundPipeline();
    return priority ? outboundPipeline.urgentWriteQueue : outboundPipeline.writeQueue;
  }
 else {
    return EMPTY_QUEUE;
  }
}

Fixed version (ground truth):
private Queue<OutboundFrame> getOutboundQueue(TcpIpConnection connection,boolean priority){
  if (connection.getChannel() instanceof NioChannel) {
    NioChannel nioChannel=(NioChannel)connection.getChannel();
    NioOutboundPipeline outboundPipeline=nioChannel.outboundPipeline();
    return priority ? outboundPipeline.priorityWriteQueue : outboundPipeline.writeQueue;
  }
 else {
    return EMPTY_QUEUE;
  }
}
Program: 45754
Project: 45754
Buggy source:
private OutboundFrame poll(){
  OutboundFrame frame=urgentWriteQueue.poll();
  if (frame == null) {
    frame=writeQueue.poll();
    if (frame == null) {
      return null;
    }
    normalFramesWritten.inc();
  }
 else {
    priorityFramesWritten.inc();
  }
  return frame;
}

Fixed version (ground truth):
private OutboundFrame poll(){
  OutboundFrame frame=priorityWriteQueue.poll();
  if (frame == null) {
    frame=writeQueue.poll();
    if (frame == null) {
      return null;
    }
    normalFramesWritten.inc();
  }
 else {
    priorityFramesWritten.inc();
  }
  return frame;
}
Program: 45755
Project: 45755
Buggy source:
/** 
 * Tries to unschedule this ChannelOutboundHandler. <p/> It will only be unscheduled if: - the outputBuffer is empty - there are no pending frames. <p/> If the outputBuffer is dirty then it will register itself for an OP_WRITE since we are interested in knowing if there is more space in the socket output buffer. If the outputBuffer is not dirty, then it will unregister itself from an OP_WRITE since it isn't interested in space in the socket outputBuffer. <p/> This call is only made by the owning IO thread.
 */
private void unschedule() throws IOException {
  if (dirtyOutputBuffer() || currentFrame != null) {
    registerOp(OP_WRITE);
    return;
  }
  unregisterOp(OP_WRITE);
  scheduled.set(false);
  if (writeQueue.isEmpty() && urgentWriteQueue.isEmpty()) {
    return;
  }
  if (!scheduled.compareAndSet(false,true)) {
    return;
  }
  owner.addTask(this);
}

Fixed version (ground truth):
/** 
 * Tries to unschedule this ChannelOutboundHandler. <p/> It will only be unscheduled if: - the outputBuffer is empty - there are no pending frames. <p/> If the outputBuffer is dirty then it will register itself for an OP_WRITE since we are interested in knowing if there is more space in the socket output buffer. If the outputBuffer is not dirty, then it will unregister itself from an OP_WRITE since it isn't interested in space in the socket outputBuffer. <p/> This call is only made by the owning IO thread.
 */
private void unschedule() throws IOException {
  if (dirtyOutputBuffer() || currentFrame != null) {
    registerOp(OP_WRITE);
    return;
  }
  unregisterOp(OP_WRITE);
  scheduled.set(false);
  if (writeQueue.isEmpty() && priorityWriteQueue.isEmpty()) {
    return;
  }
  if (!scheduled.compareAndSet(false,true)) {
    return;
  }
  owner.addTask(this);
}
Program: 45756
Project: 45756
Buggy source:
@Override public long load(){
switch (loadType) {
case LOAD_BALANCING_HANDLE:
    return processCount.get();
case LOAD_BALANCING_BYTE:
  return bytesWritten.get() + priorityFramesWritten.get();
case LOAD_BALANCING_FRAME:
return normalFramesWritten.get() + priorityFramesWritten.get();
default :
throw new RuntimeException();
}
}

Fixed version (ground truth):
@Override public long load(){
switch (loadType) {
case LOAD_BALANCING_HANDLE:
    return processCount.get();
case LOAD_BALANCING_BYTE:
  return bytesWritten.get();
case LOAD_BALANCING_FRAME:
return normalFramesWritten.get() + priorityFramesWritten.get();
default :
throw new RuntimeException();
}
}
Program: 45757
Project: 45757
Buggy source:
public int totalFramesPending(){
  return writeQueue.size() + urgentWriteQueue.size();
}

Fixed version (ground truth):
public int totalFramesPending(){
  return writeQueue.size() + priorityWriteQueue.size();
}
Program: 45758
Project: 45758
Buggy source:
@Probe(name="String_Node_Str",level=DEBUG) public long priorityBytesPending(){
  return bytesPending(urgentWriteQueue);
}

Fixed version (ground truth):
@Probe(name="String_Node_Str",level=DEBUG) public long priorityBytesPending(){
  return bytesPending(priorityWriteQueue);
}
Program: 45759
Project: 45759
Buggy source:
@Override void publishMetrics(){
  if (currentThread() != owner) {
    return;
  }
  owner.bytesTransceived+=bytesWritten.get() - bytesReadLastPublish;
  owner.framesTransceived+=normalFramesWritten.get() - normalFramesReadLastPublish;
  owner.priorityFramesTransceived+=priorityFramesWritten.get() - priorityFramesReadLastPublish;
  owner.processCount+=processCount.get() - processCountLastPublish;
  bytesReadLastPublish=bytesWritten.get();
  normalFramesReadLastPublish=normalFramesWritten.get();
  priorityFramesReadLastPublish=priorityFramesWritten.get();
  processCountLastPublish=processCount.get();
}

Fixed version (ground truth):
@Override void publishMetrics(){
  if (currentThread() != owner) {
    return;
  }
  owner.bytesTransceived+=bytesWritten.get() - bytesWrittenLastPublish;
  owner.framesTransceived+=normalFramesWritten.get() - normalFramesWrittenLastPublish;
  owner.priorityFramesTransceived+=priorityFramesWritten.get() - priorityFramesWrittenLastPublish;
  owner.processCount+=processCount.get() - processCountLastPublish;
  bytesWrittenLastPublish=bytesWritten.get();
  normalFramesWrittenLastPublish=normalFramesWritten.get();
  priorityFramesWrittenLastPublish=priorityFramesWritten.get();
  processCountLastPublish=processCount.get();
}
Program: 45760
Project: 45760
Buggy source:
public void write(OutboundFrame frame){
  if (frame.isUrgent()) {
    urgentWriteQueue.offer(frame);
  }
 else {
    writeQueue.offer(frame);
  }
  schedule();
}

Fixed version (ground truth):
public void write(OutboundFrame frame){
  if (frame.isUrgent()) {
    priorityWriteQueue.offer(frame);
  }
 else {
    writeQueue.offer(frame);
  }
  schedule();
}
Program: 45761
Project: 45761
Buggy source:
@Override public void close(){
  writeQueue.clear();
  urgentWriteQueue.clear();
  CloseTask closeTask=new CloseTask();
  addTaskAndWakeup(closeTask);
  closeTask.awaitCompletion();
}

Fixed version (ground truth):
@Override public void close(){
  writeQueue.clear();
  priorityWriteQueue.clear();
  CloseTask closeTask=new CloseTask();
  addTaskAndWakeup(closeTask);
  closeTask.awaitCompletion();
}
Program: 45762
Project: 45762
Buggy source:
/** 
 * Checks the DatagramSocket as well if the port is available in UDP and TCP.
 * @param port the port to check
 * @return {@code true} if the port is available in UDP and TCP, {@code false} otherwise
 */
public static boolean isPortAvailable(int port){
  ServerSocket ss=null;
  DatagramSocket ds=null;
  try {
    ss=new ServerSocket(port);
    ss.setReuseAddress(true);
    ds=new DatagramSocket(port);
    ds.setReuseAddress(true);
    return true;
  }
 catch (  IOException e) {
    return false;
  }
 finally {
    closeResource(ds);
    closeResource(ss);
  }
}

Fixed version (ground truth):
/** 
 * Checks the DatagramSocket as well if the port is available in UDP and TCP.
 * @param port the port to check
 * @return {@code true} if the port is available in UDP and TCP, {@code false} otherwise
 */
public static boolean isPortAvailable(int port){
  ServerSocket ss=null;
  DatagramSocket ds=null;
  try {
    ss=new ServerSocket(port);
    ss.setReuseAddress(true);
    ds=new DatagramSocket(port);
    ds.setReuseAddress(true);
    return true;
  }
 catch (  IOException e) {
    return false;
  }
 finally {
    if (ds != null) {
      ds.close();
    }
    try {
      if (ss != null) {
        ss.close();
      }
    }
 catch (    IOException e) {
      ignore(e);
    }
  }
}
Program: 45763
Project: 45763
Buggy source:
/** 
 * Notifies services that migration started, invokes all sent migration tasks and updates the replica versions. 
 */
private void doRun() throws Exception {
  if (migrationInfo.startProcessing()) {
    try {
      if (firstFragment) {
        executeBeforeMigrations();
      }
      for (      Operation migrationOperation : fragmentMigrationState.getMigrationOperations()) {
        runMigrationOperation(migrationOperation);
      }
      success=true;
    }
 catch (    Throwable e) {
      success=false;
      failureReason=e;
      getLogger().severe("String_Node_Str" + migrationInfo,e);
    }
 finally {
      afterMigrate();
    }
  }
 else {
    success=false;
    logMigrationCancelled();
  }
}

Fixed version (ground truth):
/** 
 * Notifies services that migration started, invokes all sent migration tasks and updates the replica versions. 
 */
private void doRun(){
  if (migrationInfo.startProcessing()) {
    try {
      if (firstFragment) {
        executeBeforeMigrations();
      }
      for (      Operation migrationOperation : fragmentMigrationState.getMigrationOperations()) {
        runMigrationOperation(migrationOperation);
      }
      success=true;
    }
 catch (    Throwable e) {
      success=false;
      failureReason=e;
      getLogger().severe("String_Node_Str" + migrationInfo,e);
    }
 finally {
      afterMigrate();
    }
  }
 else {
    success=false;
    logMigrationCancelled();
  }
}
Program: 45764
Project: 45764
Buggy source:
public MigrationOperation(MigrationInfo migrationInfo,int partitionStateVersion,ReplicaFragmentMigrationState fragmentMigrationState,boolean firstFragment,boolean lastFragment){
  super(migrationInfo,partitionStateVersion);
  this.fragmentMigrationState=fragmentMigrationState;
  this.firstFragment=firstFragment;
  this.lastFragment=lastFragment;
}

Fixed version (ground truth):
public MigrationOperation(MigrationInfo migrationInfo,int partitionStateVersion,ReplicaFragmentMigrationState fragmentMigrationState,boolean firstFragment,boolean lastFragment){
  super(migrationInfo,partitionStateVersion);
  this.fragmentMigrationState=fragmentMigrationState;
  this.firstFragment=firstFragment;
  this.lastFragment=lastFragment;
  setReplicaIndex(migrationInfo.getDestinationNewReplicaIndex());
}
Program: 45765
Project: 45765
Buggy source:
/** 
 * Causes the partition table to be arranged and published to members if : <ul> <li>the instance has started</li> <li>the cluster is   {@link ClusterState#ACTIVE}</li> <li>if it has not already been arranged</li> <li>if there is no cluster membership change</li> </ul> If this node is not the master, it will trigger the master to assign the partitions.
 * @throws HazelcastException if the partition state generator failed to arrange the partitions
 * @see PartitionStateManager#initializePartitionAssignments(java.util.Set)
 */
void firstArrangement();

Fixed version (ground truth):
/** 
 * Causes the partition table to be arranged and published to members if : <ul> <li>this instance has started</li> <li>this instance is the master</li> <li>the cluster is   {@link ClusterState#ACTIVE}</li> <li>if the partition table has not already been arranged</li> <li>if there is no cluster membership change</li> </ul> If this instance is not the master, it will trigger the master to assign the partitions.
 * @throws HazelcastException if the partition state generator failed to arrange the partitions
 * @return {@link PartitionRuntimeState} if this node is the master and the partition table is initialized
 * @see PartitionStateManager#initializePartitionAssignments(java.util.Set)
 */
PartitionRuntimeState firstArrangement();
Program: 45766
Project: 45766
Buggy source:
/** 
 * Called on the master node to send the partition tables to other cluster members. It will not publish the partition state if the partitions have not yet been initialized. Waits for   {@value PTABLE_SYNC_TIMEOUT_SECONDS} for the members to respond to the partition state operation.
 * @return {@code true} if all cluster members have synced their partition tables, {@code false} otherwise.
 */
@SuppressWarnings("String_Node_Str") boolean syncPartitionRuntimeState(){
  if (!partitionStateManager.isInitialized()) {
    return false;
  }
  if (!node.isMaster()) {
    return false;
  }
  PartitionRuntimeState partitionState=createPartitionStateInternal();
  if (partitionState == null) {
    return false;
  }
  if (logger.isFineEnabled()) {
    logger.fine("String_Node_Str" + partitionState.getVersion());
  }
  OperationService operationService=nodeEngine.getOperationService();
  Collection<MemberImpl> members=node.clusterService.getMemberImpls();
  List<Future<Boolean>> calls=firePartitionStateOperation(members,partitionState,operationService);
  Collection<Boolean> results=returnWithDeadline(calls,PTABLE_SYNC_TIMEOUT_SECONDS,TimeUnit.SECONDS,partitionStateSyncTimeoutHandler);
  if (calls.size() != results.size()) {
    return false;
  }
  for (  Boolean result : results) {
    if (!result) {
      if (logger.isFineEnabled()) {
        logger.fine("String_Node_Str" + partitionState.getVersion() + "String_Node_Str");
      }
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Called on the master node to send the partition tables to other cluster members. It will not publish the partition state if the partitions have not yet been initialized. Waits for   {@value PTABLE_SYNC_TIMEOUT_SECONDS} for the members to respond to the partition state operation.
 * @return {@code true} if all cluster members have synced their partition tables, {@code false} otherwise.
 */
@SuppressWarnings("String_Node_Str") boolean syncPartitionRuntimeState(){
  if (!partitionStateManager.isInitialized()) {
    return false;
  }
  if (!node.isMaster()) {
    return false;
  }
  PartitionRuntimeState partitionState=createPartitionStateInternal();
  if (partitionState == null) {
    return false;
  }
  if (logger.isFineEnabled()) {
    logger.fine("String_Node_Str" + partitionState.getVersion());
  }
  OperationService operationService=nodeEngine.getOperationService();
  Collection<MemberImpl> members=node.clusterService.getMemberImpls();
  List<Future<Boolean>> calls=firePartitionStateOperation(members,partitionState,operationService);
  Collection<Boolean> results=returnWithDeadline(calls,PTABLE_SYNC_TIMEOUT_SECONDS,SECONDS,partitionStateSyncTimeoutHandler);
  if (calls.size() != results.size()) {
    return false;
  }
  for (  Boolean result : results) {
    if (!result) {
      if (logger.isFineEnabled()) {
        logger.fine("String_Node_Str" + partitionState.getVersion() + "String_Node_Str");
      }
      return false;
    }
  }
  return true;
}
Program: 45767
Project: 45767
Buggy source:
@Override public void firstArrangement(){
  if (partitionStateManager.isInitialized()) {
    return;
  }
  if (!node.isMaster()) {
    triggerMasterToAssignPartitions();
    return;
  }
  lock.lock();
  try {
    if (partitionStateManager.isInitialized()) {
      return;
    }
    Set<Address> excludedAddresses=migrationManager.getShutdownRequestedAddresses();
    if (!partitionStateManager.initializePartitionAssignments(excludedAddresses)) {
      return;
    }
    publishPartitionRuntimeState();
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override public PartitionRuntimeState firstArrangement(){
  if (!node.isMaster()) {
    triggerMasterToAssignPartitions();
    return null;
  }
  lock.lock();
  try {
    if (!partitionStateManager.isInitialized()) {
      Set<Address> excludedAddresses=migrationManager.getShutdownRequestedAddresses();
      if (partitionStateManager.initializePartitionAssignments(excludedAddresses)) {
        publishPartitionRuntimeState();
      }
    }
    return createPartitionStateInternal();
  }
  finally {
    lock.unlock();
  }
}
Program: 45768
Project: 45768
Buggy source:
@Override public void init(NodeEngine nodeEngine,Properties properties){
  int partitionTableSendInterval=node.getProperties().getSeconds(GroupProperty.PARTITION_TABLE_SEND_INTERVAL);
  if (partitionTableSendInterval <= 0) {
    partitionTableSendInterval=1;
  }
  ExecutionService executionService=nodeEngine.getExecutionService();
  executionService.scheduleWithRepetition(new PublishPartitionRuntimeStateTask(node,this),partitionTableSendInterval,partitionTableSendInterval,TimeUnit.SECONDS);
  migrationManager.start();
  replicaManager.scheduleReplicaVersionSync(executionService);
}

Fixed version (ground truth):
@Override public void init(NodeEngine nodeEngine,Properties properties){
  int partitionTableSendInterval=node.getProperties().getSeconds(GroupProperty.PARTITION_TABLE_SEND_INTERVAL);
  if (partitionTableSendInterval <= 0) {
    partitionTableSendInterval=1;
  }
  ExecutionService executionService=nodeEngine.getExecutionService();
  executionService.scheduleWithRepetition(new PublishPartitionRuntimeStateTask(node,this),partitionTableSendInterval,partitionTableSendInterval,SECONDS);
  migrationManager.start();
  replicaManager.scheduleReplicaVersionSync(executionService);
}
Program: 45769
Project: 45769
Buggy source:
public InternalPartitionServiceImpl(Node node){
  HazelcastProperties properties=node.getProperties();
  this.partitionCount=properties.getInteger(GroupProperty.PARTITION_COUNT);
  this.node=node;
  this.nodeEngine=node.nodeEngine;
  this.logger=node.getLogger(InternalPartitionService.class);
  partitionListener=new InternalPartitionListener(node,this);
  partitionStateManager=new PartitionStateManager(node,this,partitionListener);
  migrationManager=new MigrationManager(node,this,lock);
  replicaManager=new PartitionReplicaManager(node,this);
  partitionReplicaStateChecker=new PartitionReplicaStateChecker(node,this);
  partitionEventManager=new PartitionEventManager(node);
  partitionStateSyncTimeoutHandler=logAllExceptions(logger,EXCEPTION_MSG_PARTITION_STATE_SYNC_TIMEOUT,Level.FINEST);
  partitionMigrationTimeout=properties.getMillis(GroupProperty.PARTITION_MIGRATION_TIMEOUT);
  proxy=new PartitionServiceProxy(nodeEngine,this);
  MetricsRegistry metricsRegistry=nodeEngine.getMetricsRegistry();
  metricsRegistry.scanAndRegister(this,"String_Node_Str");
  metricsRegistry.scanAndRegister(partitionStateManager,"String_Node_Str");
  metricsRegistry.scanAndRegister(migrationManager,"String_Node_Str");
  metricsRegistry.scanAndRegister(replicaManager,"String_Node_Str");
}

Fixed version (ground truth):
public InternalPartitionServiceImpl(Node node){
  HazelcastProperties properties=node.getProperties();
  this.partitionCount=properties.getInteger(GroupProperty.PARTITION_COUNT);
  this.node=node;
  this.nodeEngine=node.nodeEngine;
  this.logger=node.getLogger(InternalPartitionService.class);
  partitionListener=new InternalPartitionListener(node,this);
  partitionStateManager=new PartitionStateManager(node,this,partitionListener);
  migrationManager=new MigrationManager(node,this,lock);
  replicaManager=new PartitionReplicaManager(node,this);
  partitionReplicaStateChecker=new PartitionReplicaStateChecker(node,this);
  partitionEventManager=new PartitionEventManager(node);
  masterTrigger=new CoalescingDelayedTrigger(nodeEngine.getExecutionService(),TRIGGER_MASTER_DELAY_MILLIS,2 * TRIGGER_MASTER_DELAY_MILLIS,new Runnable(){
    @Override public void run(){
      resetMasterTriggeredFlag();
    }
  }
);
  partitionStateSyncTimeoutHandler=logAllExceptions(logger,EXCEPTION_MSG_PARTITION_STATE_SYNC_TIMEOUT,Level.FINEST);
  partitionMigrationTimeout=properties.getMillis(GroupProperty.PARTITION_MIGRATION_TIMEOUT);
  proxy=new PartitionServiceProxy(nodeEngine,this);
  MetricsRegistry metricsRegistry=nodeEngine.getMetricsRegistry();
  metricsRegistry.scanAndRegister(this,"String_Node_Str");
  metricsRegistry.scanAndRegister(partitionStateManager,"String_Node_Str");
  metricsRegistry.scanAndRegister(migrationManager,"String_Node_Str");
  metricsRegistry.scanAndRegister(replicaManager,"String_Node_Str");
}