Revert "Replace PgpGeneralException with NotFoundException where appropriate"

This reverts commit 49b4ff6312.
This commit is contained in:
Dominik Schürmann
2014-10-09 00:59:45 +02:00
parent a13bcbbb5b
commit b3f56c927b
20 changed files with 150 additions and 119 deletions

View File

@@ -272,24 +272,23 @@ public class OpenPgpService extends RemoteService {
InputData inputData = new InputData(is, inputLength);
// Find the appropriate subkey to sign with
final long sigSubKeyId;
try {
CachedPublicKeyRing signingRing =
new ProviderHelper(this).getCachedPublicKeyRing(accSettings.getKeyId());
sigSubKeyId = signingRing.getSecretSignId();
} catch (NotFoundException e) {
// secret key that is set for this account is deleted?
// show account config again!
return getCreateAccountIntent(data, getAccountName(data));
}
CachedPublicKeyRing signingRing =
new ProviderHelper(this).getCachedPublicKeyRing(accSettings.getKeyId());
final long sigSubKeyId = signingRing.getSecretSignId();
// get passphrase from cache, if key has "no" passphrase, this returns an empty String
String passphrase;
if (data.hasExtra(OpenPgpApi.EXTRA_PASSPHRASE)) {
passphrase = data.getStringExtra(OpenPgpApi.EXTRA_PASSPHRASE);
} else {
passphrase = PassphraseCacheService.getCachedPassphrase(getContext(),
accSettings.getKeyId(), sigSubKeyId);
try {
passphrase = PassphraseCacheService.getCachedPassphrase(getContext(),
accSettings.getKeyId(), sigSubKeyId);
} catch (PassphraseCacheService.KeyNotFoundException e) {
// secret key that is set for this account is deleted?
// show account config again!
return getCreateAccountIntent(data, getAccountName(data));
}
}
if (passphrase == null) {
// get PendingIntent for passphrase input, add it to given params and return to client

View File

@@ -27,12 +27,13 @@ import android.view.View;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.util.ActionBarHelper;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.remote.AccountSettings;
import org.sufficientlysecure.keychain.service.results.OperationResult;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
import org.sufficientlysecure.keychain.service.results.SingletonResult;
import org.sufficientlysecure.keychain.ui.util.ActionBarHelper;
import org.sufficientlysecure.keychain.util.Log;
public class AccountSettingsActivity extends ActionBarActivity {

View File

@@ -67,7 +67,7 @@ public class AccountSettingsFragment extends Fragment {
}
public void setAccSettings(AccountSettings accountSettings) {
mAccSettings = accountSettings;
this.mAccSettings = accountSettings;
mAccNameView.setText(accountSettings.getAccountName());
mSelectKeySpinner.setSelectedKeyId(accountSettings.getKeyId());