Program: 103262
Project: 103262
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 if the operation didn't succeed
 */
protected ProtocolProviderService installAccount(ProtocolProviderFactory providerFactory,String userName,String passwd) throws OperationFailedException {
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + userName);
  }
  Hashtable<String,String> accountProperties=new Hashtable<String,String>();
  accountProperties.put(ProtocolProviderFactory.IS_PREFERRED_PROTOCOL,Boolean.toString(isPreferredProtocol()));
  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);
  }
  accountProperties.put("String_Node_Str",String.valueOf(registration.isSendKeepAlive()));
  accountProperties.put("String_Node_Str",String.valueOf(registration.isGmailNotificationEnabled()));
  accountProperties.put("String_Node_Str",String.valueOf(registration.isGoogleContactsEnabled()));
  String serverName=null;
  if (registration.getServerAddress() != null && registration.getServerAddress().length() > 0) {
    serverName=registration.getServerAddress();
    if (userName.indexOf(serverName) < 0)     accountProperties.put(ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,Boolean.toString(true));
  }
 else {
    serverName=getServerFromUserName(userName);
  }
  if (serverName == null || serverName.length() <= 0)   throw new OperationFailedException("String_Node_Str" + userName + "String_Node_Str",OperationFailedException.SERVER_NOT_SPECIFIED);
  if (userName.indexOf('@') < 0 && registration.getDefaultUserSufix() != null)   userName=userName + '@' + registration.getDefaultUserSufix();
  if (registration.getOverridePhoneSuffix() != null) {
    accountProperties.put("String_Node_Str",registration.getOverridePhoneSuffix());
  }
  accountProperties.put("String_Node_Str",String.valueOf(registration.getBypassGtalkCaps()));
  if (registration.getTelephonyDomainBypassCaps() != null) {
    accountProperties.put("String_Node_Str",registration.getTelephonyDomainBypassCaps());
  }
  accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,serverName);
  String smsServerAddress=registration.getSmsServerAddress();
  if (smsServerAddress != null) {
    accountProperties.put(ProtocolProviderFactory.SMS_SERVER_ADDRESS,smsServerAddress);
  }
  accountProperties.put(ProtocolProviderFactory.SERVER_PORT,String.valueOf(registration.getPort()));
  accountProperties.put(ProtocolProviderFactory.AUTO_GENERATE_RESOURCE,String.valueOf(registration.isResourceAutogenerated()));
  accountProperties.put(ProtocolProviderFactory.RESOURCE,registration.getResource());
  accountProperties.put(ProtocolProviderFactory.RESOURCE_PRIORITY,String.valueOf(registration.getPriority()));
  accountProperties.put(ProtocolProviderFactory.IS_USE_ICE,String.valueOf(registration.isUseIce()));
  accountProperties.put(ProtocolProviderFactory.IS_USE_GOOGLE_ICE,String.valueOf(registration.isUseGoogleIce()));
  accountProperties.put(ProtocolProviderFactory.AUTO_DISCOVER_STUN,String.valueOf(registration.isAutoDiscoverStun()));
  accountProperties.put(ProtocolProviderFactory.USE_DEFAULT_STUN_SERVER,String.valueOf(registration.isUseDefaultStunServer()));
  String accountDisplayName=registration.getAccountDisplayName();
  if (accountDisplayName != null && accountDisplayName.length() > 0)   accountProperties.put(ProtocolProviderFactory.ACCOUNT_DISPLAY_NAME,accountDisplayName);
  List<StunServerDescriptor> stunServers=registration.getAdditionalStunServers();
  int serverIndex=-1;
  for (  StunServerDescriptor stunServer : stunServers) {
    serverIndex++;
    stunServer.storeDescriptor(accountProperties,ProtocolProviderFactory.STUN_PREFIX + serverIndex);
  }
  accountProperties.put(ProtocolProviderFactory.IS_USE_JINGLE_NODES,String.valueOf(registration.isUseJingleNodes()));
  accountProperties.put(ProtocolProviderFactory.AUTO_DISCOVER_JINGLE_NODES,String.valueOf(registration.isAutoDiscoverJingleNodes()));
  List<JingleNodeDescriptor> jnRelays=registration.getAdditionalJingleNodes();
  serverIndex=-1;
  for (  JingleNodeDescriptor jnRelay : jnRelays) {
    serverIndex++;
    jnRelay.storeDescriptor(accountProperties,JingleNodeDescriptor.JN_PREFIX + serverIndex);
  }
  accountProperties.put(ProtocolProviderFactory.IS_USE_UPNP,String.valueOf(registration.isUseUPNP()));
  accountProperties.put(ProtocolProviderFactory.IS_ALLOW_NON_SECURE,String.valueOf(registration.isAllowNonSecure()));
  if (isModification()) {
    providerFactory.modifyAccount(protocolProvider,accountProperties);
    setModification(false);
    return protocolProvider;
  }
  try {
    if (logger.isTraceEnabled()) {
      logger.trace("String_Node_Str" + userName + "String_Node_Str"+ accountProperties);
    }
    AccountID accountID=providerFactory.installAccount(userName,accountProperties);
    ServiceReference serRef=providerFactory.getProviderForAccount(accountID);
    protocolProvider=(ProtocolProviderService)JabberAccRegWizzActivator.bundleContext.getService(serRef);
  }
 catch (  IllegalArgumentException exc) {
    logger.warn(exc.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.ILLEGAL_ARGUMENT);
  }
catch (  IllegalStateException exc) {
    logger.warn(exc.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.IDENTIFICATION_CONFLICT);
  }
