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
1 changed files with 4 additions and 4 deletions

View File

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