1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-08 21:31:08 +01:00

Remove unnecessary throws declarations

This commit is contained in:
Paul Schaub 2022-09-29 13:02:22 +02:00
parent 81bb8cba54
commit 09f94944b3
13 changed files with 19 additions and 35 deletions

View file

@ -74,7 +74,7 @@ public class PGPKeyRingCollection {
}
public PGPKeyRingCollection(@Nonnull Collection<PGPKeyRing> collection, boolean isSilent)
throws IOException, PGPException {
throws PGPException {
List<PGPSecretKeyRing> secretKeyRings = new ArrayList<>();
List<PGPPublicKeyRing> publicKeyRings = new ArrayList<>();

View file

@ -327,7 +327,7 @@ public class SecretKeyRingEditor implements SecretKeyRingEditorInterface {
@Nonnull SecretKeyRingProtector primaryKeyProtector,
@Nonnull KeyFlag keyFlag,
KeyFlag... additionalKeyFlags)
throws PGPException, IOException, NoSuchAlgorithmException {
throws PGPException, IOException {
KeyFlag[] flags = concat(keyFlag, additionalKeyFlags);
PublicKeyAlgorithm subkeyAlgorithm = PublicKeyAlgorithm.requireFromId(subkey.getPublicKey().getAlgorithm());
SignatureSubpacketsUtil.assureKeyCanCarryFlags(subkeyAlgorithm);

View file

@ -232,10 +232,9 @@ public class KeyRingReader {
* @return public key ring collection
*
* @throws IOException in case of an IO error or exceeding of max iterations
* @throws PGPException in case of a broken key
*/
public static PGPPublicKeyRingCollection readPublicKeyRingCollection(@Nonnull InputStream inputStream, int maxIterations)
throws IOException, PGPException {
throws IOException {
PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(
ArmorUtils.getDecoderStream(inputStream));
@ -317,11 +316,10 @@ public class KeyRingReader {
* @return secret key ring collection
*
* @throws IOException in case of an IO error or exceeding of max iterations
* @throws PGPException in case of a broken secret key
*/
public static PGPSecretKeyRingCollection readSecretKeyRingCollection(@Nonnull InputStream inputStream,
int maxIterations)
throws IOException, PGPException {
throws IOException {
PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(
ArmorUtils.getDecoderStream(inputStream));

View file

@ -167,12 +167,9 @@ public final class KeyRingUtils {
*
* @param secretKeyRings secret key ring collection
* @return public key ring collection
* @throws PGPException TODO: remove
* @throws IOException TODO: remove
*/
@Nonnull
public static PGPPublicKeyRingCollection publicKeyRingCollectionFrom(@Nonnull PGPSecretKeyRingCollection secretKeyRings)
throws PGPException, IOException {
public static PGPPublicKeyRingCollection publicKeyRingCollectionFrom(@Nonnull PGPSecretKeyRingCollection secretKeyRings) {
List<PGPPublicKeyRing> certificates = new ArrayList<>();
for (PGPSecretKeyRing secretKey : secretKeyRings) {
certificates.add(PGPainless.extractCertificate(secretKey));
@ -200,13 +197,9 @@ public final class KeyRingUtils {
*
* @param rings array of public key rings
* @return key ring collection
*
* @throws IOException in case of an io error
* @throws PGPException in case of a broken key
*/
@Nonnull
public static PGPPublicKeyRingCollection keyRingsToKeyRingCollection(@Nonnull PGPPublicKeyRing... rings)
throws IOException, PGPException {
public static PGPPublicKeyRingCollection keyRingsToKeyRingCollection(@Nonnull PGPPublicKeyRing... rings) {
return new PGPPublicKeyRingCollection(Arrays.asList(rings));
}
@ -215,13 +208,9 @@ public final class KeyRingUtils {
*
* @param rings array of secret key rings
* @return secret key ring collection
*
* @throws IOException in case of an io error
* @throws PGPException in case of a broken key
*/
@Nonnull
public static PGPSecretKeyRingCollection keyRingsToKeyRingCollection(@Nonnull PGPSecretKeyRing... rings)
throws IOException, PGPException {
public static PGPSecretKeyRingCollection keyRingsToKeyRingCollection(@Nonnull PGPSecretKeyRing... rings) {
return new PGPSecretKeyRingCollection(Arrays.asList(rings));
}