catch (  Throwable exc) {
    logger.warn(exc.getMessage());
    throw new OperationFailedException("String_Node_Str",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 if the operation didn't succeed
 */
protected ProtocolProviderService installAccount(ProtocolProviderFactory providerFactory,String userName,String passwd) throws OperationFailedException {
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + userName);
  }
  Hashtable<String,String> accountProperties=new Hashtable<String,String>();
  accountProperties.put(ProtocolProviderFactory.IS_PREFERRED_PROTOCOL,Boolean.toString(isPreferredProtocol()));
  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);
  }
  accountProperties.put("String_Node_Str",String.valueOf(registration.isGmailNotificationEnabled()));
  accountProperties.put("String_Node_Str",String.valueOf(registration.isGoogleContactsEnabled()));
  String serverName=null;
  if (registration.getServerAddress() != null && registration.getServerAddress().length() > 0) {
    serverName=registration.getServerAddress();
    if (userName.indexOf(serverName) < 0)     accountProperties.put(ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,Boolean.toString(true));
  }
 else {
    serverName=getServerFromUserName(userName);
  }
  if (serverName == null || serverName.length() <= 0)   throw new OperationFailedException("String_Node_Str" + userName + "String_Node_Str",OperationFailedException.SERVER_NOT_SPECIFIED);
  if (userName.indexOf('@') < 0 && registration.getDefaultUserSufix() != null)   userName=userName + '@' + registration.getDefaultUserSufix();
  if (registration.getOverridePhoneSuffix() != null) {
    accountProperties.put("String_Node_Str",registration.getOverridePhoneSuffix());
  }
  accountProperties.put("String_Node_Str",String.valueOf(registration.getBypassGtalkCaps()));
  if (registration.getTelephonyDomainBypassCaps() != null) {
    accountProperties.put("String_Node_Str",registration.getTelephonyDomainBypassCaps());
  }
  accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,serverName);
  String smsServerAddress=registration.getSmsServerAddress();
  if (smsServerAddress != null) {
    accountProperties.put(ProtocolProviderFactory.SMS_SERVER_ADDRESS,smsServerAddress);
  }
  accountProperties.put(ProtocolProviderFactory.SERVER_PORT,String.valueOf(registration.getPort()));
  accountProperties.put(ProtocolProviderFactory.AUTO_GENERATE_RESOURCE,String.valueOf(registration.isResourceAutogenerated()));
  accountProperties.put(ProtocolProviderFactory.RESOURCE,registration.getResource());
  accountProperties.put(ProtocolProviderFactory.RESOURCE_PRIORITY,String.valueOf(registration.getPriority()));
  accountProperties.put(ProtocolProviderFactory.IS_USE_ICE,String.valueOf(registration.isUseIce()));
  accountProperties.put(ProtocolProviderFactory.IS_USE_GOOGLE_ICE,String.valueOf(registration.isUseGoogleIce()));
  accountProperties.put(ProtocolProviderFactory.AUTO_DISCOVER_STUN,String.valueOf(registration.isAutoDiscoverStun()));
  accountProperties.put(ProtocolProviderFactory.USE_DEFAULT_STUN_SERVER,String.valueOf(registration.isUseDefaultStunServer()));
  String accountDisplayName=registration.getAccountDisplayName();
  if (accountDisplayName != null && accountDisplayName.length() > 0)   accountProperties.put(ProtocolProviderFactory.ACCOUNT_DISPLAY_NAME,accountDisplayName);
  List<StunServerDescriptor> stunServers=registration.getAdditionalStunServers();
  int serverIndex=-1;
  for (  StunServerDescriptor stunServer : stunServers) {
    serverIndex++;
    stunServer.storeDescriptor(accountProperties,ProtocolProviderFactory.STUN_PREFIX + serverIndex);
  }
  accountProperties.put(ProtocolProviderFactory.IS_USE_JINGLE_NODES,String.valueOf(registration.isUseJingleNodes()));
  accountProperties.put(ProtocolProviderFactory.AUTO_DISCOVER_JINGLE_NODES,String.valueOf(registration.isAutoDiscoverJingleNodes()));
  List<JingleNodeDescriptor> jnRelays=registration.getAdditionalJingleNodes();
  serverIndex=-1;
  for (  JingleNodeDescriptor jnRelay : jnRelays) {
    serverIndex++;
    jnRelay.storeDescriptor(accountProperties,JingleNodeDescriptor.JN_PREFIX + serverIndex);
  }
  accountProperties.put(ProtocolProviderFactory.IS_USE_UPNP,String.valueOf(registration.isUseUPNP()));
  accountProperties.put(ProtocolProviderFactory.IS_ALLOW_NON_SECURE,String.valueOf(registration.isAllowNonSecure()));
  if (isModification()) {
    providerFactory.modifyAccount(protocolProvider,accountProperties);
    setModification(false);
    return protocolProvider;
  }
  try {
    if (logger.isTraceEnabled()) {
      logger.trace("String_Node_Str" + userName + "String_Node_Str"+ accountProperties);
    }
    AccountID accountID=providerFactory.installAccount(userName,accountProperties);
    ServiceReference serRef=providerFactory.getProviderForAccount(accountID);
    protocolProvider=(ProtocolProviderService)JabberAccRegWizzActivator.bundleContext.getService(serRef);
  }
 catch (  IllegalArgumentException exc) {
    logger.warn(exc.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.ILLEGAL_ARGUMENT);
  }
catch (  IllegalStateException exc) {
    logger.warn(exc.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.IDENTIFICATION_CONFLICT);
  }
catch (  Throwable exc) {
    logger.warn(exc.getMessage());
    throw new OperationFailedException("String_Node_Str",OperationFailedException.GENERAL_ERROR);
  }
  return protocolProvider;
}