[openpgp] Improve control-flow logic in PainlessOpenPgpProvider

Also remove superfluous toString().
This commit is contained in:
Florian Schmaus 2021-05-02 18:43:41 +02:00
parent 64db6e3ebc
commit 5e43ef550f
1 changed files with 5 additions and 4 deletions

View File

@ -71,11 +71,12 @@ public class PainlessOpenPgpProvider implements OpenPgpProvider {
ArrayList<PGPPublicKeyRingCollection> recipientKeys = new ArrayList<>();
for (OpenPgpContact contact : recipients) {
PGPPublicKeyRingCollection keys = contact.getTrustedAnnouncedKeys();
if (keys != null) {
recipientKeys.add(keys);
} else {
LOGGER.log(Level.WARNING, "There are no suitable keys for contact " + contact.getJid().toString());
if (keys == null) {
LOGGER.log(Level.WARNING, "There are no suitable keys for contact " + contact.getJid());
}
recipientKeys.add(keys);
}
EncryptionStream cipherStream = PGPainless.createEncryptor().onOutputStream(cipherText)