1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Don't delete certs. on account creation, & assure that only one instance of LocalKeyStore is created.

This commit is contained in:
Joe Steele 2013-12-03 19:03:41 -05:00
parent 765b390eb5
commit 9333f4f7f4
2 changed files with 5 additions and 1 deletions

View File

@ -1900,6 +1900,10 @@ public class Account implements BaseAccount {
} }
String oldHost = uri.getHost(); String oldHost = uri.getHost();
int oldPort = uri.getPort(); int oldPort = uri.getPort();
if (oldPort == -1) {
// This occurs when a new account is created
return;
}
if (!newHost.equals(oldHost) || newPort != oldPort) { if (!newHost.equals(oldHost) || newPort != oldPort) {
LocalKeyStore localKeyStore = LocalKeyStore.getInstance(context); LocalKeyStore localKeyStore = LocalKeyStore.getInstance(context);
localKeyStore.deleteCertificate(oldHost, oldPort); localKeyStore.deleteCertificate(oldHost, oldPort);

View File

@ -24,7 +24,7 @@ public class LocalKeyStore {
private static LocalKeyStore sInstance; private static LocalKeyStore sInstance;
public static LocalKeyStore getInstance(Context context) { public synchronized static LocalKeyStore getInstance(Context context) {
if (sInstance == null) { if (sInstance == null) {
sInstance = new LocalKeyStore(context); sInstance = new LocalKeyStore(context);
} }