Merge nested if-statements

This commit is contained in:
Paul Schaub 2021-08-15 15:43:19 +02:00
parent 28f6664b29
commit dd941fb293
2 changed files with 6 additions and 12 deletions

View File

@ -149,10 +149,8 @@ public class KeyRingInfo {
} }
if (publicKey == getPublicKey()) { if (publicKey == getPublicKey()) {
if (signatures.primaryKeyRevocation != null) { if (signatures.primaryKeyRevocation != null && SignatureUtils.isHardRevocation(signatures.primaryKeyRevocation)) {
if (SignatureUtils.isHardRevocation(signatures.primaryKeyRevocation)) { return false;
return false;
}
} }
return signatures.primaryKeyRevocation == null; return signatures.primaryKeyRevocation == null;
} }
@ -825,10 +823,8 @@ public class KeyRingInfo {
* @return encryption subkeys * @return encryption subkeys
*/ */
public @Nonnull List<PGPPublicKey> getEncryptionSubkeys(String userId, EncryptionPurpose purpose) { public @Nonnull List<PGPPublicKey> getEncryptionSubkeys(String userId, EncryptionPurpose purpose) {
if (userId != null) { if (userId != null && !isUserIdValid(userId)) {
if (!isUserIdValid(userId)) { throw new KeyValidationError(userId, getLatestUserIdCertification(userId), getUserIdRevocation(userId));
throw new KeyValidationException(userId, getLatestUserIdCertification(userId), getUserIdRevocation(userId));
}
} }
return getEncryptionSubkeys(purpose); return getEncryptionSubkeys(purpose);

View File

@ -308,10 +308,8 @@ public final class SignatureUtils {
if (issuerKeyId != null && issuerKeyId.getKeyID() != 0) { if (issuerKeyId != null && issuerKeyId.getKeyID() != 0) {
return issuerKeyId.getKeyID(); return issuerKeyId.getKeyID();
} }
if (issuerKeyId == null) { if (issuerKeyId == null && fingerprint != null) {
if (fingerprint != null) { return fingerprint.getKeyId();
return fingerprint.getKeyId();
}
} }
return 0; return 0;
} }