Program: 103125
Project: 103125
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);
  List<String> storedAccounts=configurationService.getPropertyNamesByPrefix(factoryPackage,true);
  String accountUID=accountID.getAccountUniqueID();
  String accountNodeName=null;
  for (Iterator<String> storedAccountIter=storedAccounts.iterator(); storedAccountIter.hasNext(); ) {
    String storedAccount=storedAccountIter.next();
    int dotIndex=storedAccount.lastIndexOf("String_Node_Str");
    if (!storedAccount.substring(dotIndex + 1).startsWith(ACCOUNT_UID_PREFIX))     continue;
    String storedAccountUID=configurationService.getString(storedAccount + "String_Node_Str" + ProtocolProviderFactory.ACCOUNT_UID);
    if (storedAccountUID.equals(accountUID))     accountNodeName=configurationService.getString(storedAccount);
  }
  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);
  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);
}