From 83362816d0dd88ee0c45631ddb09da0c3e1cc730 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sat, 9 Jan 2021 20:44:33 +0100 Subject: [PATCH] toRecipients(): Throw IllegalArgumentException instead of IllegalStateException --- .../pgpainless/encryption_signing/EncryptionBuilder.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/EncryptionBuilder.java b/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/EncryptionBuilder.java index 202f9fb8..19083a61 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/EncryptionBuilder.java +++ b/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/EncryptionBuilder.java @@ -98,7 +98,7 @@ public class EncryptionBuilder implements EncryptionBuilderInterface { } if (encryptionKeys.isEmpty()) { - throw new IllegalStateException("No valid encryption keys found!"); + throw new IllegalArgumentException("No valid encryption keys found!"); } EncryptionBuilder.this.encryptionKeys.addAll(encryptionKeys); } @@ -118,7 +118,7 @@ public class EncryptionBuilder implements EncryptionBuilderInterface { } } if (encryptionKeys.isEmpty()) { - throw new IllegalStateException("No valid encryption keys found!"); + throw new IllegalArgumentException("No valid encryption keys found!"); } EncryptionBuilder.this.encryptionKeys.addAll(encryptionKeys); } @@ -141,7 +141,7 @@ public class EncryptionBuilder implements EncryptionBuilderInterface { } if (encryptionKeys.isEmpty()) { - throw new IllegalStateException("No valid encryption keys found!"); + throw new IllegalArgumentException("No valid encryption keys found!"); } EncryptionBuilder.this.encryptionKeys.addAll(encryptionKeys); @@ -169,7 +169,7 @@ public class EncryptionBuilder implements EncryptionBuilderInterface { } if (EncryptionBuilder.this.encryptionKeys.isEmpty()) { - throw new IllegalStateException("No valid encryption keys found!"); + throw new IllegalArgumentException("No valid encryption keys found!"); } return new WithAlgorithmsImpl();