summaryrefslogtreecommitdiffstats
path: root/base/server/cms/src/com
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2017-05-17 19:40:51 +0200
committerEndi S. Dewata <edewata@redhat.com>2017-05-17 19:57:31 +0200
commit69d5dc82f8664d1eb5dfcdcec615088127c0ad97 (patch)
tree3393c1214da5bfd18f738ace9f10c7d7bf5abfda /base/server/cms/src/com
parentc6ed9679acba5d0072a16878ecf98e0843ab6a3a (diff)
downloadpki-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.java32
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");
- }
- }
}
}