Replace PgpGeneralException with NotFoundException where appropriate

This commit is contained in:
Dominik Schürmann
2014-10-09 00:58:07 +02:00
parent 3165f3ffa8
commit 49b4ff6312
20 changed files with 119 additions and 150 deletions

View File

@@ -229,9 +229,6 @@ public class EditKeyFragment extends LoaderFragment implements
} catch (NotFoundException e) {
finishWithError(LogType.MSG_EK_ERROR_NOT_FOUND);
return;
} catch (PgpGeneralException e) {
finishWithError(LogType.MSG_EK_ERROR_NOT_FOUND);
return;
}
try {

View File

@@ -139,7 +139,7 @@ public class EncryptAsymmetricFragment extends Fragment implements EncryptActivi
setSignatureKeyId(keyring.getMasterKeyId());
mSign.setSelectedKeyId(mEncryptInterface.getSignatureKey());
}
} catch (PgpGeneralException e) {
} catch (ProviderHelper.NotFoundException e) {
Log.e(Constants.TAG, "key not found!", e);
}
}
@@ -151,7 +151,7 @@ public class EncryptAsymmetricFragment extends Fragment implements EncryptActivi
CachedPublicKeyRing ring = mProviderHelper.getCachedPublicKeyRing(
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(preselectedId));
mEncryptKeyView.addObject(mEncryptKeyView.new EncryptionKey(ring));
} catch (PgpGeneralException e) {
} catch (ProviderHelper.NotFoundException e) {
Log.e(Constants.TAG, "key not found!", e);
}
}

View File

@@ -115,7 +115,7 @@ public class MultiCertifyKeyFragment extends LoaderFragment
if (key.canCertify()) {
mCertifyKeySpinner.setSelectedKeyId(certifyKeyId);
}
} catch (PgpGeneralException e) {
} catch (ProviderHelper.NotFoundException e) {
Log.e(Constants.TAG, "certify certify check failed", e);
}
}

View File

@@ -151,7 +151,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
// the catch clause doesn't return.
try {
userId = mSecretRing.getPrimaryUserIdWithFallback();
} catch (PgpGeneralException e) {
} catch (ProviderHelper.NotFoundException e) {
userId = null;
}
@@ -312,7 +312,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
PassphraseCacheService.addCachedPassphrase(getActivity(),
mSecretRing.getMasterKeyId(), mSubKeyId, passphrase,
mSecretRing.getPrimaryUserIdWithFallback());
} catch (PgpGeneralException e) {
} catch (ProviderHelper.NotFoundException e) {
Log.e(Constants.TAG, "adding of a passphrase failed", e);
}

View File

@@ -185,7 +185,7 @@ public class ViewCertActivity extends ActionBarActivity
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(mCertifierKeyId)).getMasterKeyId();
viewIntent.setData(KeyRings.buildGenericKeyRingUri(signerMasterKeyId));
startActivity(viewIntent);
} catch (PgpGeneralException e) {
} catch (ProviderHelper.NotFoundException e) {
// TODO notify user of this, maybe offer download?
Log.e(Constants.TAG, "key not found!", e);
}

View File

@@ -308,7 +308,7 @@ public class ViewKeyMainFragment extends LoaderFragment implements
}
// used instead of startActivity set actionbar based on callingPackage
startActivityForResult(intent, 0);
} catch (PgpGeneralException e) {
} catch (NotFoundException e) {
Log.e(Constants.TAG, "key not found!", e);
}
}

View File

@@ -145,7 +145,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
// the catch clause doesn't return.
try {
userId = mSecretRing.getPrimaryUserIdWithFallback();
} catch (PgpGeneralException e) {
} catch (ProviderHelper.NotFoundException e) {
userId = null;
}
@@ -308,7 +308,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
PassphraseCacheService.addCachedPassphrase(getActivity(),
mSecretRing.getMasterKeyId(), mSubKeyId, passphrase,
mSecretRing.getPrimaryUserIdWithFallback());
} catch (PgpGeneralException e) {
} catch (ProviderHelper.NotFoundException e) {
Log.e(Constants.TAG, "adding of a passphrase failed", e);
}

View File

@@ -42,6 +42,7 @@ import com.tokenautocomplete.TokenCompleteTextView;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.ContactHelper;
import org.sufficientlysecure.keychain.pgp.KeyRing;
@@ -198,7 +199,7 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView {
}
public EncryptionKey(CachedPublicKeyRing ring) throws PgpGeneralException {
public EncryptionKey(CachedPublicKeyRing ring) throws ProviderHelper.NotFoundException {
this(ring.getPrimaryUserId(), ring.extractOrGetMasterKeyId(),
KeyFormattingUtils.convertFingerprintToHex(ring.getFingerprint()));
}