summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cmscore/notification/ReqCertEmailResolver.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/notification/ReqCertEmailResolver.java')
-rw-r--r--pki/base/common/src/com/netscape/cmscore/notification/ReqCertEmailResolver.java80
1 files changed, 39 insertions, 41 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/notification/ReqCertEmailResolver.java b/pki/base/common/src/com/netscape/cmscore/notification/ReqCertEmailResolver.java
index 04dd9b5f..e0d7cf60 100644
--- a/pki/base/common/src/com/netscape/cmscore/notification/ReqCertEmailResolver.java
+++ b/pki/base/common/src/com/netscape/cmscore/notification/ReqCertEmailResolver.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.notification;
-
import java.io.IOException;
import java.security.cert.X509Certificate;
@@ -31,11 +30,11 @@ import com.netscape.certsrv.notification.IEmailResolver;
import com.netscape.certsrv.notification.IEmailResolverKeys;
import com.netscape.certsrv.request.IRequest;
-
/**
- * An email resolver that first checks the request email, if none,
- * then follows by checking the subjectDN of the certificate
+ * An email resolver that first checks the request email, if none, then follows
+ * by checking the subjectDN of the certificate
* <p>
+ *
* @author cfu
* @version $Revision$, $Date$
*/
@@ -44,19 +43,21 @@ public class ReqCertEmailResolver implements IEmailResolver {
public static final String KEY_REQUEST = "request";
public static final String KEY_CERT = "cert";
+
// required keys for this resolver to figure out the email address
- // protected static String[] mRequiredKeys = {KEY_REQUEST, KEY_CERT};
+ // protected static String[] mRequiredKeys = {KEY_REQUEST, KEY_CERT};
public ReqCertEmailResolver() {
}
/**
- * returns an email address by using the resolver keys. The
- * return value can possibly be null
+ * returns an email address by using the resolver keys. The return value can
+ * possibly be null
+ *
* @param keys list of keys used for resolving the email address
*/
- public String getEmail(IEmailResolverKeys keys)
- throws EBaseException, ENotificationException {
+ public String getEmail(IEmailResolverKeys keys) throws EBaseException,
+ ENotificationException {
IRequest req = (IRequest) keys.get(KEY_REQUEST);
String mEmail = null;
@@ -82,15 +83,14 @@ public class ReqCertEmailResolver implements IEmailResolver {
X500Name subjectDN = null;
if (cert != null) {
- subjectDN =
- (X500Name) cert.getSubjectDN();
-
+ subjectDN = (X500Name) cert.getSubjectDN();
+
try {
mEmail = subjectDN.getEmail();
} catch (IOException e) {
System.out.println("X500Name getEmail failed");
- throw new ENotificationException (
- CMS.getUserMessage("CMS_NOTIFICATION_EMAIL_RESOLVE_FAILED",
+ throw new ENotificationException(CMS.getUserMessage(
+ "CMS_NOTIFICATION_EMAIL_RESOLVE_FAILED",
subjectDN.toString()));
}
} else {
@@ -101,30 +101,27 @@ public class ReqCertEmailResolver implements IEmailResolver {
if (mEmail == null) {
if (cert != null) {
log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_NOTIFY_NO_EMAIL", subjectDN.toString()));
- CMS.debug(
- "no email resolved, throwing NotificationResources.EMAIL_RESOLVE_FAILED_1 for " +
- subjectDN.toString());
- throw new ENotificationException (
- CMS.getUserMessage("CMS_NOTIFICATION_EMAIL_RESOLVE_FAILED",
- "subjectDN= " + subjectDN.toString()));
+ CMS.getLogMessage("CMSCORE_NOTIFY_NO_EMAIL",
+ subjectDN.toString()));
+ CMS.debug("no email resolved, throwing NotificationResources.EMAIL_RESOLVE_FAILED_1 for "
+ + subjectDN.toString());
+ throw new ENotificationException(CMS.getUserMessage(
+ "CMS_NOTIFICATION_EMAIL_RESOLVE_FAILED", "subjectDN= "
+ + subjectDN.toString()));
} else if (req != null) {
- log(ILogger.LL_FAILURE,
- "no email resolved for request id =" +
- req.getRequestId().toString());
- CMS.debug(
- "no email resolved, throwing NotificationResources.EMAIL_RESOLVE_FAILED_1 for request id =" +
- req.getRequestId().toString());
- throw new ENotificationException (
- CMS.getUserMessage("CMS_NOTIFICATION_EMAIL_RESOLVE_FAILED",
- "requestId= " + req.getRequestId().toString()));
+ log(ILogger.LL_FAILURE, "no email resolved for request id ="
+ + req.getRequestId().toString());
+ CMS.debug("no email resolved, throwing NotificationResources.EMAIL_RESOLVE_FAILED_1 for request id ="
+ + req.getRequestId().toString());
+ throw new ENotificationException(CMS.getUserMessage(
+ "CMS_NOTIFICATION_EMAIL_RESOLVE_FAILED", "requestId= "
+ + req.getRequestId().toString()));
} else {
log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_NOTIFY_NO_EMAIL_REQUEST"));
- CMS.debug(
- "no email resolved, throwing NotificationResources.EMAIL_RESOLVE_FAILED_1. No request id or cert info found");
- throw new ENotificationException (
- CMS.getUserMessage("CMS_NOTIFICATION_EMAIL_RESOLVE_FAILED",
+ CMS.getLogMessage("CMSCORE_NOTIFY_NO_EMAIL_REQUEST"));
+ CMS.debug("no email resolved, throwing NotificationResources.EMAIL_RESOLVE_FAILED_1. No request id or cert info found");
+ throw new ENotificationException(CMS.getUserMessage(
+ "CMS_NOTIFICATION_EMAIL_RESOLVE_FAILED",
": No request id or cert info found"));
}
} else {
@@ -136,18 +133,19 @@ public class ReqCertEmailResolver implements IEmailResolver {
/**
* Returns array of required keys for this email resolver
+ *
* @return Array of required keys.
*/
-
- /* public String[] getRequiredKeys() {
- return mRequiredKeys;
- }*/
+
+ /*
+ * public String[] getRequiredKeys() { return mRequiredKeys; }
+ */
private void log(int level, String msg) {
if (mLogger == null)
return;
- mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_OTHER,
- level, "ReqCertEmailResolver: " + msg);
+ mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_OTHER, level,
+ "ReqCertEmailResolver: " + msg);
}
}