diff options
author | Endi S. Dewata <edewata@redhat.com> | 2017-05-17 19:40:51 +0200 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2017-05-17 19:57:31 +0200 |
commit | 69d5dc82f8664d1eb5dfcdcec615088127c0ad97 (patch) | |
tree | 3393c1214da5bfd18f738ace9f10c7d7bf5abfda /base/server/cms/src/com | |
parent | c6ed9679acba5d0072a16878ecf98e0843ab6a3a (diff) | |
download | pki-69d5dc82f8664d1eb5dfcdcec615088127c0ad97.tar.gz pki-69d5dc82f8664d1eb5dfcdcec615088127c0ad97.tar.xz pki-69d5dc82f8664d1eb5dfcdcec615088127c0ad97.zip |
Refactored UpdateCRL.process() (part 2).
The UpdateCRL.process() has been refactored to reduce deeply
nested if-statements with early return.
https://pagure.io/dogtagpki/issue/2651
Change-Id: I5591bf08e617614ca7def5ce5fff61e0925e4fc5
Diffstat (limited to 'base/server/cms/src/com')
-rw-r--r-- | base/server/cms/src/com/netscape/cms/servlet/cert/UpdateCRL.java | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/base/server/cms/src/com/netscape/cms/servlet/cert/UpdateCRL.java b/base/server/cms/src/com/netscape/cms/servlet/cert/UpdateCRL.java index 118292220..86693610a 100644 --- a/base/server/cms/src/com/netscape/cms/servlet/cert/UpdateCRL.java +++ b/base/server/cms/src/com/netscape/cms/servlet/cert/UpdateCRL.java @@ -343,11 +343,25 @@ public class UpdateCRL extends CMSServlet { == ICRLIssuingPoint.CRL_IP_INITIALIZED) { crlIssuingPoint.clearCRLCache(); } - if (waitForUpdate != null && waitForUpdate.equals("true") && + if (!(waitForUpdate != null && waitForUpdate.equals("true") && crlIssuingPoint.isCRLGenerationEnabled() && crlIssuingPoint.isCRLUpdateInProgress() == ICRLIssuingPoint.CRL_UPDATE_DONE && crlIssuingPoint.isCRLIssuingPointInitialized() - == ICRLIssuingPoint.CRL_IP_INITIALIZED) { + == ICRLIssuingPoint.CRL_IP_INITIALIZED)) { + if (crlIssuingPoint.isCRLIssuingPointInitialized() != ICRLIssuingPoint.CRL_IP_INITIALIZED) { + header.addStringValue("crlUpdate", "notInitialized"); + } else if (crlIssuingPoint.isCRLUpdateInProgress() + != ICRLIssuingPoint.CRL_UPDATE_DONE || + crlIssuingPoint.isManualUpdateSet()) { + header.addStringValue("crlUpdate", "inProgress"); + } else if (!crlIssuingPoint.isCRLGenerationEnabled()) { + header.addStringValue("crlUpdate", "Disabled"); + } else { + crlIssuingPoint.setManualUpdate(signatureAlgorithm); + header.addStringValue("crlUpdate", "Scheduled"); + } + return; + } if (test != null && test.equals("true") && crlIssuingPoint.isCRLCacheTestingEnabled() && (!mTesting.contains(crlIssuingPointId))) { @@ -513,19 +527,5 @@ public class UpdateCRL extends CMSServlet { } } } - } else { - if (crlIssuingPoint.isCRLIssuingPointInitialized() != ICRLIssuingPoint.CRL_IP_INITIALIZED) { - header.addStringValue("crlUpdate", "notInitialized"); - } else if (crlIssuingPoint.isCRLUpdateInProgress() - != ICRLIssuingPoint.CRL_UPDATE_DONE || - crlIssuingPoint.isManualUpdateSet()) { - header.addStringValue("crlUpdate", "inProgress"); - } else if (!crlIssuingPoint.isCRLGenerationEnabled()) { - header.addStringValue("crlUpdate", "Disabled"); - } else { - crlIssuingPoint.setManualUpdate(signatureAlgorithm); - header.addStringValue("crlUpdate", "Scheduled"); - } - } } } |