Program: 103264
Project: 103264
Buggy source:
/** 
 * Creates an account for the given user and password.
 * @param providerFactory the ProtocolProviderFactory which will createthe account
 * @param userName the user identifier
 * @param passwd the password
 * @return the <tt>ProtocolProviderService</tt> for the new account.
 * @throws OperationFailedException problem installing account
 */
private ProtocolProviderService installAccount(ProtocolProviderFactory providerFactory,String userName,String passwd) throws OperationFailedException {
  HashMap<String,String> accountProperties=new HashMap<String,String>();
  accountProperties.put(ProtocolProviderFactory.PROTOCOL,getProtocol());
  String protocolIconPath=getProtocolIconPath();
  if (protocolIconPath != null)   accountProperties.put(ProtocolProviderFactory.PROTOCOL_ICON_PATH,protocolIconPath);
  String accountIconPath=getAccountIconPath();
  if (accountIconPath != null)   accountProperties.put(ProtocolProviderFactory.ACCOUNT_ICON_PATH,accountIconPath);
  if (registration.isRememberPassword()) {
    accountProperties.put(ProtocolProviderFactory.PASSWORD,passwd);
  }
 else {
    registration.setPassword(null);
  }
  String serverAddress=null;
  String serverFromUsername=SIPAccountRegistrationForm.getServerFromUserName(userName);
  if (registration.getServerAddress() != null)   serverAddress=registration.getServerAddress();
  if (serverFromUsername == null && registration.getDefaultDomain() != null) {
    userName=userName + "String_Node_Str" + registration.getDefaultDomain();
    if (serverAddress == null)     serverAddress=registration.getDefaultDomain();
  }
 else   if (serverAddress == null && serverFromUsername != null) {
    serverAddress=serverFromUsername;
  }
  if (serverAddress != null) {
    accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,serverAddress);
    if (userName.indexOf(serverAddress) < 0)     accountProperties.put(ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,Boolean.toString(true));
  }
  accountProperties.put(ProtocolProviderFactory.DISPLAY_NAME,registration.getDisplayName());
  accountProperties.put(ProtocolProviderFactory.AUTHORIZATION_NAME,registration.getAuthorizationName());
  accountProperties.put(ProtocolProviderFactory.SERVER_PORT,registration.getServerPort());
  if (registration.isProxyAutoConfigure()) {
    accountProperties.put(ProtocolProviderFactory.PROXY_AUTO_CONFIG,Boolean.TRUE.toString());
  }
 else {
    accountProperties.put(ProtocolProviderFactory.PROXY_AUTO_CONFIG,Boolean.FALSE.toString());
    accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,registration.getProxy());
    accountProperties.put(ProtocolProviderFactory.PROXY_PORT,registration.getProxyPort());
    accountProperties.put(ProtocolProviderFactory.PREFERRED_TRANSPORT,registration.getPreferredTransport());
  }
  accountProperties.put(ProtocolProviderFactory.IS_PRESENCE_ENABLED,Boolean.toString(registration.isEnablePresence()));
  if (serverAddress != null) {
    accountProperties.put(ProtocolProviderFactory.FORCE_P2P_MODE,Boolean.toString(registration.isForceP2PMode()));
  }
 else {
    accountProperties.put(ProtocolProviderFactory.FORCE_P2P_MODE,Boolean.TRUE.toString());
  }
  accountProperties.put(ProtocolProviderFactory.DEFAULT_ENCRYPTION,Boolean.toString(registration.isDefaultEncryption()));
  accountProperties.put(ProtocolProviderFactory.DEFAULT_SIPZRTP_ATTRIBUTE,Boolean.toString(registration.isSipZrtpAttribute()));
  accountProperties.put(ProtocolProviderFactory.SAVP_OPTION,Integer.toString(registration.getSavpOption()));
  accountProperties.put(ProtocolProviderFactory.SDES_ENABLED,Boolean.toString(registration.isSDesEnabled()));
  accountProperties.put(ProtocolProviderFactory.SDES_CIPHER_SUITES,registration.getSDesCipherSuites());
  accountProperties.put(ProtocolProviderFactory.POLLING_PERIOD,registration.getPollingPeriod());
  accountProperties.put(ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION,registration.getSubscriptionExpiration());
  accountProperties.put(ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE,registration.getTlsClientCertificate());
  if (registration.getKeepAliveMethod() != null)   accountProperties.put("String_Node_Str",registration.getKeepAliveMethod());
 else   accountProperties.put("String_Node_Str",registration.getDefaultKeepAliveMethod());
  accountProperties.put("String_Node_Str",registration.getKeepAliveInterval());
  accountProperties.put("String_Node_Str",Boolean.toString(registration.isXiVOEnable()));
  accountProperties.put("String_Node_Str",Boolean.toString(registration.isXCapEnable()));
  if (registration.isXCapEnable()) {
    accountProperties.put("String_Node_Str",Boolean.toString(registration.isClistOptionUseSipCredentials()));
    if (registration.getClistOptionServerUri() != null) {
      accountProperties.put("String_Node_Str",registration.getClistOptionServerUri());
    }
    if (registration.getClistOptionUser() != null) {
      accountProperties.put("String_Node_Str",registration.getClistOptionUser());
    }
    if (registration.getClistOptionPassword() != null) {
      accountProperties.put("String_Node_Str",registration.getClistOptionPassword());
    }
  }
 else   if (registration.isXiVOEnable()) {
    accountProperties.put("String_Node_Str",Boolean.toString(registration.isClistOptionUseSipCredentials()));
    if (registration.getClistOptionServerUri() != null) {
      accountProperties.put("String_Node_Str",registration.getClistOptionServerUri());
    }
    if (registration.getClistOptionUser() != null) {
      accountProperties.put("String_Node_Str",registration.getClistOptionUser());
    }
    if (registration.getClistOptionPassword() != null) {
      accountProperties.put("String_Node_Str",registration.getClistOptionPassword());
    }
  }
  if (!StringUtils.isNullOrEmpty(registration.getVoicemailURI(),true))   accountProperties.put(ProtocolProviderFactory.VOICEMAIL_URI,registration.getVoicemailURI());
 else   if (isModification())   accountProperties.put(ProtocolProviderFactory.VOICEMAIL_URI,"String_Node_Str");
  if (isModification()) {
    accountProperties.put(ProtocolProviderFactory.USER_ID,userName);
    providerFactory.modifyAccount(protocolProvider,accountProperties);
    setModification(false);
    return protocolProvider;
  }
  try {
    AccountID accountID=providerFactory.installAccount(userName,accountProperties);
    ServiceReference serRef=providerFactory.getProviderForAccount(accountID);
    protocolProvider=(ProtocolProviderService)SIPAccRegWizzActivator.bundleContext.getService(serRef);
  }
 catch (  IllegalStateException exc) {
    logger.warn(exc.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.IDENTIFICATION_CONFLICT);
  }
