summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/common/src/CMakeLists.txt1
-rw-r--r--base/common/src/com/netscape/certsrv/request/RequestStatus.java116
-rw-r--r--base/common/src/com/netscape/certsrv/request/RequestStatusAdapter.java38
-rw-r--r--base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java44
-rw-r--r--base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java56
-rw-r--r--base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java45
-rw-r--r--base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java23
-rw-r--r--base/common/src/com/netscape/cms/servlet/cert/DoUnrevokeTPS.java23
-rw-r--r--base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java4
-rw-r--r--base/common/src/com/netscape/cms/servlet/request/CertReqParser.java4
10 files changed, 179 insertions, 175 deletions
diff --git a/base/common/src/CMakeLists.txt b/base/common/src/CMakeLists.txt
index 6d8386faf..55720ab14 100644
--- a/base/common/src/CMakeLists.txt
+++ b/base/common/src/CMakeLists.txt
@@ -366,6 +366,7 @@ set(pki-certsrv_java_SRCS
com/netscape/certsrv/request/IRequestListener.java
com/netscape/certsrv/request/AgentApproval.java
com/netscape/certsrv/request/RequestStatus.java
+ com/netscape/certsrv/request/RequestStatusAdapter.java
com/netscape/certsrv/request/IRequestScheduler.java
com/netscape/certsrv/request/IRequest.java
com/netscape/certsrv/request/IRequestQueue.java
diff --git a/base/common/src/com/netscape/certsrv/request/RequestStatus.java b/base/common/src/com/netscape/certsrv/request/RequestStatus.java
index 4aec1b56a..259fb8e1c 100644
--- a/base/common/src/com/netscape/certsrv/request/RequestStatus.java
+++ b/base/common/src/com/netscape/certsrv/request/RequestStatus.java
@@ -18,6 +18,10 @@
package com.netscape.certsrv.request;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
/**
* The RequestStatus class represents the current state of a request
@@ -38,13 +42,9 @@ import java.io.Serializable;
public final class RequestStatus implements Serializable {
private static final long serialVersionUID = -8176052970922133411L;
- public static String BEGIN_STRING = "begin";
- public static String PENDING_STRING = "pending";
- public static String APPROVED_STRING = "approved";
- public static String SVC_PENDING_STRING = "svc_pending";
- public static String CANCELED_STRING = "canceled";
- public static String REJECTED_STRING = "rejected";
- public static String COMPLETE_STRING = "complete";
+
+ public static final Collection<RequestStatus> INSTANCES = new ArrayList<RequestStatus>();
+ public static final Map<String, RequestStatus> LABELS = new LinkedHashMap<String, RequestStatus>();
/**
* The initial state of a request. Requests in this state have not
@@ -54,7 +54,7 @@ public final class RequestStatus implements Serializable {
* but it could be some other protocol module, such as email)
* should populate the request with data need to service it.
*/
- public static RequestStatus BEGIN = new RequestStatus(BEGIN_STRING);
+ public static RequestStatus BEGIN = new RequestStatus("begin");
/**
* The state of a request that is waiting for action by an agent.
@@ -64,7 +64,7 @@ public final class RequestStatus implements Serializable {
* In this state there may be PolicyMessages present that indicate
* the reason for the pending status.
*/
- public static RequestStatus PENDING = new RequestStatus(PENDING_STRING);
+ public static RequestStatus PENDING = new RequestStatus("pending");
/**
* The state of a request that has been approved by an agent, or
@@ -74,22 +74,21 @@ public final class RequestStatus implements Serializable {
* These requests are resent to the service during the recovery
* process that runs at server startup.
*/
- public static RequestStatus APPROVED = new RequestStatus(APPROVED_STRING);
+ public static RequestStatus APPROVED = new RequestStatus("approved");
/**
* The state of a request that has been sent to the service, but
* has not been fully processed. The service will invoke the
* serviceComplete() method to cause processing to continue.
*/
- public static RequestStatus SVC_PENDING =
- new RequestStatus(SVC_PENDING_STRING);
+ public static RequestStatus SVC_PENDING = new RequestStatus("svc_pending");
/**
* Not implemented. This is intended to be a final state that is
* reached when a request is removed from the processing queue without
* normal notification occurring. (see REJECTED)
*/
- public static RequestStatus CANCELED = new RequestStatus(CANCELED_STRING);
+ public static RequestStatus CANCELED = new RequestStatus("canceled");
/**
* The state of a request after it is rejected. When a request is
@@ -100,7 +99,7 @@ public final class RequestStatus implements Serializable {
* the rejection, or AgentMessages, which allow the agent to give
* reasons for the action.
*/
- public static RequestStatus REJECTED = new RequestStatus(REJECTED_STRING);
+ public static RequestStatus REJECTED = new RequestStatus("rejected");
/**
* The normal final state of a request. The completion status attribute
@@ -108,35 +107,38 @@ public final class RequestStatus implements Serializable {
* necessarily successful, but may indicated that service processing
* did not succeed.
*/
- public static RequestStatus COMPLETE = new RequestStatus(COMPLETE_STRING);
+ public static RequestStatus COMPLETE = new RequestStatus("complete");
+
+ private String label;
+
+ /**
+ * Class constructor. Creates request status from the string.
+ *
+ * @param label string describing request status
+ */
+ private RequestStatus(String label) {
+ this.label = label;
+
+ INSTANCES.add(this);
+ LABELS.put(label.toLowerCase(), this);
+ }
/**
* Converts a string name for a request status into the
* request status enum object.
* <p>
*
- * @param s
+ * @param label
* The string representation of the state.
* @return
* request status
*/
- public static RequestStatus fromString(String s) {
- if (s.equals(BEGIN_STRING))
- return BEGIN;
- if (s.equals(PENDING_STRING))
- return PENDING;
- if (s.equals(APPROVED_STRING))
- return APPROVED;
- if (s.equals(SVC_PENDING_STRING))
- return SVC_PENDING;
- if (s.equals(CANCELED_STRING))
- return CANCELED;
- if (s.equals(REJECTED_STRING))
- return REJECTED;
- if (s.equals(COMPLETE_STRING))
- return COMPLETE;
-
- return null;
+ public static RequestStatus fromString(String label) {
+ return valueOf(label);
+ }
+
+ public static RequestStatus valueOf(String label) {
+ return LABELS.get(label.toLowerCase());
}
/**
@@ -146,41 +148,31 @@ public final class RequestStatus implements Serializable {
* @return request status
*/
public String toString() {
- return mString;
+ return label;
}
- /**
- * Class constructor. Creates request status from the string.
- *
- * @param string string describing request status
- */
- private RequestStatus(String string) {
- mString = string;
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((label == null) ? 0 : label.hashCode());
+ return result;
}
- private String mString;
-
- /**
- * Compares request status with specified string.
- *
- * @param string string describing request status
- */
- public boolean equals(String string) {
- if (string.equals(mString))
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
return true;
- else
+ if (obj == null)
return false;
- }
-
- /**
- * Compares current request status with request status.
- *
- * @param rs request status
- */
- public boolean equals(RequestStatus rs) {
- if (mString.equals(rs.mString))
- return true;
- else
+ if (getClass() != obj.getClass())
+ return false;
+ RequestStatus other = (RequestStatus) obj;
+ if (label == null) {
+ if (other.label != null)
+ return false;
+ } else if (!label.equals(other.label))
return false;
+ return true;
}
}
diff --git a/base/common/src/com/netscape/certsrv/request/RequestStatusAdapter.java b/base/common/src/com/netscape/certsrv/request/RequestStatusAdapter.java
new file mode 100644
index 000000000..06b3605bb
--- /dev/null
+++ b/base/common/src/com/netscape/certsrv/request/RequestStatusAdapter.java
@@ -0,0 +1,38 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2012 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.request;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * The RevocationReasonAdapter class provides custom marshaling for RevocationReason.
+ *
+ * @author Endi S. Dewata
+ */
+public class RequestStatusAdapter extends XmlAdapter<String, RequestStatus> {
+
+ public RequestStatus unmarshal(String value) throws Exception {
+ return StringUtils.isEmpty(value) ? null : RequestStatus.valueOf(value);
+ }
+
+ public String marshal(RequestStatus value) throws Exception {
+ return value == null ? null : value.toString();
+ }
+} \ No newline at end of file
diff --git a/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java b/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java
index b7120010a..b45f46d12 100644
--- a/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java
+++ b/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java
@@ -374,7 +374,7 @@ public class CMCRevReqServlet extends CMSServlet {
String auditRequesterID = auditRequesterID(req);
String auditSerialNumber = auditSerialNumber(eeSerialNumber);
String auditRequestType = auditRequestType(reason);
- String auditApprovalStatus = ILogger.SIGNED_AUDIT_EMPTY_VALUE;
+ RequestStatus auditApprovalStatus = null;
String auditReasonNum = String.valueOf(reason);
try {
@@ -576,7 +576,7 @@ public class CMCRevReqServlet extends CMSServlet {
mQueue.processRequest(revReq);
// retrieve the request status
- auditApprovalStatus = revReq.getRequestStatus().toString();
+ auditApprovalStatus = revReq.getRequestStatus();
RequestStatus stat = revReq.getRequestStatus();
@@ -810,9 +810,9 @@ public class CMCRevReqServlet extends CMSServlet {
// store a message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(RequestStatus.COMPLETE_STRING))
- || (auditApprovalStatus.equals(RequestStatus.REJECTED_STRING))
- || (auditApprovalStatus.equals(RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -821,7 +821,7 @@ public class CMCRevReqServlet extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -844,9 +844,9 @@ public class CMCRevReqServlet extends CMSServlet {
// message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(RequestStatus.COMPLETE_STRING))
- || (auditApprovalStatus.equals(RequestStatus.REJECTED_STRING))
- || (auditApprovalStatus.equals(RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -855,7 +855,7 @@ public class CMCRevReqServlet extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -882,9 +882,9 @@ public class CMCRevReqServlet extends CMSServlet {
// message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(RequestStatus.COMPLETE_STRING))
- || (auditApprovalStatus.equals(RequestStatus.REJECTED_STRING))
- || (auditApprovalStatus.equals(RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -893,7 +893,7 @@ public class CMCRevReqServlet extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -921,9 +921,9 @@ public class CMCRevReqServlet extends CMSServlet {
// message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(RequestStatus.COMPLETE_STRING))
- || (auditApprovalStatus.equals(RequestStatus.REJECTED_STRING))
- || (auditApprovalStatus.equals(RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -932,7 +932,7 @@ public class CMCRevReqServlet extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -957,9 +957,9 @@ public class CMCRevReqServlet extends CMSServlet {
// message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(RequestStatus.COMPLETE_STRING))
- || (auditApprovalStatus.equals(RequestStatus.REJECTED_STRING))
- || (auditApprovalStatus.equals(RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -968,7 +968,7 @@ public class CMCRevReqServlet extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
diff --git a/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java b/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java
index aac4315e7..be17272ec 100644
--- a/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java
+++ b/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java
@@ -430,7 +430,7 @@ public class DoRevoke extends CMSServlet {
String auditRequesterID = auditRequesterID(req);
String auditSerialNumber = auditSerialNumber(eeSerialNumber);
String auditRequestType = auditRequestType(reason);
- String auditApprovalStatus = ILogger.SIGNED_AUDIT_EMPTY_VALUE;
+ RequestStatus auditApprovalStatus = null;
String auditReasonNum = String.valueOf(reason);
CMS.debug("DoRevoke: eeSerialNumber: " + eeSerialNumber + " auditSerialNumber: " + auditSerialNumber);
@@ -696,7 +696,7 @@ public class DoRevoke extends CMSServlet {
mQueue.processRequest(revReq);
// retrieve the request status
- auditApprovalStatus = revReq.getRequestStatus().toString();
+ auditApprovalStatus = revReq.getRequestStatus();
RequestStatus stat = revReq.getRequestStatus();
String type = revReq.getRequestType();
@@ -747,12 +747,9 @@ public class DoRevoke extends CMSServlet {
// store a message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(
- RequestStatus.COMPLETE_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.REJECTED_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -761,7 +758,7 @@ public class DoRevoke extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -963,9 +960,9 @@ public class DoRevoke extends CMSServlet {
// store a message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(RequestStatus.COMPLETE_STRING))
- || (auditApprovalStatus.equals(RequestStatus.REJECTED_STRING))
- || (auditApprovalStatus.equals(RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -974,7 +971,7 @@ public class DoRevoke extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -997,12 +994,9 @@ public class DoRevoke extends CMSServlet {
// message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(
- RequestStatus.COMPLETE_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.REJECTED_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -1011,7 +1005,7 @@ public class DoRevoke extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -1038,12 +1032,9 @@ public class DoRevoke extends CMSServlet {
// message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(
- RequestStatus.COMPLETE_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.REJECTED_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -1052,7 +1043,7 @@ public class DoRevoke extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -1080,12 +1071,9 @@ public class DoRevoke extends CMSServlet {
// message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(
- RequestStatus.COMPLETE_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.REJECTED_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -1094,7 +1082,7 @@ public class DoRevoke extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
diff --git a/base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java b/base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java
index 35bdd5c8c..65abd8a22 100644
--- a/base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java
+++ b/base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java
@@ -325,7 +325,7 @@ public class DoRevokeTPS extends CMSServlet {
String auditRequesterID = auditRequesterID(req);
String auditSerialNumber = auditSerialNumber(null);
String auditRequestType = auditRequestType(reason);
- String auditApprovalStatus = ILogger.SIGNED_AUDIT_EMPTY_VALUE;
+ RequestStatus auditApprovalStatus = null;
String auditReasonNum = String.valueOf(reason);
if (revokeAll != null) {
@@ -499,7 +499,7 @@ public class DoRevokeTPS extends CMSServlet {
mQueue.processRequest(revReq);
// retrieve the request status
- auditApprovalStatus = revReq.getRequestStatus().toString();
+ auditApprovalStatus = revReq.getRequestStatus();
RequestStatus stat = revReq.getRequestStatus();
String type = revReq.getRequestType();
@@ -550,12 +550,9 @@ public class DoRevokeTPS extends CMSServlet {
// store a message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(
- RequestStatus.COMPLETE_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.REJECTED_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -564,7 +561,7 @@ public class DoRevokeTPS extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -744,9 +741,9 @@ public class DoRevokeTPS extends CMSServlet {
// store a message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(RequestStatus.COMPLETE_STRING))
- || (auditApprovalStatus.equals(RequestStatus.REJECTED_STRING))
- || (auditApprovalStatus.equals(RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -755,7 +752,7 @@ public class DoRevokeTPS extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -779,12 +776,9 @@ public class DoRevokeTPS extends CMSServlet {
// message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(
- RequestStatus.COMPLETE_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.REJECTED_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -793,7 +787,7 @@ public class DoRevokeTPS extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -821,12 +815,9 @@ public class DoRevokeTPS extends CMSServlet {
// message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(
- RequestStatus.COMPLETE_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.REJECTED_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -835,7 +826,7 @@ public class DoRevokeTPS extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
diff --git a/base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java b/base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java
index 5605acf6d..1f018261b 100644
--- a/base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java
+++ b/base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java
@@ -249,7 +249,7 @@ public class DoUnrevoke extends CMSServlet {
String auditRequesterID = auditRequesterID(req);
String auditSerialNumber = auditSerialNumber(serialNumbers[0].toString());
String auditRequestType = OFF_HOLD;
- String auditApprovalStatus = ILogger.SIGNED_AUDIT_EMPTY_VALUE;
+ RequestStatus auditApprovalStatus = null;
String auditReasonNum = String.valueOf(OFF_HOLD_REASON);
try {
@@ -291,7 +291,7 @@ public class DoUnrevoke extends CMSServlet {
mQueue.processRequest(unrevReq);
// retrieve the request status
- auditApprovalStatus = unrevReq.getRequestStatus().toString();
+ auditApprovalStatus = unrevReq.getRequestStatus();
RequestStatus status = unrevReq.getRequestStatus();
String type = unrevReq.getRequestType();
@@ -514,9 +514,9 @@ public class DoUnrevoke extends CMSServlet {
// store a message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(RequestStatus.COMPLETE_STRING))
- || (auditApprovalStatus.equals(RequestStatus.REJECTED_STRING))
- || (auditApprovalStatus.equals(RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -525,7 +525,7 @@ public class DoUnrevoke extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -548,12 +548,9 @@ public class DoUnrevoke extends CMSServlet {
// message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(
- RequestStatus.COMPLETE_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.REJECTED_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -562,7 +559,7 @@ public class DoUnrevoke extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
diff --git a/base/common/src/com/netscape/cms/servlet/cert/DoUnrevokeTPS.java b/base/common/src/com/netscape/cms/servlet/cert/DoUnrevokeTPS.java
index 7916887f8..ff383bbb4 100644
--- a/base/common/src/com/netscape/cms/servlet/cert/DoUnrevokeTPS.java
+++ b/base/common/src/com/netscape/cms/servlet/cert/DoUnrevokeTPS.java
@@ -246,7 +246,7 @@ public class DoUnrevokeTPS extends CMSServlet {
String auditRequesterID = auditRequesterID(req);
String auditSerialNumber = auditSerialNumber(serialNumbers[0].toString());
String auditRequestType = OFF_HOLD;
- String auditApprovalStatus = ILogger.SIGNED_AUDIT_EMPTY_VALUE;
+ RequestStatus auditApprovalStatus = null;
String auditReasonNum = String.valueOf(OFF_HOLD_REASON);
try {
@@ -286,7 +286,7 @@ public class DoUnrevokeTPS extends CMSServlet {
mQueue.processRequest(unrevReq);
// retrieve the request status
- auditApprovalStatus = unrevReq.getRequestStatus().toString();
+ auditApprovalStatus = unrevReq.getRequestStatus();
RequestStatus status = unrevReq.getRequestStatus();
String type = unrevReq.getRequestType();
@@ -458,9 +458,9 @@ public class DoUnrevokeTPS extends CMSServlet {
// store a message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(RequestStatus.COMPLETE_STRING))
- || (auditApprovalStatus.equals(RequestStatus.REJECTED_STRING))
- || (auditApprovalStatus.equals(RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -469,7 +469,7 @@ public class DoUnrevokeTPS extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
@@ -492,12 +492,9 @@ public class DoUnrevokeTPS extends CMSServlet {
// message in the signed audit log file
// if and only if "auditApprovalStatus" is
// "complete", "revoked", or "canceled"
- if ((auditApprovalStatus.equals(
- RequestStatus.COMPLETE_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.REJECTED_STRING)) ||
- (auditApprovalStatus.equals(
- RequestStatus.CANCELED_STRING))) {
+ if (auditApprovalStatus == RequestStatus.COMPLETE ||
+ auditApprovalStatus == RequestStatus.REJECTED ||
+ auditApprovalStatus == RequestStatus.CANCELED) {
auditMessage = CMS.getLogMessage(
LOGGING_SIGNED_AUDIT_CERT_STATUS_CHANGE_REQUEST_PROCESSED,
auditSubjectID,
@@ -506,7 +503,7 @@ public class DoUnrevokeTPS extends CMSServlet {
auditSerialNumber,
auditRequestType,
auditReasonNum,
- auditApprovalStatus);
+ auditApprovalStatus == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : auditApprovalStatus.toString());
audit(auditMessage);
}
diff --git a/base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java b/base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java
index dc0b0c474..c3d36561d 100644
--- a/base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java
+++ b/base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java
@@ -1770,8 +1770,8 @@ public class CRSEnrollment extends HttpServlet {
crsResp.setPKIStatus(CRSPKIMessage.mStatus_FAILURE);
crsResp.setFailInfo(CRSPKIMessage.mFailInfo_badAlg);
}
- } else if (status.equals(RequestStatus.REJECTED_STRING) ||
- status.equals(RequestStatus.CANCELED_STRING)) {
+ } else if (status == RequestStatus.REJECTED ||
+ status == RequestStatus.CANCELED) {
crsResp.setPKIStatus(CRSPKIMessage.mStatus_FAILURE);
crsResp.setFailInfo(CRSPKIMessage.mFailInfo_badRequest);
} else { // not complete
diff --git a/base/common/src/com/netscape/cms/servlet/request/CertReqParser.java b/base/common/src/com/netscape/cms/servlet/request/CertReqParser.java
index 11716115f..fd4589437 100644
--- a/base/common/src/com/netscape/cms/servlet/request/CertReqParser.java
+++ b/base/common/src/com/netscape/cms/servlet/request/CertReqParser.java
@@ -225,7 +225,7 @@ public class CertReqParser extends ReqParser {
IRequest.SERVER_ATTRS + LB + String.valueOf(saCounter++) + RB;
if (name.equalsIgnoreCase(IRequest.ISSUED_CERTS) && mDetails &&
- (req.getRequestStatus().toString().equals(RequestStatus.COMPLETE_STRING) ||
+ (req.getRequestStatus() == RequestStatus.COMPLETE ||
req.getRequestType().equals(IRequest.GETREVOCATIONINFO_REQUEST))) {
X509CertImpl issuedCert[] =
req.getExtDataInCertArray(IRequest.ISSUED_CERTS);
@@ -468,7 +468,7 @@ public class CertReqParser extends ReqParser {
}
if (name.equalsIgnoreCase(IRequest.ISSUED_CERTS) && mDetails &&
- (req.getRequestStatus().toString().equals(RequestStatus.COMPLETE_STRING) ||
+ (req.getRequestStatus() == RequestStatus.COMPLETE ||
req.getRequestType().equals(IRequest.GETREVOCATIONINFO_REQUEST))) {
X509CertImpl issuedCert[] =
req.getExtDataInCertArray(IRequest.ISSUED_CERTS);