Skip to content

Commit

Permalink
Merge pull request #810 from Aeskull/refactor/merge-if-statements
Browse files Browse the repository at this point in the history
Combine nested if-statements.
  • Loading branch information
kdhrubo authored Nov 26, 2024
2 parents 850cf26 + f6037dc commit 74b2a09
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ private void validateCertificate(X509Certificate cert) throws CertificateExcepti

// Check for basic constraints if it's a CA certificate
int basicConstraints = cert.getBasicConstraints();
if (basicConstraints != -1) { // -1 indicates this is not a CA
if (basicConstraints < 0) {
throw new CertificateException("Invalid basic constraints for CA certificate");
}
boolean isNotCA = basicConstraints != -1;
boolean isInvalid = basicConstraints < 0;
if (isNotCA && isInvalid) {
throw new CertificateException("Certificate has invalid subject");
}

// Log certificate information for debugging
Expand Down

0 comments on commit 74b2a09

Please sign in to comment.