1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-26 22:32:07 +01:00

toRecipients(): Throw IllegalArgumentException instead of IllegalStateException

This commit is contained in:
Paul Schaub 2021-01-09 20:44:33 +01:00
parent 4f0493bce7
commit 83362816d0
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -98,7 +98,7 @@ public class EncryptionBuilder implements EncryptionBuilderInterface {
} }
if (encryptionKeys.isEmpty()) { if (encryptionKeys.isEmpty()) {
throw new IllegalStateException("No valid encryption keys found!"); throw new IllegalArgumentException("No valid encryption keys found!");
} }
EncryptionBuilder.this.encryptionKeys.addAll(encryptionKeys); EncryptionBuilder.this.encryptionKeys.addAll(encryptionKeys);
} }
@ -118,7 +118,7 @@ public class EncryptionBuilder implements EncryptionBuilderInterface {
} }
} }
if (encryptionKeys.isEmpty()) { if (encryptionKeys.isEmpty()) {
throw new IllegalStateException("No valid encryption keys found!"); throw new IllegalArgumentException("No valid encryption keys found!");
} }
EncryptionBuilder.this.encryptionKeys.addAll(encryptionKeys); EncryptionBuilder.this.encryptionKeys.addAll(encryptionKeys);
} }
@ -141,7 +141,7 @@ public class EncryptionBuilder implements EncryptionBuilderInterface {
} }
if (encryptionKeys.isEmpty()) { if (encryptionKeys.isEmpty()) {
throw new IllegalStateException("No valid encryption keys found!"); throw new IllegalArgumentException("No valid encryption keys found!");
} }
EncryptionBuilder.this.encryptionKeys.addAll(encryptionKeys); EncryptionBuilder.this.encryptionKeys.addAll(encryptionKeys);
@ -169,7 +169,7 @@ public class EncryptionBuilder implements EncryptionBuilderInterface {
} }
if (EncryptionBuilder.this.encryptionKeys.isEmpty()) { if (EncryptionBuilder.this.encryptionKeys.isEmpty()) {
throw new IllegalStateException("No valid encryption keys found!"); throw new IllegalArgumentException("No valid encryption keys found!");
} }
return new WithAlgorithmsImpl(); return new WithAlgorithmsImpl();