Program: 104452
Project: 104452
Buggy source:
/** 
 * Connects and logins to the server
 * @param authority SecurityAuthority
 * @throws XMPPException if we cannot connect to the server - network problem
 * @throws OperationFailedException if login parametersas server port are not correct
 */
private void connectAndLogin(SecurityAuthority authority) throws OperationFailedException {
synchronized (initializationLock) {
    String password=MsnActivator.getProtocolProviderFactory().loadPassword(getAccountID());
    if (password == null) {
      UserCredentials credentials=new UserCredentials();
      credentials.setUserName(getAccountID().getUserID());
      credentials=authority.obtainCredentials(ProtocolNames.MSN,credentials);
      char[] pass=credentials.getPassword();
      if (pass == null) {
        fireRegistrationStateChanged(getRegistrationState(),RegistrationState.UNREGISTERED,RegistrationStateChangeEvent.REASON_USER_REQUEST,"String_Node_Str");
        return;
      }
      password=new String(pass);
      if (credentials.isPasswordPersistent()) {
        MsnActivator.getProtocolProviderFactory().storePassword(getAccountID(),password);
      }
    }
    messenger=MsnMessengerFactory.createMsnMessenger(getAccountID().getUserID(),password);
    messenger.addMessengerListener(new MsnConnectionListener());
    persistentPresence.setMessenger(messenger);
    typingNotifications.setMessenger(messenger);
    try {
      messenger.login();
    }
 catch (    UnresolvedAddressException ex) {
      fireRegistrationStateChanged(getRegistrationState(),RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_SERVER_NOT_FOUND,null);
    }
  }
}

Fixed version (ground truth):
/** 
 * Connects and logins to the server
 * @param authority SecurityAuthority
 * @throws XMPPException if we cannot connect to the server - network problem
 * @throws OperationFailedException if login parametersas server port are not correct
 */
private void connectAndLogin(SecurityAuthority authority) throws OperationFailedException {
synchronized (initializationLock) {
    String password=MsnActivator.getProtocolProviderFactory().loadPassword(getAccountID());
    if (password == null) {
      UserCredentials credentials=new UserCredentials();
      credentials.setUserName(getAccountID().getUserID());
      credentials=authority.obtainCredentials(ProtocolNames.MSN,credentials);
      if (credentials == null) {
        fireRegistrationStateChanged(getRegistrationState(),RegistrationState.UNREGISTERED,RegistrationStateChangeEvent.REASON_USER_REQUEST,"String_Node_Str");
        return;
      }
      char[] pass=credentials.getPassword();
      if (pass == null) {
        fireRegistrationStateChanged(getRegistrationState(),RegistrationState.UNREGISTERED,RegistrationStateChangeEvent.REASON_USER_REQUEST,"String_Node_Str");
        return;
      }
      password=new String(pass);
      if (credentials.isPasswordPersistent()) {
        MsnActivator.getProtocolProviderFactory().storePassword(getAccountID(),password);
      }
    }
    messenger=MsnMessengerFactory.createMsnMessenger(getAccountID().getUserID(),password);
    messenger.addMessengerListener(new MsnConnectionListener());
    persistentPresence.setMessenger(messenger);
    typingNotifications.setMessenger(messenger);
    try {
      messenger.login();
    }
 catch (    UnresolvedAddressException ex) {
      fireRegistrationStateChanged(getRegistrationState(),RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_SERVER_NOT_FOUND,null);
    }
  }
}