diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-10-09 00:58:07 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-10-09 00:58:07 +0200 |
commit | 49b4ff63122988dc1587844e6b4b2ee5d0855385 (patch) | |
tree | 5935990ff98baa2ee0f224ff666fad433e2f451a /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedKeyRing.java | |
parent | 3165f3ffa8b16dcee11e6dfc21492b556d0c1de3 (diff) | |
download | open-keychain-49b4ff63122988dc1587844e6b4b2ee5d0855385.tar.gz open-keychain-49b4ff63122988dc1587844e6b4b2ee5d0855385.tar.bz2 open-keychain-49b4ff63122988dc1587844e6b4b2ee5d0855385.zip |
Replace PgpGeneralException with NotFoundException where appropriate
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedKeyRing.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedKeyRing.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedKeyRing.java index 08b7316aa..cc0de1e34 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedKeyRing.java @@ -19,7 +19,7 @@ package org.sufficientlysecure.keychain.pgp; import org.spongycastle.openpgp.PGPKeyRing; -import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; +import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException; import org.sufficientlysecure.keychain.util.IterableIterator; import java.io.IOException; @@ -56,11 +56,11 @@ public abstract class CanonicalizedKeyRing extends KeyRing { return getRing().getPublicKey().getFingerprint(); } - public String getPrimaryUserId() throws PgpGeneralException { + public String getPrimaryUserId() throws NotFoundException { return getPublicKey().getPrimaryUserId(); } - public String getPrimaryUserIdWithFallback() throws PgpGeneralException { + public String getPrimaryUserIdWithFallback() throws NotFoundException { return getPublicKey().getPrimaryUserIdWithFallback(); } @@ -87,24 +87,24 @@ public abstract class CanonicalizedKeyRing extends KeyRing { return creationDate.after(now) || (expiryDate != null && expiryDate.before(now)); } - public boolean canCertify() throws PgpGeneralException { + public boolean canCertify() throws NotFoundException { return getRing().getPublicKey().isEncryptionKey(); } - public long getEncryptId() throws PgpGeneralException { + public long getEncryptId() throws NotFoundException { for(CanonicalizedPublicKey key : publicKeyIterator()) { if (key.canEncrypt() && key.isValid()) { return key.getKeyId(); } } - throw new PgpGeneralException("No valid encryption key found!"); + throw new NotFoundException("No valid encryption key found!"); } - public boolean hasEncrypt() throws PgpGeneralException { + public boolean hasEncrypt() throws NotFoundException { try { getEncryptId(); return true; - } catch(PgpGeneralException e) { + } catch(NotFoundException e) { return false; } } |