catch (  Exception exc) {
    logger.warn(exc.getMessage());
    throw new OperationFailedException(exc.getMessage(),OperationFailedException.GENERAL_ERROR);
  }
  return protocolProvider;
}

Fixed version (ground truth):
/** 
 * Creates an account for the given user and password.
 * @param providerFactory the ProtocolProviderFactory which will createthe account
 * @param userName the user identifier
 * @param passwd the password
 * @return the <tt>ProtocolProviderService</tt> for the new account.
 * @throws OperationFailedException problem installing account
 */
private ProtocolProviderService installAccount(ProtocolProviderFactory providerFactory,String userName,String passwd) throws OperationFailedException {
  HashMap<String,String> accountProperties=new HashMap<String,String>();
  accountProperties.put(ProtocolProviderFactory.PROTOCOL,getProtocol());
  String protocolIconPath=getProtocolIconPath();
  if (protocolIconPath != null)   accountProperties.put(ProtocolProviderFactory.PROTOCOL_ICON_PATH,protocolIconPath);
  String accountIconPath=getAccountIconPath();
  if (accountIconPath != null)   accountProperties.put(ProtocolProviderFactory.ACCOUNT_ICON_PATH,accountIconPath);
  if (registration.isRememberPassword()) {
    accountProperties.put(ProtocolProviderFactory.PASSWORD,passwd);
  }
 else {
    registration.setPassword(null);
  }
  String serverAddress=null;
  String serverFromUsername=SIPAccountRegistrationForm.getServerFromUserName(userName);
  if (registration.getServerAddress() != null)   serverAddress=registration.getServerAddress();
  if (serverFromUsername == null && registration.getDefaultDomain() != null) {
    userName=userName + "String_Node_Str" + registration.getDefaultDomain();
    if (serverAddress == null)     serverAddress=registration.getDefaultDomain();
  }
 else   if (serverAddress == null && serverFromUsername != null) {
    serverAddress=serverFromUsername;
  }
  if (serverAddress != null) {
    accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,serverAddress);
    if (userName.indexOf(serverAddress) < 0)     accountProperties.put(ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,Boolean.toString(true));
  }
  accountProperties.put(ProtocolProviderFactory.DISPLAY_NAME,registration.getDisplayName());
  accountProperties.put(ProtocolProviderFactory.AUTHORIZATION_NAME,registration.getAuthorizationName());
  accountProperties.put(ProtocolProviderFactory.SERVER_PORT,registration.getServerPort());
  if (registration.isProxyAutoConfigure()) {
    accountProperties.put(ProtocolProviderFactory.PROXY_AUTO_CONFIG,Boolean.TRUE.toString());
  }
 else {
    accountProperties.put(ProtocolProviderFactory.PROXY_AUTO_CONFIG,Boolean.FALSE.toString());
    accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,registration.getProxy());
    accountProperties.put(ProtocolProviderFactory.PROXY_PORT,registration.getProxyPort());
    accountProperties.put(ProtocolProviderFactory.PREFERRED_TRANSPORT,registration.getPreferredTransport());
  }
  accountProperties.put(ProtocolProviderFactory.IS_PRESENCE_ENABLED,Boolean.toString(registration.isEnablePresence()));
  if (serverAddress != null) {
    accountProperties.put(ProtocolProviderFactory.FORCE_P2P_MODE,Boolean.toString(registration.isForceP2PMode()));
  }
 else {
    accountProperties.put(ProtocolProviderFactory.FORCE_P2P_MODE,Boolean.TRUE.toString());
  }
  accountProperties.put(ProtocolProviderFactory.DEFAULT_ENCRYPTION,Boolean.toString(registration.isDefaultEncryption()));
  accountProperties.put(ProtocolProviderFactory.DEFAULT_SIPZRTP_ATTRIBUTE,Boolean.toString(registration.isSipZrtpAttribute()));
  accountProperties.put(ProtocolProviderFactory.SAVP_OPTION,Integer.toString(registration.getSavpOption()));
  accountProperties.put(ProtocolProviderFactory.SDES_ENABLED,Boolean.toString(registration.isSDesEnabled()));
  accountProperties.put(ProtocolProviderFactory.SDES_CIPHER_SUITES,registration.getSDesCipherSuites());
  accountProperties.put(ProtocolProviderFactory.POLLING_PERIOD,registration.getPollingPeriod());
  accountProperties.put(ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION,registration.getSubscriptionExpiration());
  accountProperties.put(ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE,registration.getTlsClientCertificate());
  if (registration.getKeepAliveMethod() != null)   accountProperties.put(ProtocolProviderFactory.KEEP_ALIVE_METHOD,registration.getKeepAliveMethod());
 else   accountProperties.put(ProtocolProviderFactory.KEEP_ALIVE_METHOD,registration.getDefaultKeepAliveMethod());
  accountProperties.put(ProtocolProviderFactory.KEEP_ALIVE_INTERVAL,registration.getKeepAliveInterval());
  accountProperties.put("String_Node_Str",Boolean.toString(registration.isXiVOEnable()));
  accountProperties.put("String_Node_Str",Boolean.toString(registration.isXCapEnable()));
  if (registration.isXCapEnable()) {
    accountProperties.put("String_Node_Str",Boolean.toString(registration.isClistOptionUseSipCredentials()));
    if (registration.getClistOptionServerUri() != null) {
      accountProperties.put("String_Node_Str",registration.getClistOptionServerUri());
    }
    if (registration.getClistOptionUser() != null) {
      accountProperties.put("String_Node_Str",registration.getClistOptionUser());
    }
    if (registration.getClistOptionPassword() != null) {
      accountProperties.put("String_Node_Str",registration.getClistOptionPassword());
    }
  }
 else   if (registration.isXiVOEnable()) {
    accountProperties.put("String_Node_Str",Boolean.toString(registration.isClistOptionUseSipCredentials()));
    if (registration.getClistOptionServerUri() != null) {
      accountProperties.put("String_Node_Str",registration.getClistOptionServerUri());
    }
    if (registration.getClistOptionUser() != null) {
      accountProperties.put("String_Node_Str",registration.getClistOptionUser());
    }
    if (registration.getClistOptionPassword() != null) {
      accountProperties.put("String_Node_Str",registration.getClistOptionPassword());
    }
  }
  if (!StringUtils.isNullOrEmpty(registration.getVoicemailURI(),true))   accountProperties.put(ProtocolProviderFactory.VOICEMAIL_URI,registration.getVoicemailURI());
 else   if (isModification())   accountProperties.put(ProtocolProviderFactory.VOICEMAIL_URI,"String_Node_Str");
  if (isModification()) {
    accountProperties.put(ProtocolProviderFactory.USER_ID,userName);
    providerFactory.modifyAccount(protocolProvider,accountProperties);
    setModification(false);
    return protocolProvider;
  }
  try {
    AccountID accountID=providerFactory.installAccount(userName,accountProperties);
    ServiceReference serRef=providerFactory.getProviderForAccount(accountID);
    protocolProvider=(ProtocolProviderService)SIPAccRegWizzActivator.bundleContext.getService(serRef);
  }
 catch (  IllegalStateException exc) {
    logger.warn(exc.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.IDENTIFICATION_CONFLICT);
  }
catch (  Exception exc) {
    logger.warn(exc.getMessage());
    throw new OperationFailedException(exc.getMessage(),OperationFailedException.GENERAL_ERROR);
  }
  return protocolProvider;
}