Program: 46221
Project: 46221
Buggy source:
private void authenticate(final Address target,final ClientConnection connection,final boolean asOwner,final AuthenticationFuture callback){
  SerializationService ss=client.getSerializationService();
  final ClientClusterServiceImpl clusterService=(ClientClusterServiceImpl)client.getClientClusterService();
  ClientPrincipal principal=clusterService.getPrincipal();
  byte serializationVersion=((InternalSerializationService)client.getSerializationService()).getVersion();
  String uuid=null;
  String ownerUuid=null;
  if (principal != null) {
    uuid=principal.getUuid();
    ownerUuid=principal.getOwnerUuid();
  }
  ClientMessage clientMessage=encodeAuthenticationRequest(asOwner,ss,serializationVersion,uuid,ownerUuid);
  ClientInvocation clientInvocation=new ClientInvocation(client,clientMessage,connection);
  ClientInvocationFuture future=clientInvocation.invokeUrgent();
  future.andThen(new ExecutionCallback<ClientMessage>(){
    @Override public void onResponse(    ClientMessage response){
      ClientAuthenticationCodec.ResponseParameters result=ClientAuthenticationCodec.decodeResponse(response);
      AuthenticationStatus authenticationStatus=AuthenticationStatus.getById(result.status);
switch (authenticationStatus) {
case AUTHENTICATED:
        if (asOwner) {
          connection.setIsAuthenticatedAsOwner();
          clusterService.setPrincipal(new ClientPrincipal(result.uuid,result.ownerUuid));
        }
      connection.setConnectedServerVersion(result.serverHazelcastVersion);
    connection.setClientUnregisteredMembers(result.clientUnregisteredMembers);
  connection.setRemoteEndpoint(result.address);
onAuthenticated(target,connection);
callback.onSuccess(connection,asOwner);
break;
case CREDENTIALS_FAILED:
AuthenticationException e=new AuthenticationException("String_Node_Str");
onAuthenticationFailed(target,connection,e);
callback.onFailure(e);
break;
default :
AuthenticationException exception=new AuthenticationException("String_Node_Str" + authenticationStatus);
onAuthenticationFailed(target,connection,exception);
callback.onFailure(exception);
}
}
@Override public void onFailure(Throwable t){
onAuthenticationFailed(target,connection,t);
callback.onFailure(t);
}
}
,executionService.getInternalExecutor());
}

Fixed version (ground truth):
private void authenticate(final Address target,final ClientConnection connection,final boolean asOwner,final AuthenticationFuture callback){
  SerializationService ss=client.getSerializationService();
  final ClientClusterServiceImpl clusterService=(ClientClusterServiceImpl)client.getClientClusterService();
  final ClientPrincipal principal=clusterService.getPrincipal();
  byte serializationVersion=((InternalSerializationService)client.getSerializationService()).getVersion();
  String uuid=null;
  String ownerUuid=null;
  if (principal != null) {
    uuid=principal.getUuid();
    ownerUuid=principal.getOwnerUuid();
  }
  ClientMessage clientMessage=encodeAuthenticationRequest(asOwner,ss,serializationVersion,uuid,ownerUuid);
  ClientInvocation clientInvocation=new ClientInvocation(client,clientMessage,connection);
  ClientInvocationFuture future=clientInvocation.invokeUrgent();
  if (asOwner && clientInvocation.getSendConnection() != null) {
    correlationIddOfLastAuthentication.set(clientInvocation.getClientMessage().getCorrelationId());
  }
  future.andThen(new ExecutionCallback<ClientMessage>(){
    @Override public void onResponse(    ClientMessage response){
      ClientAuthenticationCodec.ResponseParameters result=ClientAuthenticationCodec.decodeResponse(response);
      AuthenticationStatus authenticationStatus=AuthenticationStatus.getById(result.status);
switch (authenticationStatus) {
case AUTHENTICATED:
        connection.setConnectedServerVersion(result.serverHazelcastVersion);
      connection.setClientUnregisteredMembers(result.clientUnregisteredMembers);
    connection.setRemoteEndpoint(result.address);
  if (asOwner) {
    if (!(correlationIddOfLastAuthentication.get() == response.getCorrelationId())) {
      onFailure(new AuthenticationException("String_Node_Str" + target + "String_Node_Str"+ principal));
      return;
    }
    connection.setIsAuthenticatedAsOwner();
    ClientPrincipal principal=new ClientPrincipal(result.uuid,result.ownerUuid);
    clusterService.setPrincipal(principal);
    clusterService.setOwnerConnectionAddress(connection.getEndPoint());
    logger.info("String_Node_Str" + connection + "String_Node_Str"+ principal);
  }
onAuthenticated(target,connection);
callback.onSuccess(connection,asOwner);
break;
case CREDENTIALS_FAILED:
onFailure(new AuthenticationException("String_Node_Str" + principal));
break;
default :
onFailure(new AuthenticationException("String_Node_Str" + authenticationStatus));
}
}
@Override public void onFailure(Throwable t){
onAuthenticationFailed(target,connection,t);
callback.onFailure(t);
}
}
,executionService.getInternalExecutor());
}