Program: 103110
Project: 103110
Buggy source:
/** 
 * Stores an account represented in the form of an <tt>AccountID</tt> created by a specific <tt>ProtocolProviderFactory</tt>.
 * @param factory the <tt>ProtocolProviderFactory</tt> which created theaccount to be stored
 * @param accountID the account in the form of <tt>AccountID</tt> to bestored
 * @throws OperationFailedException if anything goes wrong while storing theaccount
 */
public void storeAccount(ProtocolProviderFactory factory,AccountID accountID) throws OperationFailedException {
synchronized (storedAccounts) {
    if (!storedAccounts.contains(accountID))     storedAccounts.add(accountID);
  }
  ConfigurationService configurationService=ProtocolProviderActivator.getConfigurationService();
  String factoryPackage=getFactoryImplPackageName(factory);
  String accountNodeName=getAccountNodeName(factory,accountID.getAccountUniqueID());
  Map<String,Object> configurationProperties=new HashMap<String,Object>();
  if (accountNodeName == null) {
    accountNodeName=ACCOUNT_UID_PREFIX + Long.toString(System.currentTimeMillis());
    configurationProperties.put(factoryPackage + "String_Node_Str" + accountNodeName,accountNodeName);
    configurationProperties.put(factoryPackage + "String_Node_Str" + accountNodeName+ "String_Node_Str"+ ProtocolProviderFactory.ACCOUNT_UID,accountID.getAccountUniqueID());
  }
  Map<String,String> accountProperties=accountID.getAccountProperties();
  for (  Map.Entry<String,String> entry : accountProperties.entrySet()) {
    String property=entry.getKey();
    String value=entry.getValue();
    String secureStorePrefix=null;
    if (property.equals(ProtocolProviderFactory.PASSWORD)) {
      String accountPrefix=factoryPackage + "String_Node_Str" + accountNodeName;
      secureStorePrefix=accountPrefix;
    }
 else     if (property.endsWith("String_Node_Str" + ProtocolProviderFactory.PASSWORD)) {
      secureStorePrefix=factoryPackage + "String_Node_Str" + accountNodeName+ "String_Node_Str"+ property.substring(0,property.lastIndexOf("String_Node_Str"));
    }
    if (secureStorePrefix != null) {
      CredentialsStorageService credentialsStorage=ServiceUtils.getService(bundleContext,CredentialsStorageService.class);
      if ((value != null) && (value.length() != 0) && !credentialsStorage.storePassword(secureStorePrefix,value)) {
        throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.GENERAL_ERROR);
      }
    }
 else {
      configurationProperties.put(factoryPackage + "String_Node_Str" + accountNodeName+ "String_Node_Str"+ property,value);
    }
  }
  if (!accountProperties.containsKey(ProtocolProviderFactory.PASSWORD)) {
    CredentialsStorageService credentialsStorage=ServiceUtils.getService(bundleContext,CredentialsStorageService.class);
    credentialsStorage.removePassword(factoryPackage + "String_Node_Str" + accountNodeName);
  }
  if (configurationProperties.size() > 0)   configurationService.setProperties(configurationProperties);
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + accountID.getAccountUniqueID() + "String_Node_Str"+ factoryPackage);
}

Fixed version (ground truth):
/** 
 * Stores an account represented in the form of an <tt>AccountID</tt> created by a specific <tt>ProtocolProviderFactory</tt>.
 * @param factory the <tt>ProtocolProviderFactory</tt> which created theaccount to be stored
 * @param accountID the account in the form of <tt>AccountID</tt> to bestored
 * @throws OperationFailedException if anything goes wrong while storing theaccount
 */
public void storeAccount(ProtocolProviderFactory factory,AccountID accountID) throws OperationFailedException {
synchronized (storedAccounts) {
    if (!storedAccounts.contains(accountID))     storedAccounts.add(accountID);
  }
  ConfigurationService configurationService=ProtocolProviderActivator.getConfigurationService();
  String factoryPackage=getFactoryImplPackageName(factory);
  String accountNodeName=getAccountNodeName(factory,accountID.getAccountUniqueID());
  Map<String,Object> configurationProperties=new HashMap<String,Object>();
  if (accountNodeName == null) {
    accountNodeName=ACCOUNT_UID_PREFIX + Long.toString(System.currentTimeMillis());
    configurationProperties.put(factoryPackage + "String_Node_Str" + accountNodeName,accountNodeName);
    configurationProperties.put(factoryPackage + "String_Node_Str" + accountNodeName+ "String_Node_Str"+ ProtocolProviderFactory.ACCOUNT_UID,accountID.getAccountUniqueID());
  }
  Map<String,String> accountProperties=accountID.getAccountProperties();
  for (  Map.Entry<String,String> entry : accountProperties.entrySet()) {
    String property=entry.getKey();
    String value=entry.getValue();
    String secureStorePrefix=null;
    if (property.equals(ProtocolProviderFactory.PASSWORD)) {
      String accountPrefix=factoryPackage + "String_Node_Str" + accountNodeName;
      secureStorePrefix=accountPrefix;
    }
 else     if (property.endsWith("String_Node_Str" + ProtocolProviderFactory.PASSWORD)) {
      secureStorePrefix=factoryPackage + "String_Node_Str" + accountNodeName+ "String_Node_Str"+ property.substring(0,property.lastIndexOf("String_Node_Str"));
    }
    if (secureStorePrefix != null) {
      CredentialsStorageService credentialsStorage=ServiceUtils.getService(bundleContext,CredentialsStorageService.class);
      if ((value != null) && (value.length() != 0) && !credentialsStorage.storePassword(secureStorePrefix,value)) {
        throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.GENERAL_ERROR);
      }
    }
 else {
      configurationProperties.put(factoryPackage + "String_Node_Str" + accountNodeName+ "String_Node_Str"+ property,value);
    }
  }
  if (!accountProperties.containsKey(ProtocolProviderFactory.PASSWORD) && !configurationProperties.containsKey(factoryPackage + "String_Node_Str" + accountNodeName+ "String_Node_Str")) {
    CredentialsStorageService credentialsStorage=ServiceUtils.getService(bundleContext,CredentialsStorageService.class);
    credentialsStorage.removePassword(factoryPackage + "String_Node_Str" + accountNodeName);
  }
  if (configurationProperties.size() > 0)   configurationService.setProperties(configurationProperties);
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + accountID.getAccountUniqueID() + "String_Node_Str"+ factoryPackage);
}