Program: 28828
Project: 28828
Buggy source:
/** 
 * Writes the current KeyStore to disk in a manner that preserves its on-disk representation from being destroyed if something goes wrong; a temporary file is used.
 */
private synchronized void writeKeyStoreSafe(final char[] masterPassword) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnrecoverableKeyException {
  final boolean keystoreExists=_keyFile.exists();
  if (keystoreExists) {
    final KeyStore oldStore=_pwdStore;
    final KeyStore newKeyStore=duplicateKeyStore(masterPassword);
    final File saveOld=new File(_keyFile.toString() + "String_Node_Str");
    if (!_keyFile.renameTo(saveOld)) {
      final String msg="String_Node_Str" + _keyFile + "String_Node_Str"+ saveOld;
      throw new IOException(msg);
    }
    try {
      writeKeyStoreToFile(newKeyStore,_keyFile,masterPassword);
      _pwdStore=newKeyStore;
      _masterPassword=masterPassword;
    }
 catch (    final Throwable t) {
      try {
        saveOld.renameTo(_keyFile);
      }
 catch (      final Throwable tt) {
        throw new RuntimeException("String_Node_Str" + "String_Node_Str",tt);
      }
      throw new RuntimeException("String_Node_Str",t);
    }
    try {
      saveOld.delete();
    }
 catch (    Throwable t) {
      throw new RuntimeException("String_Node_Str" + _keyFile + "String_Node_Str",t);
    }
  }
 else {
    writeKeyStoreToFile(_pwdStore,_keyFile,masterPassword);
  }
  loadKeyStore(_keyFile,getMasterPassword());
}

Fixed version (ground truth):
/** 
 * Writes the current KeyStore to disk in a manner that preserves its on-disk representation from being destroyed if something goes wrong; a temporary file is used.
 */
private synchronized void writeKeyStoreSafe(final char[] masterPassword) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnrecoverableKeyException {
  final boolean keystoreExists=_keyFile.exists();
  if (keystoreExists) {
    final KeyStore oldStore=_pwdStore;
    final KeyStore newKeyStore=duplicateKeyStore(masterPassword);
    final File saveOld=new File(_keyFile.toString() + "String_Node_Str");
    if (!_keyFile.renameTo(saveOld)) {
      final String msg="String_Node_Str" + _keyFile + "String_Node_Str"+ saveOld;
      throw new IOException(msg);
    }
    try {
      writeKeyStoreToFile(newKeyStore,_keyFile,masterPassword);
      _pwdStore=newKeyStore;
      _masterPassword=masterPassword;
    }
 catch (    final Throwable t) {
      try {
        if (!saveOld.renameTo(_keyFile))         throw new RuntimeException("String_Node_Str" + "String_Node_Str",t);
      }
 catch (      final Throwable tt) {
        throw new RuntimeException("String_Node_Str" + "String_Node_Str",tt);
      }
      throw new RuntimeException("String_Node_Str",t);
    }
    try {
      if (!saveOld.delete())       throw new RuntimeException("String_Node_Str" + _keyFile + "String_Node_Str");
    }
 catch (    Throwable t) {
      throw new RuntimeException("String_Node_Str" + _keyFile + "String_Node_Str",t);
    }
  }
 else {
    writeKeyStoreToFile(_pwdStore,_keyFile,masterPassword);
  }
  loadKeyStore(_keyFile,getMasterPassword());
}