aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2013-01-18 00:36:30 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2013-01-18 00:36:30 +0100
commitd599d26bbd0652532ae667bc81ca812c74299504 (patch)
tree60f3ed91f2efba326b90b847e000592ada696433 /OpenPGP-Keychain
parent9e5aab34830c5b821e3a47d6d3d4f0a637139e2b (diff)
downloadopen-keychain-d599d26bbd0652532ae667bc81ca812c74299504.tar.gz
open-keychain-d599d26bbd0652532ae667bc81ca812c74299504.tar.bz2
open-keychain-d599d26bbd0652532ae667bc81ca812c74299504.zip
Error handling when keyring is not found
Diffstat (limited to 'OpenPGP-Keychain')
-rw-r--r--OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EditKeyActivity.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EditKeyActivity.java
index 42f559b1d..90ee9838e 100644
--- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EditKeyActivity.java
+++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/EditKeyActivity.java
@@ -247,8 +247,8 @@ public class EditKeyActivity extends SherlockFragmentActivity {
serviceIntent.putExtra(KeychainIntentService.EXTRA_DATA, data);
// Message is received after generating is done in ApgService
- KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this,
- R.string.progress_generating, ProgressDialog.STYLE_SPINNER) {
+ KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
+ this, R.string.progress_generating, ProgressDialog.STYLE_SPINNER) {
public void handleMessage(Message message) {
// handle messages by standard ApgHandler first
super.handleMessage(message);
@@ -318,11 +318,11 @@ public class EditKeyActivity extends SherlockFragmentActivity {
if (extras != null) {
if (extras.containsKey(EXTRA_MASTER_KEY_ID)) {
- long keyId = extras.getLong(EXTRA_MASTER_KEY_ID);
+ long masterKeyId = extras.getLong(EXTRA_MASTER_KEY_ID);
- if (keyId != 0) {
+ if (masterKeyId != 0) {
PGPSecretKey masterKey = null;
- mKeyRing = ProviderHelper.getPGPSecretKeyRingByMasterKeyId(this, keyId);
+ mKeyRing = ProviderHelper.getPGPSecretKeyRingByMasterKeyId(this, masterKeyId);
if (mKeyRing != null) {
masterKey = PgpHelper.getMasterKey(mKeyRing);
for (PGPSecretKey key : new IterableIterator<PGPSecretKey>(
@@ -330,6 +330,10 @@ public class EditKeyActivity extends SherlockFragmentActivity {
mKeys.add(key);
mKeysUsages.add(-1); // get usage when view is created
}
+ } else {
+ Log.e(Constants.TAG, "Keyring not found with masterKeyId: " + masterKeyId);
+ Toast.makeText(this, R.string.error_noSecretKeyFound, Toast.LENGTH_LONG)
+ .show();
}
if (masterKey != null) {
for (String userId : new IterableIterator<String>(masterKey.getUserIDs())) {
@@ -427,11 +431,13 @@ public class EditKeyActivity extends SherlockFragmentActivity {
// Send all information needed to service to edit key in other thread
Intent intent = new Intent(this, KeychainIntentService.class);
- intent.putExtra(KeychainIntentService.EXTRA_ACTION, KeychainIntentService.ACTION_SAVE_KEYRING);
+ intent.putExtra(KeychainIntentService.EXTRA_ACTION,
+ KeychainIntentService.ACTION_SAVE_KEYRING);
// fill values for this action
Bundle data = new Bundle();
- data.putString(KeychainIntentService.SAVE_KEYRING_CURRENT_PASSPHRASE, mCurrentPassPhrase);
+ data.putString(KeychainIntentService.SAVE_KEYRING_CURRENT_PASSPHRASE,
+ mCurrentPassPhrase);
data.putString(KeychainIntentService.SAVE_KEYRING_NEW_PASSPHRASE, mNewPassPhrase);
data.putStringArrayList(KeychainIntentService.SAVE_KEYRING_USER_IDS,
getUserIds(mUserIdsView));