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();