From 84e512223229b2d54e1a04b7899f888732c8fdba Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Thu, 12 Jan 2012 23:25:43 -0600 Subject: Added generics (part 2). This patch brings down the warnings from 4648 to 3992. Ticket #2 --- .../netscape/cms/servlet/admin/AdminServlet.java | 32 +++---- .../cms/servlet/admin/AuthCredentials.java | 10 +-- .../netscape/cms/servlet/admin/CAAdminServlet.java | 97 ++++++++++++---------- .../cms/servlet/admin/JobsAdminServlet.java | 22 +++-- .../cms/servlet/admin/KRAAdminServlet.java | 5 +- .../cms/servlet/admin/OCSPAdminServlet.java | 12 +-- .../cms/servlet/admin/PolicyAdminServlet.java | 44 +++++----- .../cms/servlet/base/DynamicVariablesServlet.java | 14 ++-- .../com/netscape/cms/servlet/base/GetStats.java | 4 +- .../cms/servlet/cert/CMCRevReqServlet.java | 2 +- .../servlet/cert/ChallengeRevocationServlet1.java | 2 +- .../com/netscape/cms/servlet/cert/DisplayCRL.java | 4 +- .../com/netscape/cms/servlet/cert/DoUnrevoke.java | 5 +- .../netscape/cms/servlet/cert/DoUnrevokeTPS.java | 5 +- .../netscape/cms/servlet/cert/EnrollServlet.java | 2 +- .../netscape/cms/servlet/cert/GetEnableStatus.java | 4 +- .../src/com/netscape/cms/servlet/cert/GetInfo.java | 4 +- .../cms/servlet/cert/HashEnrollServlet.java | 2 +- .../com/netscape/cms/servlet/cert/ListCerts.java | 2 +- .../src/com/netscape/cms/servlet/cert/Monitor.java | 2 +- .../com/netscape/cms/servlet/cert/UpdateDir.java | 14 ++-- .../cms/servlet/common/AuthCredentials.java | 10 +-- .../netscape/cms/servlet/common/CMSFileLoader.java | 6 +- .../netscape/cms/servlet/common/CMSGateway.java | 4 +- .../netscape/cms/servlet/common/CMSRequest.java | 6 +- .../cms/servlet/common/GenErrorTemplateFiller.java | 6 +- .../servlet/common/GenRejectedTemplateFiller.java | 6 +- .../netscape/cms/servlet/csadmin/BaseServlet.java | 4 +- .../cms/servlet/csadmin/CertRequestPanel.java | 6 +- .../cms/servlet/csadmin/ConfigBaseServlet.java | 5 +- .../cms/servlet/csadmin/ConfigHSMServlet.java | 28 ++++--- .../cms/servlet/csadmin/DatabasePanel.java | 15 ++-- .../cms/servlet/csadmin/GetConfigEntries.java | 2 +- .../netscape/cms/servlet/csadmin/GetDomainXML.java | 5 +- .../netscape/cms/servlet/csadmin/ModulePanel.java | 34 ++++---- .../netscape/cms/servlet/csadmin/NamePanel.java | 20 ++--- .../cms/servlet/csadmin/WizardPanelBase.java | 12 +-- .../cms/servlet/key/GetApprovalStatus.java | 8 +- .../cms/servlet/profile/ProfileApproveServlet.java | 15 ++-- .../cms/servlet/profile/ProfileListServlet.java | 2 +- .../cms/servlet/profile/ProfileProcessServlet.java | 15 ++-- .../cms/servlet/profile/ProfileReviewServlet.java | 26 +++--- .../cms/servlet/profile/ProfileSelectServlet.java | 28 +++---- .../cms/servlet/profile/ProfileServlet.java | 12 +-- .../servlet/profile/ProfileSubmitCMCServlet.java | 37 +++++---- 45 files changed, 312 insertions(+), 288 deletions(-) (limited to 'pki/base/common/src/com/netscape/cms/servlet') diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java index 72838eb55..fe176b641 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java @@ -206,9 +206,10 @@ public class AdminServlet extends HttpServlet { public void outputHttpParameters(HttpServletRequest httpReq) { CMS.debug("AdminServlet:service() uri = " + httpReq.getRequestURI()); - Enumeration paramNames = httpReq.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration paramNames = httpReq.getParameterNames(); while (paramNames.hasMoreElements()) { - String pn = (String) paramNames.nextElement(); + String pn = paramNames.nextElement(); // added this facility so that password can be hidden, // all sensitive parameters should be prefixed with // __ (double underscores); however, in the event that @@ -793,11 +794,11 @@ public class AdminServlet extends HttpServlet { StringBuffer buf = new StringBuffer(); if (params != null) { - Enumeration e = params.getNames(); + Enumeration e = params.getNames(); if (e.hasMoreElements()) { while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); String value = java.net.URLEncoder.encode((String) params.getValue(name)); @@ -857,10 +858,11 @@ public class AdminServlet extends HttpServlet { HttpServletResponse resp) throws ServletException, IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); //if (name.equals(Constants.PT_OP)) // continue; @@ -888,10 +890,11 @@ public class AdminServlet extends HttpServlet { HttpServletResponse resp) throws ServletException, IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); //if (name.equals(Constants.PT_OP)) // continue; @@ -916,11 +919,11 @@ public class AdminServlet extends HttpServlet { IConfigStore config, HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration e = config.getPropertyNames(); + Enumeration e = config.getPropertyNames(); NameValuePairs params = new NameValuePairs(); while (e.hasMoreElements()) { - String s = (String) e.nextElement(); + String s = e.nextElement(); params.add(s, config.getString(s)); } @@ -1132,10 +1135,11 @@ public class AdminServlet extends HttpServlet { } // identify any remaining request parameters - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); // skip previously extracted parameters if (name.equals(Constants.OP_SCOPE)) { @@ -1231,7 +1235,7 @@ public class AdminServlet extends HttpServlet { return ILogger.SIGNED_AUDIT_EMPTY_VALUE; } - Enumeration groups = null; + Enumeration groups = null; try { groups = mUG.findGroups("*"); @@ -1242,7 +1246,7 @@ public class AdminServlet extends HttpServlet { StringBuffer membersString = new StringBuffer(); while (groups.hasMoreElements()) { - IGroup group = (IGroup) groups.nextElement(); + IGroup group = groups.nextElement(); if (group.isMember(SubjectID) == true) { if (membersString.length() != 0) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/AuthCredentials.java b/pki/base/common/src/com/netscape/cms/servlet/admin/AuthCredentials.java index d0bbfa824..9d4c4f00e 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/AuthCredentials.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/AuthCredentials.java @@ -35,14 +35,14 @@ public class AuthCredentials implements IAuthCredentials { * */ private static final long serialVersionUID = -6938644716486895814L; - private Hashtable authCreds = null; + private Hashtable authCreds = null; // Inserted by bskim private IArgBlock argblk = null; // Insert end public AuthCredentials() { - authCreds = new Hashtable(); + authCreds = new Hashtable(); } /** @@ -68,7 +68,7 @@ public class AuthCredentials implements IAuthCredentials { * @return the named authentication credential */ public Object get(String name) { - return ((Object) authCreds.get(name)); + return authCreds.get(name); } /** @@ -90,8 +90,8 @@ public class AuthCredentials implements IAuthCredentials { * @return an enumeration of the values in this credential set * @see java.util.Enumeration */ - public Enumeration getElements() { - return (authCreds.elements()); + public Enumeration getElements() { + return authCreds.elements(); } // Inserted by bskim diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java index fa3933ed6..2c6ba3dbc 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java @@ -230,10 +230,11 @@ public class CAAdminServlet extends AdminServlet { IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); if (name.equals(Constants.OP_TYPE)) continue; @@ -290,10 +291,11 @@ public class CAAdminServlet extends AdminServlet { IConfigStore riq = nc.getSubStore(ICertificateAuthority.PROP_REQ_IN_Q_SUBSTORE); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); if (name.equals(Constants.OP_TYPE)) continue; @@ -324,10 +326,11 @@ public class CAAdminServlet extends AdminServlet { IConfigStore riq = nc.getSubStore(ICertificateAuthority.PROP_REQ_IN_Q_SUBSTORE); //set rest of the parameters - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); if (name.equals(Constants.OP_TYPE)) continue; @@ -379,10 +382,11 @@ public class CAAdminServlet extends AdminServlet { IOException, EBaseException { //set rest of the parameters - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); if (name.equals(Constants.OP_TYPE)) continue; @@ -456,10 +460,10 @@ public class CAAdminServlet extends AdminServlet { throws ServletException, IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration ips = mCA.getCRLIssuingPoints(); + Enumeration ips = mCA.getCRLIssuingPoints(); while (ips.hasMoreElements()) { - ICRLIssuingPoint ip = (ICRLIssuingPoint) ips.nextElement(); + ICRLIssuingPoint ip = ips.nextElement(); if (ip != null) { String ipId = ip.getId(); @@ -486,11 +490,12 @@ public class CAAdminServlet extends AdminServlet { if (ip != null) { - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); String value = ""; while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); if (name.equals(Constants.PR_ENABLED)) { if (ip.isCRLIssuingPointEnabled()) { @@ -586,10 +591,10 @@ public class CAAdminServlet extends AdminServlet { IConfigStore crlSubStore = mCA.getConfigStore().getSubStore(ICertificateAuthority.PROP_CRL_SUBSTORE); - Enumeration crlNames = crlSubStore.getSubStoreNames(); + Enumeration crlNames = crlSubStore.getSubStoreNames(); while (crlNames.hasMoreElements()) { - String name = (String) crlNames.nextElement(); + String name = crlNames.nextElement(); if (ipId.equals(name)) { // store a message in the signed audit log file @@ -743,10 +748,10 @@ public class CAAdminServlet extends AdminServlet { IConfigStore crlSubStore = mCA.getConfigStore().getSubStore(ICertificateAuthority.PROP_CRL_SUBSTORE); boolean done = false; - Enumeration crlNames = crlSubStore.getSubStoreNames(); + Enumeration crlNames = crlSubStore.getSubStoreNames(); while (crlNames.hasMoreElements()) { - String name = (String) crlNames.nextElement(); + String name = crlNames.nextElement(); if (ipId.equals(name)) { ICRLIssuingPoint ip = mCA.getCRLIssuingPoint(ipId); @@ -862,10 +867,10 @@ public class CAAdminServlet extends AdminServlet { IConfigStore crlSubStore = mCA.getConfigStore().getSubStore(ICertificateAuthority.PROP_CRL_SUBSTORE); boolean done = false; - Enumeration crlNames = crlSubStore.getSubStoreNames(); + Enumeration crlNames = crlSubStore.getSubStoreNames(); while (crlNames.hasMoreElements()) { - String name = (String) crlNames.nextElement(); + String name = crlNames.nextElement(); if (id.equals(name)) { mCA.deleteCRLIssuingPoint(crlSubStore, id); @@ -944,10 +949,11 @@ public class CAAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); String ipId = null; - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); if (name.equals(Constants.OP_TYPE)) continue; @@ -1019,10 +1025,11 @@ public class CAAdminServlet extends AdminServlet { if (id != null) { IConfigStore crlExtSubStore = crlExtsSubStore.getSubStore(id); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); if (name.equals(Constants.OP_TYPE)) continue; @@ -1110,16 +1117,16 @@ public class CAAdminServlet extends AdminServlet { IConfigStore crlExtsSubStore = crlSubStore.getSubStore(ICertificateAuthority.PROP_CRLEXT_SUBSTORE); if (crlExtsSubStore != null) { - Enumeration enumExts = crlExtsSubStore.getSubStoreNames(); + Enumeration enumExts = crlExtsSubStore.getSubStoreNames(); while (enumExts.hasMoreElements()) { - String extName = (String) enumExts.nextElement(); + String extName = enumExts.nextElement(); boolean crlExtEnabled = false; IConfigStore crlExtSubStore = crlExtsSubStore.getSubStore(extName); - Enumeration properties = crlExtSubStore.getPropertyNames(); + Enumeration properties = crlExtSubStore.getPropertyNames(); while (properties.hasMoreElements()) { - String name = (String) properties.nextElement(); + String name = properties.nextElement(); if (name.equals(Constants.PR_ENABLE)) { crlExtEnabled = crlExtSubStore.getBoolean(name, false); @@ -1158,9 +1165,9 @@ public class CAAdminServlet extends AdminServlet { String ipId = null; String name = null; - Enumeration ips = mCA.getCRLIssuingPoints(); + Enumeration ips = mCA.getCRLIssuingPoints(); if (ips.hasMoreElements()) { - ICRLIssuingPoint ip = (ICRLIssuingPoint) ips.nextElement(); + ICRLIssuingPoint ip = ips.nextElement(); if (ip != null) { ipId = ip.getId(); } @@ -1229,10 +1236,11 @@ public class CAAdminServlet extends AdminServlet { IConfigStore crlSubStore = crlsSubStore.getSubStore(id); //set reset of the parameters - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); if (name.equals(Constants.OP_TYPE)) continue; @@ -1319,10 +1327,11 @@ public class CAAdminServlet extends AdminServlet { mCA.getConfigStore().getSubStore(ICertificateAuthority.PROP_CRL_SUBSTORE); IConfigStore crlSubStore = crlsSubStore.getSubStore(id); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); if (name.equals(Constants.OP_TYPE)) continue; @@ -1352,12 +1361,13 @@ public class CAAdminServlet extends AdminServlet { caConnectorConfig = connectorConfig.getSubStore("CLA"); } - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration enum1 = req.getParameterNames(); NameValuePairs params = new NameValuePairs(); if (caConnectorConfig != null) { while (enum1.hasMoreElements()) { - String name = (String) enum1.nextElement(); + String name = enum1.nextElement(); if (name.equals(Constants.RS_ID)) continue; @@ -1388,11 +1398,12 @@ public class CAAdminServlet extends AdminServlet { caConnectorConfig = connectorConfig.getSubStore("CLA"); } - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration enum1 = req.getParameterNames(); if (caConnectorConfig != null) { while (enum1.hasMoreElements()) { - String name = (String) enum1.nextElement(); + String name = enum1.nextElement(); if (name.equals(Constants.OP_TYPE)) continue; @@ -1423,10 +1434,11 @@ public class CAAdminServlet extends AdminServlet { } private boolean isKRAConnector(HttpServletRequest req) { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration enum1 = req.getParameterNames(); while (enum1.hasMoreElements()) { - String key = (String) enum1.nextElement(); + String key = enum1.nextElement(); if (key.equals("RS_ID")) { String val = req.getParameter(key); @@ -1441,10 +1453,11 @@ public class CAAdminServlet extends AdminServlet { } private boolean isCLAConnector(HttpServletRequest req) { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration enum1 = req.getParameterNames(); while (enum1.hasMoreElements()) { - String key = (String) enum1.nextElement(); + String key = enum1.nextElement(); if (key.equals("RS_ID")) { String val = req.getParameter(key); @@ -1532,12 +1545,12 @@ public class CAAdminServlet extends AdminServlet { IConfigStore caConfig = mCA.getConfigStore(); - Enumeration enum1 = req.getParameterNames(); + Enumeration enum1 = req.getParameterNames(); boolean restart = false; //mCA.setMaxSerial(""); while (enum1.hasMoreElements()) { - String key = (String) enum1.nextElement(); + String key = enum1.nextElement(); String value = req.getParameter(key); if (key.equals(Constants.PR_EE_ENABLED)) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java index 7ebb64af1..b93e6eb0b 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java @@ -520,12 +520,11 @@ public class JobsAdminServlet extends AdminServlet { IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration e = mJobsSched.getPlugins().keys(); + Enumeration e = mJobsSched.getPlugins().keys(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); - JobPlugin value = (JobPlugin) - mJobsSched.getPlugins().get(name); + String name = e.nextElement(); + JobPlugin value = mJobsSched.getPlugins().get(name); params.add(name, value.getClassPath()); // params.add(name, value.getClassPath()+EDIT); @@ -540,10 +539,9 @@ public class JobsAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - for (Enumeration e = mJobsSched.getInstances().keys(); e.hasMoreElements();) { - String name = (String) e.nextElement(); - IJob value = (IJob) - mJobsSched.getInstances().get((Object) name); + for (Enumeration e = mJobsSched.getInstances().keys(); e.hasMoreElements();) { + String name = e.nextElement(); + IJob value = mJobsSched.getInstances().get((Object) name); // params.add(name, value.getImplName()); params.add(name, value.getImplName() + VISIBLE + @@ -581,8 +579,8 @@ public class JobsAdminServlet extends AdminServlet { // first check if any instances from this job plugin // DON'T remove job plugin if any instance - for (Enumeration e = mJobsSched.getInstances().elements(); e.hasMoreElements();) { - IJob jobs = (IJob) e.nextElement(); + for (Enumeration e = mJobsSched.getInstances().elements(); e.hasMoreElements();) { + IJob jobs = e.nextElement(); if ((jobs.getImplName()).equals(id)) { sendResponse(ERROR, @@ -1001,10 +999,10 @@ public class JobsAdminServlet extends AdminServlet { store.removeSubStore(id); IConfigStore rstore = store.makeSubStore(id); - Enumeration keys = saveParams.getNames(); + Enumeration keys = saveParams.getNames(); while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); + String key = keys.nextElement(); String value = saveParams.getValue(key); if (!value.equals("")) diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java index 1dd346667..0d3648c98 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java @@ -188,14 +188,15 @@ public class KRAAdminServlet extends AdminServlet { private void setGeneralConfig(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration enum1 = req.getParameterNames(); boolean restart = false; String auditMessage = null; String auditSubjectID = auditSubjectID(); while (enum1.hasMoreElements()) { - String key = (String) enum1.nextElement(); + String key = enum1.nextElement(); String value = req.getParameter(key); if (key.equals(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS)) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/OCSPAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/OCSPAdminServlet.java index 338a58239..317a50d68 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/OCSPAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/OCSPAdminServlet.java @@ -344,10 +344,11 @@ public class OCSPAdminServlet extends AdminServlet { IOCSPStore store = mOCSP.getOCSPStore(id); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); if (name.equals(Constants.OP_TYPE)) continue; @@ -422,10 +423,10 @@ public class OCSPAdminServlet extends AdminServlet { IConfigStore config = mOCSP.getConfigStore(); String defStore = config.getString(IOCSPAuthority.PROP_DEF_STORE_ID); IConfigStore SubStore = config.getSubStore(IOCSPAuthority.PROP_STORE); - Enumeration enumStores = SubStore.getSubStoreNames(); + Enumeration enumStores = SubStore.getSubStoreNames(); while (enumStores.hasMoreElements()) { - String storeName = (String) enumStores.nextElement(); + String storeName = enumStores.nextElement(); boolean storeEnabled = false; if (storeName.equals(defStore)) { @@ -488,7 +489,8 @@ public class OCSPAdminServlet extends AdminServlet { // ensure that any low-level exceptions are reported // to the signed audit log and stored as failures try { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration enum1 = req.getParameterNames(); boolean restart = false; while (enum1.hasMoreElements()) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java index f34a82770..4dbde7e06 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java @@ -428,8 +428,8 @@ public class PolicyAdminServlet extends AdminServlet { public void listPolicyImpls(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - Enumeration policyImplNames = mProcessor.getPolicyImplsInfo(); - Enumeration policyImpls = mProcessor.getPolicyImpls(); + Enumeration policyImplNames = mProcessor.getPolicyImplsInfo(); + Enumeration policyImpls = mProcessor.getPolicyImpls(); if (policyImplNames == null || policyImpls == null) { @@ -442,9 +442,8 @@ public class PolicyAdminServlet extends AdminServlet { while (policyImplNames.hasMoreElements() && policyImpls.hasMoreElements()) { - String id = (String) policyImplNames.nextElement(); - IPolicyRule impl = (IPolicyRule) - policyImpls.nextElement(); + String id = policyImplNames.nextElement(); + IPolicyRule impl = policyImpls.nextElement(); String className = impl.getClass().getName(); String desc = impl.getDescription(); @@ -457,7 +456,7 @@ public class PolicyAdminServlet extends AdminServlet { public void listPolicyInstances(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - Enumeration instancesInfo = mProcessor.getPolicyInstancesInfo(); + Enumeration instancesInfo = mProcessor.getPolicyInstancesInfo(); if (instancesInfo == null) { sendResponse(ERROR, INVALID_POLICY_INSTANCE_CONFIG, null, resp); @@ -469,7 +468,7 @@ public class PolicyAdminServlet extends AdminServlet { String instName, rest; while (instancesInfo.hasMoreElements()) { - String info = (String) instancesInfo.nextElement(); + String info = instancesInfo.nextElement(); int i = info.indexOf(";"); nvp.add(info.substring(0, i), info.substring(i + 1)); @@ -583,7 +582,7 @@ public class PolicyAdminServlet extends AdminServlet { return; } - Vector v = mProcessor.getPolicyImplConfig(id); + Vector v = mProcessor.getPolicyImplConfig(id); if (v == null) { sendResponse(ERROR, INVALID_POLICY_IMPL_ID, null, resp); @@ -591,8 +590,8 @@ public class PolicyAdminServlet extends AdminServlet { } NameValuePairs nvp = new NameValuePairs(); - for (Enumeration e = v.elements(); e.hasMoreElements();) { - String nv = (String) e.nextElement(); + for (Enumeration e = v.elements(); e.hasMoreElements();) { + String nv = e.nextElement(); int index = nv.indexOf("="); nvp.add(nv.substring(0, index), nv.substring(index + 1)); @@ -812,7 +811,7 @@ public class PolicyAdminServlet extends AdminServlet { return; } - Vector v = mProcessor.getPolicyInstanceConfig(id); + Vector v = mProcessor.getPolicyInstanceConfig(id); if (v == null) { sendResponse(ERROR, INVALID_POLICY_INST_ID, null, resp); @@ -820,8 +819,8 @@ public class PolicyAdminServlet extends AdminServlet { } NameValuePairs nvp = new NameValuePairs(); - for (Enumeration e = v.elements(); e.hasMoreElements();) { - String nv = (String) e.nextElement(); + for (Enumeration e = v.elements(); e.hasMoreElements();) { + String nv = e.nextElement(); int index = nv.indexOf("="); String name = nv.substring(0, index); String value = nv.substring(index + 1); @@ -907,7 +906,7 @@ public class PolicyAdminServlet extends AdminServlet { // We need to fetch parameters: enable, predicate and implname // always, and any additional parameters as required by the // implementation. - Hashtable ht = new Hashtable(); + Hashtable ht = new Hashtable(); String val = req.getParameter(IPolicyRule.PROP_ENABLE).trim(); if (val == null) @@ -919,7 +918,7 @@ public class PolicyAdminServlet extends AdminServlet { ht.put(IPolicyRule.PROP_PREDICATE, val); ht.put(IPolicyRule.PROP_IMPLNAME, implName); - Vector v = mProcessor.getPolicyImplConfig(implName); + Vector v = mProcessor.getPolicyImplConfig(implName); if (v == null) { // Invalid impl id @@ -936,8 +935,8 @@ public class PolicyAdminServlet extends AdminServlet { sendResponse(ERROR, INVALID_POLICY_IMPL_ID, null, resp); return; } - for (Enumeration e = v.elements(); e.hasMoreElements();) { - String nv = (String) e.nextElement(); + for (Enumeration e = v.elements(); e.hasMoreElements();) { + String nv = e.nextElement(); int index = nv.indexOf("="); String key = nv.substring(0, index); @@ -1155,7 +1154,7 @@ public class PolicyAdminServlet extends AdminServlet { // We need to fetch parameters: enable, predicate and implname // always, and any additional parameters as required by the // implementation. - Hashtable ht = new Hashtable(); + Hashtable ht = new Hashtable(); String val = req.getParameter(IPolicyRule.PROP_ENABLE).trim(); if (val == null) @@ -1166,7 +1165,7 @@ public class PolicyAdminServlet extends AdminServlet { if (val != null) ht.put(IPolicyRule.PROP_PREDICATE, val); ht.put(IPolicyRule.PROP_IMPLNAME, implName); - Vector v = mProcessor.getPolicyImplConfig(implName); + Vector v = mProcessor.getPolicyImplConfig(implName); if (v == null) { // Invalid impl id @@ -1184,9 +1183,10 @@ public class PolicyAdminServlet extends AdminServlet { return; } // XXX - for (Enumeration n = req.getParameterNames(); n.hasMoreElements();) { - String p = (String) n.nextElement(); - String l = (String) req.getParameter(p); + for (@SuppressWarnings("unchecked") + Enumeration n = req.getParameterNames(); n.hasMoreElements();) { + String p = n.nextElement(); + String l = req.getParameter(p); if (l != null) ht.put(p, l); diff --git a/pki/base/common/src/com/netscape/cms/servlet/base/DynamicVariablesServlet.java b/pki/base/common/src/com/netscape/cms/servlet/base/DynamicVariablesServlet.java index 2308318ee..b0a97e9b5 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/base/DynamicVariablesServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/base/DynamicVariablesServlet.java @@ -86,7 +86,7 @@ public class DynamicVariablesServlet extends CMSServlet { private long mAuthMgrCacheTime = 0; private final int AUTHMGRCACHE = 10; //number of seconds to cache list of // authmanagers for - private Hashtable dynvars = null; + private Hashtable dynvars = null; private String mGetClientCert = "false"; private String mAuthMgr = null; @@ -156,7 +156,7 @@ public class DynamicVariablesServlet extends CMSServlet { String dynvarconfig = sc.getInitParameter(PROP_DYNVAR); StringTokenizer s = new StringTokenizer(dynvarconfig, ","); - dynvars = new Hashtable(); + dynvars = new Hashtable(); while (s.hasMoreTokens()) { String token = s.nextToken(); @@ -181,7 +181,7 @@ public class DynamicVariablesServlet extends CMSServlet { throw new ServletException("bad configuration parameter in " + PROP_DYNVAR); } if (varcode != null) { - dynvars.put(varcode, (Object) varname); + dynvars.put(varcode, varname); } } } catch (Exception e) { @@ -216,11 +216,11 @@ public class DynamicVariablesServlet extends CMSServlet { if (os != null) { if (dynvars != null) { - Enumeration k = dynvars.keys(); + Enumeration k = dynvars.keys(); while (k.hasMoreElements()) { String toBeWritten; - Integer varcode = (Integer) k.nextElement(); + Integer varcode = k.nextElement(); if (varcode.equals(VAR_SERVERDATE)) { toBeWritten = dynvars.get(varcode) + @@ -264,7 +264,7 @@ public class DynamicVariablesServlet extends CMSServlet { if (varcode.equals(VAR_AUTHMGRS)) { toBeWritten = ""; IAuthSubsystem as = (IAuthSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_AUTH); - Enumeration ame = as.getAuthManagers(); + Enumeration ame = as.getAuthManagers(); Date d = CMS.getCurrentDate(); long now = d.getTime(); @@ -274,7 +274,7 @@ public class DynamicVariablesServlet extends CMSServlet { StringBuffer sb = new StringBuffer(); while (ame.hasMoreElements()) { - IAuthManager am = (IAuthManager) ame.nextElement(); + IAuthManager am = ame.nextElement(); String amName = am.getImplName(); AuthMgrPlugin ap = as.getAuthManagerPluginImpl(amName); diff --git a/pki/base/common/src/com/netscape/cms/servlet/base/GetStats.java b/pki/base/common/src/com/netscape/cms/servlet/base/GetStats.java index f96cb0e1f..e145ee4db 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/base/GetStats.java +++ b/pki/base/common/src/com/netscape/cms/servlet/base/GetStats.java @@ -165,9 +165,9 @@ public class GetStats extends CMSServlet { } public void parse(CMSTemplateParams argSet, StatsEvent st, int level) { - Enumeration names = st.getSubEventNames(); + Enumeration names = st.getSubEventNames(); while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); StatsEvent subSt = st.getSubEvent(name); IArgBlock rarg = CMS.createArgBlock(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java b/pki/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java index 461fa0b94..5fd3cd902 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java @@ -410,7 +410,7 @@ public class CMCRevReqServlet extends CMSServlet { Enumeration e = list.getCertRecords(0, totalRecordCount - 1); while (e != null && e.hasMoreElements()) { - ICertRecord rec = (ICertRecord) e.nextElement(); + ICertRecord rec = e.nextElement(); X509CertImpl cert = rec.getCertificate(); IArgBlock rarg = CMS.createArgBlock(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/ChallengeRevocationServlet1.java b/pki/base/common/src/com/netscape/cms/servlet/cert/ChallengeRevocationServlet1.java index 8ca35484b..a2b501f14 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/ChallengeRevocationServlet1.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/ChallengeRevocationServlet1.java @@ -339,7 +339,7 @@ public class ChallengeRevocationServlet1 extends CMSServlet { Enumeration e = list.getCertRecords(0, totalRecordCount - 1); while (e != null && e.hasMoreElements()) { - ICertRecord rec = (ICertRecord) e.nextElement(); + ICertRecord rec = e.nextElement(); X509CertImpl cert = rec.getCertificate(); IArgBlock rarg = CMS.createArgBlock(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayCRL.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayCRL.java index 3e4a064ba..bdaa0df29 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayCRL.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayCRL.java @@ -216,10 +216,10 @@ public class DisplayCRL extends CMSServlet { } } else { if (crlIssuingPointId != null) { - Enumeration ips = mCA.getCRLIssuingPoints(); + Enumeration ips = mCA.getCRLIssuingPoints(); while (ips.hasMoreElements()) { - ICRLIssuingPoint ip = (ICRLIssuingPoint) ips.nextElement(); + ICRLIssuingPoint ip = ips.nextElement(); if (crlIssuingPointId.equals(ip.getId())) { crlIP = ip; diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java index edf04b1ba..c5fb568f2 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java @@ -410,12 +410,11 @@ public class DoUnrevoke extends CMSServlet { } // let known update and publish status of all crls. - Enumeration otherCRLs = + Enumeration otherCRLs = ((ICertificateAuthority) mAuthority).getCRLIssuingPoints(); while (otherCRLs.hasMoreElements()) { - ICRLIssuingPoint crl = (ICRLIssuingPoint) - otherCRLs.nextElement(); + ICRLIssuingPoint crl = otherCRLs.nextElement(); String crlId = crl.getId(); if (crlId.equals(ICertificateAuthority.PROP_MASTER_CRL)) diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DoUnrevokeTPS.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DoUnrevokeTPS.java index edc406137..969619815 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DoUnrevokeTPS.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DoUnrevokeTPS.java @@ -372,12 +372,11 @@ public class DoUnrevokeTPS extends CMSServlet { } // let known update and publish status of all crls. - Enumeration otherCRLs = + Enumeration otherCRLs = ((ICertificateAuthority) mAuthority).getCRLIssuingPoints(); while (otherCRLs.hasMoreElements()) { - ICRLIssuingPoint crl = (ICRLIssuingPoint) - otherCRLs.nextElement(); + ICRLIssuingPoint crl = otherCRLs.nextElement(); String crlId = crl.getId(); if (crlId.equals(ICertificateAuthority.PROP_MASTER_CRL)) diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/EnrollServlet.java b/pki/base/common/src/com/netscape/cms/servlet/cert/EnrollServlet.java index 7b3fb2f74..c48cd8635 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/EnrollServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/EnrollServlet.java @@ -489,7 +489,7 @@ public class EnrollServlet extends CMSServlet { boolean encCertFound = false; while (en.hasMoreElements()) { - ICertRecord record = (ICertRecord) en.nextElement(); + ICertRecord record = en.nextElement(); X509CertImpl cert = record.getCertificate(); // if not encryption cert only, try next one diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/GetEnableStatus.java b/pki/base/common/src/com/netscape/cms/servlet/cert/GetEnableStatus.java index e589cc06c..3297c585c 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/GetEnableStatus.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/GetEnableStatus.java @@ -149,10 +149,10 @@ public class GetEnableStatus extends CMSServlet { header.addStringValue("timeout", "" + timeout); header.addStringValue("reqHost", reqHost); - for (Enumeration hosts = mgr.getHosts(); hosts.hasMoreElements();) { + for (Enumeration hosts = mgr.getHosts(); hosts.hasMoreElements();) { IArgBlock rarg = CMS.createArgBlock(); - rarg.addStringValue("hosts", (String) hosts.nextElement()); + rarg.addStringValue("hosts", hosts.nextElement()); argSet.addRepeatRecord(rarg); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/GetInfo.java b/pki/base/common/src/com/netscape/cms/servlet/cert/GetInfo.java index 7217435a1..ce3b7ee69 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/GetInfo.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/GetInfo.java @@ -265,10 +265,10 @@ public class GetInfo extends CMSServlet { } } else { - Enumeration ips = mCA.getCRLIssuingPoints(); + Enumeration ips = mCA.getCRLIssuingPoints(); while (ips.hasMoreElements()) { - ICRLIssuingPoint ip = (ICRLIssuingPoint) ips.nextElement(); + ICRLIssuingPoint ip = ips.nextElement(); if (ip.isCRLIssuingPointEnabled()) { if (crlIssuingPoints.length() > 0) diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/HashEnrollServlet.java b/pki/base/common/src/com/netscape/cms/servlet/cert/HashEnrollServlet.java index 4d5b711c0..1ff056ab7 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/HashEnrollServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/HashEnrollServlet.java @@ -506,7 +506,7 @@ public class HashEnrollServlet extends CMSServlet { int i = 1; while (en.hasMoreElements()) { - ICertRecord record = (ICertRecord) en.nextElement(); + ICertRecord record = en.nextElement(); X509CertImpl cert = record.getCertificate(); // if not encryption cert only, try next one diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/ListCerts.java b/pki/base/common/src/com/netscape/cms/servlet/cert/ListCerts.java index 8a818f5e8..b93a82fb8 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/ListCerts.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/ListCerts.java @@ -412,7 +412,7 @@ public class ListCerts extends CMSServlet { toCurIndex = list.getSize() - 1; } else { toCurIndex = tolist.getCurrentIndex(); - ICertRecord rx = (ICertRecord) en.nextElement(); + ICertRecord rx = en.nextElement(); BigInteger curToSerial = rx.getSerialNumber(); if (curToSerial.compareTo(serialToVal) == -1) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/Monitor.java b/pki/base/common/src/com/netscape/cms/servlet/cert/Monitor.java index b248d2bda..ac531caca 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/Monitor.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/Monitor.java @@ -288,7 +288,7 @@ public class Monitor extends CMSServlet { if (mCertDB != null) { filter = Filter(ICertRecord.ATTR_CREATE_TIME, startTime, endTime); - Enumeration e = mCertDB.findCertRecs(filter); + Enumeration e = mCertDB.findCertRecs(filter); int count = 0; diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateDir.java b/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateDir.java index 10330501b..dc084bd94 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateDir.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateDir.java @@ -416,7 +416,7 @@ public class UpdateDir extends CMSServlet { if (updateValue[VALID_TO].startsWith("0x")) { updateValue[VALID_TO] = hexToDecimal(updateValue[VALID_TO]); } - Enumeration validCerts = null; + Enumeration validCerts = null; if (updateValue[CHECK_FLAG] != null && updateValue[CHECK_FLAG].equalsIgnoreCase("yes")) { @@ -437,7 +437,7 @@ public class UpdateDir extends CMSServlet { if (validCerts != null) { while (validCerts.hasMoreElements()) { ICertRecord certRecord = - (ICertRecord) validCerts.nextElement(); + validCerts.nextElement(); //X509CertImpl cert = certRecord.getCertificate(); X509CertImpl cert = null; Object o = certRecord.getCertificate(); @@ -534,7 +534,7 @@ public class UpdateDir extends CMSServlet { if (updateValue[EXPIRED_TO].startsWith("0x")) { updateValue[EXPIRED_TO] = hexToDecimal(updateValue[EXPIRED_TO]); } - Enumeration expiredCerts = null; + Enumeration expiredCerts = null; if (updateValue[CHECK_FLAG] != null && updateValue[CHECK_FLAG].equalsIgnoreCase("yes")) { @@ -554,8 +554,7 @@ public class UpdateDir extends CMSServlet { if (expiredCerts != null) { while (expiredCerts.hasMoreElements()) { - ICertRecord certRecord = - (ICertRecord) expiredCerts.nextElement(); + ICertRecord certRecord = expiredCerts.nextElement(); //X509CertImpl cert = certRecord.getCertificate(); X509CertImpl cert = null; Object o = certRecord.getCertificate(); @@ -643,7 +642,7 @@ public class UpdateDir extends CMSServlet { if (updateValue[REVOKED_TO].startsWith("0x")) { updateValue[REVOKED_TO] = hexToDecimal(updateValue[REVOKED_TO]); } - Enumeration revokedCerts = null; + Enumeration revokedCerts = null; if (updateValue[CHECK_FLAG] != null && updateValue[CHECK_FLAG].equalsIgnoreCase("yes")) { @@ -663,8 +662,7 @@ public class UpdateDir extends CMSServlet { if (revokedCerts != null) { while (revokedCerts.hasMoreElements()) { - ICertRecord certRecord = - (ICertRecord) revokedCerts.nextElement(); + ICertRecord certRecord = revokedCerts.nextElement(); //X509CertImpl cert = certRecord.getCertificate(); X509CertImpl cert = null; Object o = certRecord.getCertificate(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/common/AuthCredentials.java b/pki/base/common/src/com/netscape/cms/servlet/common/AuthCredentials.java index 58c4276e3..a55406068 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/common/AuthCredentials.java +++ b/pki/base/common/src/com/netscape/cms/servlet/common/AuthCredentials.java @@ -35,14 +35,14 @@ public class AuthCredentials implements IAuthCredentials { * */ private static final long serialVersionUID = -5995164231849154265L; - private Hashtable authCreds = null; + private Hashtable authCreds = null; // Inserted by bskim private IArgBlock argblk = null; // Insert end public AuthCredentials() { - authCreds = new Hashtable(); + authCreds = new Hashtable(); } /** @@ -68,7 +68,7 @@ public class AuthCredentials implements IAuthCredentials { * @return the named authentication credential */ public Object get(String name) { - return ((Object) authCreds.get(name)); + return authCreds.get(name); } /** @@ -90,8 +90,8 @@ public class AuthCredentials implements IAuthCredentials { * @return an enumeration of the values in this credential set * @see java.util.Enumeration */ - public Enumeration getElements() { - return (authCreds.elements()); + public Enumeration getElements() { + return authCreds.elements(); } // Inserted by bskim diff --git a/pki/base/common/src/com/netscape/cms/servlet/common/CMSFileLoader.java b/pki/base/common/src/com/netscape/cms/servlet/common/CMSFileLoader.java index 9a91cb729..808bdda78 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/common/CMSFileLoader.java +++ b/pki/base/common/src/com/netscape/cms/servlet/common/CMSFileLoader.java @@ -44,7 +44,7 @@ public class CMSFileLoader { public final String PROP_CACHE_TEMPLATES_ONLY = "cacheTemplatesOnly"; // hash of files to their content. - private Hashtable mLoadedFiles = new Hashtable(); + private Hashtable mLoadedFiles = new Hashtable(); // max number of files private int mMaxSize = MAX_SIZE; @@ -141,14 +141,14 @@ public class CMSFileLoader { // remove the LRU files. // XXX could be optimized more. - Enumeration elements = mLoadedFiles.elements(); + Enumeration elements = mLoadedFiles.elements(); for (int i = mClearSize; i > 0; i--) { long lru = java.lang.Long.MAX_VALUE; CMSFile lruFile = null; while (elements.hasMoreElements()) { - CMSFile cmsFile = (CMSFile) elements.nextElement(); + CMSFile cmsFile = elements.nextElement(); if (cmsFile.getLastAccess() < lru) { lruFile = cmsFile; diff --git a/pki/base/common/src/com/netscape/cms/servlet/common/CMSGateway.java b/pki/base/common/src/com/netscape/cms/servlet/common/CMSGateway.java index 74d46badf..d04e2fb22 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/common/CMSGateway.java +++ b/pki/base/common/src/com/netscape/cms/servlet/common/CMSGateway.java @@ -79,10 +79,10 @@ public class CMSGateway { public static Hashtable toHashtable(HttpServletRequest req) { Hashtable httpReqHash = new Hashtable(); - Enumeration names = req.getParameterNames(); + Enumeration names = req.getParameterNames(); while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); httpReqHash.put(name, req.getParameter(name)); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/common/CMSRequest.java b/pki/base/common/src/com/netscape/cms/servlet/common/CMSRequest.java index 822d8a0d8..b1be4f7a5 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/common/CMSRequest.java +++ b/pki/base/common/src/com/netscape/cms/servlet/common/CMSRequest.java @@ -78,7 +78,7 @@ public class CMSRequest { private String mError = null; // any error description. - private Vector mErrorDescr = null; + private Vector mErrorDescr = null; // any request resulting data; Object mResult = null; @@ -170,7 +170,7 @@ public class CMSRequest { public void setErrorDescription(String descr) { if (mErrorDescr == null) - mErrorDescr = new Vector(); + mErrorDescr = new Vector(); mErrorDescr.addElement(descr); } @@ -215,7 +215,7 @@ public class CMSRequest { return mError; } - public Vector getErrorDescr() { + public Vector getErrorDescr() { return mErrorDescr; } diff --git a/pki/base/common/src/com/netscape/cms/servlet/common/GenErrorTemplateFiller.java b/pki/base/common/src/com/netscape/cms/servlet/common/GenErrorTemplateFiller.java index 1c7d61c9a..40edb3bda 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/common/GenErrorTemplateFiller.java +++ b/pki/base/common/src/com/netscape/cms/servlet/common/GenErrorTemplateFiller.java @@ -77,13 +77,13 @@ public class GenErrorTemplateFiller implements ICMSTemplateFiller { // Change end // error description if any. - Vector descr = cmsReq.getErrorDescr(); + Vector descr = cmsReq.getErrorDescr(); if (descr != null) { - Enumeration num = descr.elements(); + Enumeration num = descr.elements(); while (num.hasMoreElements()) { - String elem = (String) num.nextElement(); + String elem = num.nextElement(); //System.out.println("Setting description "+elem.toString()); IArgBlock argBlock = CMS.createArgBlock(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/common/GenRejectedTemplateFiller.java b/pki/base/common/src/com/netscape/cms/servlet/common/GenRejectedTemplateFiller.java index 3dde11475..9e75cc799 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/common/GenRejectedTemplateFiller.java +++ b/pki/base/common/src/com/netscape/cms/servlet/common/GenRejectedTemplateFiller.java @@ -67,13 +67,13 @@ public class GenRejectedTemplateFiller implements ICMSTemplateFiller { fixed.set(ICMSTemplateFiller.REQUEST_ID, req.getRequestId()); // policy errors (rejection reasons) - Vector messages = req.getExtDataInStringVector(IRequest.ERRORS); + Vector messages = req.getExtDataInStringVector(IRequest.ERRORS); if (messages != null) { - Enumeration msgs = messages.elements(); + Enumeration msgs = messages.elements(); while (msgs.hasMoreElements()) { - String ex = (String) msgs.nextElement(); + String ex = msgs.nextElement(); IArgBlock messageArgBlock = CMS.createArgBlock(); messageArgBlock.set(POLICY_MESSAGE, ex); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/BaseServlet.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/BaseServlet.java index 9bb81902f..f619110fd 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/BaseServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/BaseServlet.java @@ -60,10 +60,10 @@ public class BaseServlet extends VelocityServlet { public void outputHttpParameters(HttpServletRequest httpReq) { CMS.debug("BaseServlet:service() uri = " + httpReq.getRequestURI()); - Enumeration paramNames = httpReq.getParameterNames(); + Enumeration paramNames = httpReq.getParameterNames(); while (paramNames.hasMoreElements()) { - String pn = (String) paramNames.nextElement(); + String pn = paramNames.nextElement(); // added this facility so that password can be hidden, // all sensitive parameters should be prefixed with // __ (double underscores); however, in the event that diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java index c81c666e6..43c707fbe 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java @@ -54,7 +54,7 @@ import com.netscape.cms.servlet.wizard.WizardServlet; import com.netscape.cmsutil.crypto.CryptoUtil; public class CertRequestPanel extends WizardPanelBase { - private Vector mCerts = null; + private Vector mCerts = null; private WizardServlet mServlet = null; public CertRequestPanel() { @@ -386,7 +386,7 @@ public class CertRequestPanel extends WizardPanelBase { context.put("title", "Requests and Certificates"); try { - mCerts = new Vector(); + mCerts = new Vector(); IConfigStore config = CMS.getConfigStore(); @@ -499,7 +499,7 @@ public class CertRequestPanel extends WizardPanelBase { } try { - Enumeration c = mCerts.elements(); + Enumeration c = mCerts.elements(); String tokenname = ""; try { diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/ConfigBaseServlet.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/ConfigBaseServlet.java index 5ae9bada8..dbda788f6 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/ConfigBaseServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/ConfigBaseServlet.java @@ -57,10 +57,11 @@ public abstract class ConfigBaseServlet extends BaseServlet { public void outputHttpParameters(HttpServletRequest httpReq) { CMS.debug("ConfigBaseServlet:service() uri = " + httpReq.getRequestURI()); - Enumeration paramNames = httpReq.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration paramNames = httpReq.getParameterNames(); while (paramNames.hasMoreElements()) { - String pn = (String) paramNames.nextElement(); + String pn = paramNames.nextElement(); // added this facility so that password can be hidden, // all sensitive parameters should be prefixed with // __ (double underscores); however, in the event that diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/ConfigHSMServlet.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/ConfigHSMServlet.java index 9428ecce0..ba5650542 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/ConfigHSMServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/ConfigHSMServlet.java @@ -44,10 +44,10 @@ public class ConfigHSMServlet extends ConfigBaseServlet { */ private static final long serialVersionUID = -330521231753992202L; private CryptoManager mCryptoManager = null; - private Vector mSupportedModules = null; + private Vector mSupportedModules = null; private Vector mOtherModules = null; private String mDefaultTok = null; - private Hashtable mCurrModTable = new Hashtable(); + private Hashtable mCurrModTable = new Hashtable(); public void init(ServletConfig config) throws ServletException { super.init(config); @@ -57,10 +57,11 @@ public class ConfigHSMServlet extends ConfigBaseServlet { try { // getting existing modules mCryptoManager = CryptoManager.getInstance(); - Enumeration modules = mCryptoManager.getModules(); + @SuppressWarnings("unchecked") + Enumeration modules = mCryptoManager.getModules(); while (modules.hasMoreElements()) { - PK11Module mod = (PK11Module) modules.nextElement(); + PK11Module mod = modules.nextElement(); CMS.debug("ConfigHSMServlet: got module " + mod.getName()); mCurrModTable.put(mod.getName(), mod); @@ -77,16 +78,16 @@ public class ConfigHSMServlet extends ConfigBaseServlet { * Modules not listed as supported modules */ public void loadOtherModules() { - Enumeration m = mCurrModTable.elements(); + Enumeration m = mCurrModTable.elements(); mOtherModules = new Vector(); while (m.hasMoreElements()) { - PK11Module mod = (PK11Module) m.nextElement(); - Enumeration s = mSupportedModules.elements(); + PK11Module mod = m.nextElement(); + Enumeration s = mSupportedModules.elements(); boolean found = false; while (s.hasMoreElements()) { - Module sm = (Module) s.nextElement(); + Module sm = s.nextElement(); if (mod.getName().equals(sm.getCommonName())) { found = true; @@ -111,11 +112,12 @@ public class ConfigHSMServlet extends ConfigBaseServlet { * find all tokens belonging to a module and load the Module */ public void loadModTokens(Module module, PK11Module mod) { - Enumeration tokens = mod.getTokens(); + @SuppressWarnings("unchecked") + Enumeration tokens = mod.getTokens(); while (tokens.hasMoreElements()) { try { - CryptoToken token = (CryptoToken) tokens.nextElement(); + CryptoToken token = tokens.nextElement(); CMS.debug("ConfigHSMServlet: token nick name=" + token.getName()); CMS.debug( @@ -145,7 +147,7 @@ public class ConfigHSMServlet extends ConfigBaseServlet { // getting supported security modules // a Vectgor of Modules - mSupportedModules = new Vector(); + mSupportedModules = new Vector(); // read from conf store all supported modules try { int count = CMS.getConfigStore().getInteger( @@ -172,7 +174,7 @@ public class ConfigHSMServlet extends ConfigBaseServlet { CMS.debug("ConfigHSMServlet: module found: " + cn); module.setFound(true); // add token info to module vector - PK11Module m = (PK11Module) mCurrModTable.get(cn); + PK11Module m = mCurrModTable.get(cn); loadModTokens(module, m); } @@ -180,7 +182,7 @@ public class ConfigHSMServlet extends ConfigBaseServlet { CMS.debug("ConfigHSMServlet: adding module " + cn); // add module to set if (!mSupportedModules.contains(module)) { - mSupportedModules.addElement((Object) module); + mSupportedModules.addElement(module); } }// for diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java index 02a992832..6cafe9736 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java @@ -1467,9 +1467,10 @@ public class DatabasePanel extends WizardPanelBase { LDAPEntry entry = results.next(); LDAPAttribute attr = entry.getAttribute("nsds5replicalastinitstatus"); if (attr != null) { - Enumeration valsInAttr = attr.getStringValues(); + @SuppressWarnings("unchecked") + Enumeration valsInAttr = attr.getStringValues(); if (valsInAttr.hasMoreElements()) { - return (String) valsInAttr.nextElement(); + return valsInAttr.nextElement(); } else { throw new IOException("No value returned for nsds5replicalastinitstatus"); } @@ -1496,14 +1497,16 @@ public class DatabasePanel extends WizardPanelBase { String dn = entry.getDN(); CMS.debug("DatabasePanel getInstanceDir: DN for storing nsslapd-directory: " + dn); LDAPAttributeSet entryAttrs = entry.getAttributeSet(); - Enumeration attrsInSet = entryAttrs.getAttributes(); + @SuppressWarnings("unchecked") + Enumeration attrsInSet = entryAttrs.getAttributes(); while (attrsInSet.hasMoreElements()) { - LDAPAttribute nextAttr = (LDAPAttribute) attrsInSet.nextElement(); + LDAPAttribute nextAttr = attrsInSet.nextElement(); String attrName = nextAttr.getName(); CMS.debug("DatabasePanel getInstanceDir: attribute name: " + attrName); - Enumeration valsInAttr = nextAttr.getStringValues(); + @SuppressWarnings("unchecked") + Enumeration valsInAttr = nextAttr.getStringValues(); while (valsInAttr.hasMoreElements()) { - String nextValue = (String) valsInAttr.nextElement(); + String nextValue = valsInAttr.nextElement(); if (attrName.equalsIgnoreCase("nsslapd-directory")) { CMS.debug("DatabasePanel getInstanceDir: instanceDir=" + nextValue); return nextValue.substring(0, nextValue.lastIndexOf("/db")); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetConfigEntries.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetConfigEntries.java index 1ff06416e..c9a900a0b 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetConfigEntries.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetConfigEntries.java @@ -141,7 +141,7 @@ public class GetConfigEntries extends CMSServlet { while (t.hasMoreTokens()) { String name1 = t.nextToken(); IConfigStore cs = config.getSubStore(name1); - Enumeration enum1 = cs.getPropertyNames(); + Enumeration enum1 = cs.getPropertyNames(); while (enum1.hasMoreElements()) { String name = name1 + "." + enum1.nextElement(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetDomainXML.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetDomainXML.java index 04d88dba7..45c5192aa 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetDomainXML.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetDomainXML.java @@ -144,9 +144,10 @@ public class GetDomainXML extends CMSServlet { Node node = xmlObj.createContainer(listNode, subType); LDAPEntry entry = res2.next(); LDAPAttributeSet entryAttrs = entry.getAttributeSet(); - Enumeration attrsInSet = entryAttrs.getAttributes(); + @SuppressWarnings("unchecked") + Enumeration attrsInSet = entryAttrs.getAttributes(); while (attrsInSet.hasMoreElements()) { - LDAPAttribute nextAttr = (LDAPAttribute) attrsInSet.nextElement(); + LDAPAttribute nextAttr = attrsInSet.nextElement(); String attrName = nextAttr.getName(); if ((!attrName.equals("cn")) && (!attrName.equals("objectClass"))) { String attrValue = (String) nextAttr.getStringValues().nextElement(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/ModulePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/ModulePanel.java index f33b10230..00474615f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/ModulePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/ModulePanel.java @@ -45,9 +45,9 @@ import com.netscape.cmsutil.crypto.Module; public class ModulePanel extends WizardPanelBase { private CryptoManager mCryptoManager = null; - private Vector mSupportedModules = null; - private Vector mOtherModules = null; - private Hashtable mCurrModTable = new Hashtable(); + private Vector mSupportedModules = null; + private Vector mOtherModules = null; + private Hashtable mCurrModTable = new Hashtable(); private WizardServlet mServlet = null; public ModulePanel() { @@ -79,10 +79,11 @@ public class ModulePanel extends WizardPanelBase { try { // getting existing modules mCryptoManager = CryptoManager.getInstance(); - Enumeration modules = mCryptoManager.getModules(); + @SuppressWarnings("unchecked") + Enumeration modules = mCryptoManager.getModules(); while (modules.hasMoreElements()) { - PK11Module mod = (PK11Module) modules.nextElement(); + PK11Module mod = modules.nextElement(); CMS.debug("ModulePanel: got module " + mod.getName()); mCurrModTable.put(mod.getName(), mod); @@ -99,16 +100,16 @@ public class ModulePanel extends WizardPanelBase { * Modules not listed as supported modules */ public void loadOtherModules() { - Enumeration m = mCurrModTable.elements(); + Enumeration m = mCurrModTable.elements(); - mOtherModules = new Vector(); + mOtherModules = new Vector(); while (m.hasMoreElements()) { - PK11Module mod = (PK11Module) m.nextElement(); - Enumeration s = mSupportedModules.elements(); + PK11Module mod = m.nextElement(); + Enumeration s = mSupportedModules.elements(); boolean found = false; while (s.hasMoreElements()) { - Module sm = (Module) s.nextElement(); + Module sm = s.nextElement(); if (mod.getName().equals(sm.getCommonName())) { found = true; @@ -123,7 +124,7 @@ public class ModulePanel extends WizardPanelBase { loadModTokens(module, mod); module.setFound(true); - mOtherModules.addElement((Object) module); + mOtherModules.addElement(module); break; } }// while @@ -133,11 +134,12 @@ public class ModulePanel extends WizardPanelBase { * find all tokens belonging to a module and load the Module */ public void loadModTokens(Module module, PK11Module mod) { - Enumeration tokens = mod.getTokens(); + @SuppressWarnings("unchecked") + Enumeration tokens = mod.getTokens(); while (tokens.hasMoreElements()) { try { - CryptoToken token = (CryptoToken) tokens.nextElement(); + CryptoToken token = tokens.nextElement(); CMS.debug("ModulePanel: token nick name=" + token.getName()); CMS.debug("ModulePanel: token logged in?" + token.isLoggedIn()); @@ -164,7 +166,7 @@ public class ModulePanel extends WizardPanelBase { // getting supported security modules // a Vectgor of Modules - mSupportedModules = new Vector(); + mSupportedModules = new Vector(); // read from conf store all supported modules try { int count = CMS.getConfigStore().getInteger( @@ -191,7 +193,7 @@ public class ModulePanel extends WizardPanelBase { CMS.debug("ModulePanel: module found: " + cn); module.setFound(true); // add token info to module vector - PK11Module m = (PK11Module) mCurrModTable.get(cn); + PK11Module m = mCurrModTable.get(cn); loadModTokens(module, m); } @@ -199,7 +201,7 @@ public class ModulePanel extends WizardPanelBase { CMS.debug("ModulePanel: adding module " + cn); // add module to set if (!mSupportedModules.contains(module)) { - mSupportedModules.addElement((Object) module); + mSupportedModules.addElement(module); } }// for diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java index 9e0ca6f38..da721b29c 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java @@ -50,7 +50,7 @@ import com.netscape.cms.servlet.wizard.WizardServlet; import com.netscape.cmsutil.crypto.CryptoUtil; public class NamePanel extends WizardPanelBase { - private Vector mCerts = null; + private Vector mCerts = null; private WizardServlet mServlet = null; public NamePanel() { @@ -172,7 +172,7 @@ public class NamePanel extends WizardPanelBase { CMS.setConfigSDSessionId(session_id); } - mCerts = new Vector(); + mCerts = new Vector(); String domainname = ""; IConfigStore config = CMS.getConfigStore(); @@ -320,10 +320,10 @@ public class NamePanel extends WizardPanelBase { public void validate(HttpServletRequest request, HttpServletResponse response, Context context) throws IOException { - Enumeration c = mCerts.elements(); + Enumeration c = mCerts.elements(); while (c.hasMoreElements()) { - Cert cert = (Cert) c.nextElement(); + Cert cert = c.nextElement(); // get the dn's and put in config if (cert.isEnable()) { String dn = HttpInput.getDN(request, cert.getCertTag()); @@ -632,11 +632,11 @@ public class NamePanel extends WizardPanelBase { HttpServletResponse response, Context context, String tag) throws IOException { CMS.debug("NamePanel: configCertWithTag start"); - Enumeration c = mCerts.elements(); + Enumeration c = mCerts.elements(); IConfigStore config = CMS.getConfigStore(); while (c.hasMoreElements()) { - Cert cert = (Cert) c.nextElement(); + Cert cert = c.nextElement(); String ct = cert.getCertTag(); CMS.debug("NamePanel: configCertWithTag ct=" + ct + " tag=" + tag); @@ -673,10 +673,10 @@ public class NamePanel extends WizardPanelBase { boolean hasChanged = false; try { - Enumeration c = mCerts.elements(); + Enumeration c = mCerts.elements(); while (c.hasMoreElements()) { - Cert cert = (Cert) c.nextElement(); + Cert cert = c.nextElement(); String ct = cert.getCertTag(); boolean enable = config.getBoolean(PCERT_PREFIX + ct + ".enable", true); if (!enable) @@ -828,10 +828,10 @@ public class NamePanel extends WizardPanelBase { try { - Enumeration c = mCerts.elements(); + Enumeration c = mCerts.elements(); while (c.hasMoreElements()) { - Cert cert = (Cert) c.nextElement(); + Cert cert = c.nextElement(); String ct = cert.getCertTag(); String tokenname = cert.getTokenname(); boolean enable = config.getBoolean(PCERT_PREFIX + ct + ".enable", true); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java index 93893bff1..a56230c2f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java @@ -1077,10 +1077,10 @@ public class WizardPanelBase implements IWizardPanel { return v; } - public Vector getUrlListFromSecurityDomain(IConfigStore config, + public Vector getUrlListFromSecurityDomain(IConfigStore config, String type, String portType) { - Vector v = new Vector(); + Vector v = new Vector(); try { String hostname = config.getString("securitydomain.host"); @@ -1124,13 +1124,13 @@ public class WizardPanelBase implements IWizardPanel { CMS.debug("Len " + len); for (int i = 0; i < len; i++) { - Vector v_name = parser.getValuesFromContainer(nodeList.item(i), + Vector v_name = parser.getValuesFromContainer(nodeList.item(i), "SubsystemName"); - Vector v_host = parser.getValuesFromContainer(nodeList.item(i), + Vector v_host = parser.getValuesFromContainer(nodeList.item(i), "Host"); - Vector v_port = parser.getValuesFromContainer(nodeList.item(i), + Vector v_port = parser.getValuesFromContainer(nodeList.item(i), portType); - Vector v_admin_port = parser.getValuesFromContainer(nodeList.item(i), + Vector v_admin_port = parser.getValuesFromContainer(nodeList.item(i), "SecureAdminPort"); if (v_host.elementAt(0).equals(hostname) diff --git a/pki/base/common/src/com/netscape/cms/servlet/key/GetApprovalStatus.java b/pki/base/common/src/com/netscape/cms/servlet/key/GetApprovalStatus.java index 79bb937ed..0019c9508 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/key/GetApprovalStatus.java +++ b/pki/base/common/src/com/netscape/cms/servlet/key/GetApprovalStatus.java @@ -142,7 +142,7 @@ public class GetApprovalStatus extends CMSServlet { header.addStringValue("recoveryID", recoveryID); - Hashtable params = mService.getRecoveryParams(recoveryID); + Hashtable params = mService.getRecoveryParams(recoveryID); if (params == null) { log(ILogger.LL_FAILURE, @@ -157,13 +157,13 @@ public class GetApprovalStatus extends CMSServlet { header.addIntegerValue("noOfRequiredAgents", requiredNumber); - Vector dc = ((IKeyRecoveryAuthority) mService).getAppAgents(recoveryID); - Enumeration agents = dc.elements(); + Vector dc = ((IKeyRecoveryAuthority) mService).getAppAgents(recoveryID); + Enumeration agents = dc.elements(); while (agents.hasMoreElements()) { IArgBlock rarg = CMS.createArgBlock(); - rarg.addStringValue("agentName", ((Credential) agents.nextElement()).getIdentifier()); + rarg.addStringValue("agentName", agents.nextElement().getIdentifier()); argSet.addRepeatRecord(rarg); } if (dc.size() >= requiredNumber) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileApproveServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileApproveServlet.java index ebd0b6c0c..48848695f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileApproveServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileApproveServlet.java @@ -371,20 +371,19 @@ public class ProfileApproveServlet extends ProfileServlet { return; } - Enumeration policySetIds = profile.getProfilePolicySetIds(); + Enumeration policySetIds = profile.getProfilePolicySetIds(); ArgList setlist = new ArgList(); while (policySetIds.hasMoreElements()) { - String setId = (String) policySetIds.nextElement(); + String setId = policySetIds.nextElement(); - Enumeration policyIds = profile.getProfilePolicyIds(setId); + Enumeration policyIds = profile.getProfilePolicyIds(setId); ArgList list = new ArgList(); while (policyIds.hasMoreElements()) { - String id = (String) policyIds.nextElement(); - IProfilePolicy policy = (IProfilePolicy) - profile.getProfilePolicy(setId, id); + String id = policyIds.nextElement(); + IProfilePolicy policy = profile.getProfilePolicy(setId, id); // (3) query all the profile policies // (4) default plugins convert request parameters @@ -424,12 +423,12 @@ public class ProfileApproveServlet extends ProfileServlet { set.set(ARG_DEF_DESC, dDesc); ArgList deflist = new ArgList(); - Enumeration defNames = def.getValueNames(); + Enumeration defNames = def.getValueNames(); if (defNames != null) { while (defNames.hasMoreElements()) { ArgSet defset = new ArgSet(); - String defName = (String) defNames.nextElement(); + String defName = defNames.nextElement(); IDescriptor defDesc = def.getValueDescriptor(locale, defName); if (defDesc == null) { CMS.debug("defName=" + defName); diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileListServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileListServlet.java index 8581b3caa..2ca5f0a5c 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileListServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileListServlet.java @@ -126,7 +126,7 @@ public class ProfileListServlet extends ProfileServlet { } ArgList list = new ArgList(); - Enumeration e = ps.getProfileIds(); + Enumeration e = ps.getProfileIds(); if (e != null) { while (e.hasMoreElements()) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java index 8a8d65d90..3c75be021 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java @@ -60,6 +60,7 @@ import com.netscape.certsrv.request.RequestStatus; import com.netscape.certsrv.template.ArgList; import com.netscape.certsrv.template.ArgSet; import com.netscape.certsrv.util.IStatsSubsystem; +import com.netscape.cms.profile.common.ProfilePolicy; import com.netscape.cms.servlet.common.CMSRequest; /** @@ -691,11 +692,11 @@ public class ProfileProcessServlet extends ProfileServlet { req.setRequestStatus(RequestStatus.COMPLETE); ArgList outputlist = new ArgList(); - Enumeration outputIds = profile.getProfileOutputIds(); + Enumeration outputIds = profile.getProfileOutputIds(); if (outputIds != null) { while (outputIds.hasMoreElements()) { - String outputId = (String) outputIds.nextElement(); + String outputId = outputIds.nextElement(); IProfileOutput profileOutput = profile.getProfileOutput( outputId); @@ -779,11 +780,11 @@ public class ProfileProcessServlet extends ProfileServlet { throws ERejectException, EDeferException, EPropertyException { String profileSetId = req.getExtDataInString("profileSetId"); - Enumeration policies = profile.getProfilePolicies(profileSetId); + Enumeration policies = profile.getProfilePolicies(profileSetId); int count = 0; while (policies.hasMoreElements()) { - IProfilePolicy policy = (IProfilePolicy) policies.nextElement(); + ProfilePolicy policy = policies.nextElement(); setValue(locale, count, policy, req, request); count++; @@ -792,7 +793,7 @@ public class ProfileProcessServlet extends ProfileServlet { policies = profile.getProfilePolicies(profileSetId); count = 0; while (policies.hasMoreElements()) { - IProfilePolicy policy = (IProfilePolicy) policies.nextElement(); + ProfilePolicy policy = policies.nextElement(); validate(locale, count, policy, req, request); count++; @@ -821,10 +822,10 @@ public class ProfileProcessServlet extends ProfileServlet { throws EPropertyException { // handle default policy IPolicyDefault def = policy.getDefault(); - Enumeration defNames = def.getValueNames(); + Enumeration defNames = def.getValueNames(); while (defNames.hasMoreElements()) { - String defName = (String) defNames.nextElement(); + String defName = defNames.nextElement(); String defValue = request.getParameter(defName); def.setValue(defName, locale, req, defValue); diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java index 11aaa7499..6c2733115 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java @@ -234,15 +234,15 @@ public class ProfileReviewServlet extends ProfileServlet { String profileSetId = req.getExtDataInString("profileSetId"); CMS.debug("ProfileReviewServlet: profileSetId=" + profileSetId); - Enumeration policyIds = (profileSetId != null && profileSetId.length() > 0) ? + Enumeration policyIds = (profileSetId != null && profileSetId.length() > 0) ? profile.getProfilePolicyIds(profileSetId) : null; int count = 0; ArgList list = new ArgList(); if (policyIds != null) { while (policyIds.hasMoreElements()) { - String id = (String) policyIds.nextElement(); - IProfilePolicy policy = (IProfilePolicy) + String id = policyIds.nextElement(); + IProfilePolicy policy = profile.getProfilePolicy(req.getExtDataInString("profileSetId"), id); @@ -306,19 +306,19 @@ public class ProfileReviewServlet extends ProfileServlet { // populate authentication parameters // populate input parameters - Enumeration inputIds = profile.getProfileInputIds(); + Enumeration inputIds = profile.getProfileInputIds(); if (inputIds != null) { while (inputIds.hasMoreElements()) { - String inputId = (String) inputIds.nextElement(); + String inputId = inputIds.nextElement(); IProfileInput profileInput = profile.getProfileInput(inputId); - Enumeration inputNames = profileInput.getValueNames(); + Enumeration inputNames = profileInput.getValueNames(); if (inputNames != null) { while (inputNames.hasMoreElements()) { ArgSet inputset = new ArgSet(); - String inputName = (String) inputNames.nextElement(); + String inputName = inputNames.nextElement(); IDescriptor inputDesc = profileInput.getValueDescriptor(locale, inputName); @@ -350,20 +350,20 @@ public class ProfileReviewServlet extends ProfileServlet { // if request in complete state ArgList outputlist = new ArgList(); - Enumeration outputIds = profile.getProfileOutputIds(); + Enumeration outputIds = profile.getProfileOutputIds(); if (outputIds != null) { while (outputIds.hasMoreElements()) { - String outputId = (String) outputIds.nextElement(); + String outputId = outputIds.nextElement(); IProfileOutput profileOutput = profile.getProfileOutput(outputId ); - Enumeration outputNames = profileOutput.getValueNames(); + Enumeration outputNames = profileOutput.getValueNames(); if (outputNames != null) { while (outputNames.hasMoreElements()) { ArgSet outputset = new ArgSet(); - String outputName = (String) outputNames.nextElement + String outputName = outputNames.nextElement (); IDescriptor outputDesc = profileOutput.getValueDescriptor(locale, outputName); @@ -412,12 +412,12 @@ public class ProfileReviewServlet extends ProfileServlet { set.set(ARG_DEF_DESC, dDesc); ArgList deflist = new ArgList(); - Enumeration defNames = def.getValueNames(); + Enumeration defNames = def.getValueNames(); if (defNames != null) { while (defNames.hasMoreElements()) { ArgSet defset = new ArgSet(); - String defName = (String) defNames.nextElement(); + String defName = defNames.nextElement(); IDescriptor defDesc = def.getValueDescriptor(locale, defName); if (defDesc == null) diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSelectServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSelectServlet.java index 462c628b2..5b07951f8 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSelectServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSelectServlet.java @@ -189,18 +189,18 @@ public class ProfileSelectServlet extends ProfileServlet { } ArgList setlist = new ArgList(); - Enumeration policySetIds = profile.getProfilePolicySetIds(); + Enumeration policySetIds = profile.getProfilePolicySetIds(); if (policySetIds != null) { while (policySetIds.hasMoreElements()) { - String setId = (String) policySetIds.nextElement(); + String setId = policySetIds.nextElement(); ArgList list = new ArgList(); - Enumeration policyIds = profile.getProfilePolicyIds(setId); + Enumeration policyIds = profile.getProfilePolicyIds(setId); if (policyIds != null) { while (policyIds.hasMoreElements()) { - String id = (String) policyIds.nextElement(); + String id = policyIds.nextElement(); IProfilePolicy policy = (IProfilePolicy) profile.getProfilePolicy(setId, id); @@ -264,12 +264,12 @@ public class ProfileSelectServlet extends ProfileServlet { } if (authenticator != null) { - Enumeration authNames = authenticator.getValueNames(); + Enumeration authNames = authenticator.getValueNames(); if (authNames != null) { while (authNames.hasMoreElements()) { ArgSet authset = new ArgSet(); - String authName = (String) authNames.nextElement(); + String authName = authNames.nextElement(); IDescriptor authDesc = authenticator.getValueDescriptor(locale, authName); @@ -296,11 +296,11 @@ public class ProfileSelectServlet extends ProfileServlet { // build input list ArgList inputlist = new ArgList(); ArgList inputPluginlist = new ArgList(); - Enumeration inputIds = profile.getProfileInputIds(); + Enumeration inputIds = profile.getProfileInputIds(); if (inputIds != null) { while (inputIds.hasMoreElements()) { - String inputId = (String) inputIds.nextElement(); + String inputId = inputIds.nextElement(); IProfileInput profileInput = profile.getProfileInput(inputId); if (profileInput != null) { @@ -313,12 +313,12 @@ public class ProfileSelectServlet extends ProfileServlet { profileInput.getText(locale)); inputPluginlist.add(inputpluginset); - Enumeration inputNames = profileInput.getValueNames(); + Enumeration inputNames = profileInput.getValueNames(); if (inputNames != null) { while (inputNames.hasMoreElements()) { ArgSet inputset = new ArgSet(); - String inputName = (String) inputNames.nextElement(); + String inputName = inputNames.nextElement(); IDescriptor inputDesc = profileInput.getValueDescriptor( locale, inputName); @@ -362,12 +362,12 @@ public class ProfileSelectServlet extends ProfileServlet { set.set(ARG_DEF_DESC, dDesc); ArgList deflist = new ArgList(); - Enumeration defNames = def.getValueNames(); + Enumeration defNames = def.getValueNames(); if (defNames != null) { while (defNames.hasMoreElements()) { ArgSet defset = new ArgSet(); - String defName = (String) defNames.nextElement(); + String defName = defNames.nextElement(); IDescriptor defDesc = def.getValueDescriptor(locale, defName); if (defDesc == null) @@ -393,11 +393,11 @@ public class ProfileSelectServlet extends ProfileServlet { set.set(ARG_CON_DESC, conDesc); ArgList conlist = new ArgList(); - Enumeration conNames = con.getConfigNames(); + Enumeration conNames = con.getConfigNames(); if (conNames != null) { while (conNames.hasMoreElements()) { ArgSet conset = new ArgSet(); - String conName = (String) conNames.nextElement(); + String conName = conNames.nextElement(); conset.set(ARG_CON_NAME, conName); conset.set(ARG_CON_VALUE, con.getConfig(conName)); conlist.add(conset); diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileServlet.java index 368e36590..7bc6304be 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileServlet.java @@ -215,9 +215,9 @@ public class ProfileServlet extends CMSServlet { } else if (v instanceof ArgSet) { ArgSet set = (ArgSet) v; ps.println(""); - Enumeration names = set.getNames(); + Enumeration names = set.getNames(); while (names.hasMoreElements()) { - String n = (String) names.nextElement(); + String n = names.nextElement(); outputArgValueAsXML(ps, n, set.get(n)); } ps.println(""); @@ -426,10 +426,10 @@ public class ProfileServlet extends CMSServlet { protected void outputArgSet(PrintWriter writer, String name, ArgSet set) throws IOException { - Enumeration e = set.getNames(); + Enumeration e = set.getNames(); while (e.hasMoreElements()) { - String n = (String) e.nextElement(); + String n = e.nextElement(); IArgValue val = set.get(n); if (val instanceof ArgSet) { @@ -452,10 +452,10 @@ public class ProfileServlet extends CMSServlet { throws IOException { if (set == null) return; - Enumeration e = set.getNames(); + Enumeration e = set.getNames(); while (e.hasMoreElements()) { - String n = (String) e.nextElement(); + String n = e.nextElement(); IArgValue val = set.get(n); if (val instanceof ArgSet) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitCMCServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitCMCServlet.java index 04a2c55d5..d021ef387 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitCMCServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitCMCServlet.java @@ -120,16 +120,16 @@ public class ProfileSubmitCMCServlet extends ProfileServlet { private void setInputsIntoContext(HttpServletRequest request, IProfile profile, IProfileContext ctx) { // passing inputs into context - Enumeration inputIds = profile.getProfileInputIds(); + Enumeration inputIds = profile.getProfileInputIds(); if (inputIds != null) { while (inputIds.hasMoreElements()) { - String inputId = (String) inputIds.nextElement(); + String inputId = inputIds.nextElement(); IProfileInput profileInput = profile.getProfileInput(inputId); - Enumeration inputNames = profileInput.getValueNames(); + Enumeration inputNames = profileInput.getValueNames(); while (inputNames.hasMoreElements()) { - String inputName = (String) inputNames.nextElement(); + String inputName = inputNames.nextElement(); if (request.getParameter(inputName) != null) { ctx.set(inputName, request.getParameter(inputName)); @@ -142,11 +142,11 @@ public class ProfileSubmitCMCServlet extends ProfileServlet { private void setCredentialsIntoContext(HttpServletRequest request, IProfileAuthenticator authenticator, IProfileContext ctx) { - Enumeration authIds = authenticator.getValueNames(); + Enumeration authIds = authenticator.getValueNames(); if (authIds != null) { while (authIds.hasMoreElements()) { - String authName = (String) authIds.nextElement(); + String authName = authIds.nextElement(); if (request.getParameter(authName) != null) { ctx.set(authName, request.getParameter(authName)); @@ -160,11 +160,11 @@ public class ProfileSubmitCMCServlet extends ProfileServlet { AuthCredentials credentials = new AuthCredentials(); // build credential - Enumeration authNames = authenticator.getValueNames(); + Enumeration authNames = authenticator.getValueNames(); if (authNames != null) { while (authNames.hasMoreElements()) { - String authName = (String) authNames.nextElement(); + String authName = authNames.nextElement(); if (authName.equals("cert_request")) credentials.set(authName, requestB64); @@ -188,17 +188,17 @@ public class ProfileSubmitCMCServlet extends ProfileServlet { private void setInputsIntoRequest(HttpServletRequest request, IProfile profile, IRequest req) { - Enumeration inputIds = profile.getProfileInputIds(); + Enumeration inputIds = profile.getProfileInputIds(); if (inputIds != null) { while (inputIds.hasMoreElements()) { - String inputId = (String) inputIds.nextElement(); + String inputId = inputIds.nextElement(); IProfileInput profileInput = profile.getProfileInput(inputId); - Enumeration inputNames = profileInput.getValueNames(); + Enumeration inputNames = profileInput.getValueNames(); if (inputNames != null) { while (inputNames.hasMoreElements()) { - String inputName = (String) inputNames.nextElement(); + String inputName = inputNames.nextElement(); if (request.getParameter(inputName) != null) { req.setExtData(inputName, request.getParameter(inputName)); @@ -262,10 +262,11 @@ public class ProfileSubmitCMCServlet extends ProfileServlet { if (CMS.debugOn()) { CMS.debug("Start of ProfileSubmitCMCServlet Input Parameters"); - Enumeration paramNames = request.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration paramNames = request.getParameterNames(); while (paramNames.hasMoreElements()) { - String paramName = (String) paramNames.nextElement(); + String paramName = paramNames.nextElement(); // added this facility so that password can be hidden, // all sensitive parameters should be prefixed with // __ (double underscores); however, in the event that @@ -552,9 +553,9 @@ public class ProfileSubmitCMCServlet extends ProfileServlet { // serial auth token into request if (authToken != null) { - Enumeration tokenNames = authToken.getElements(); + Enumeration tokenNames = authToken.getElements(); while (tokenNames.hasMoreElements()) { - String tokenName = (String) tokenNames.nextElement(); + String tokenName = tokenNames.nextElement(); String[] vals = authToken.getInStringArray(tokenName); if (vals != null) { for (int i = 0; i < vals.length; i++) { @@ -659,9 +660,9 @@ public class ProfileSubmitCMCServlet extends ProfileServlet { // print request debug if (reqs[k] != null) { - Enumeration reqKeys = reqs[k].getExtDataKeys(); + Enumeration reqKeys = reqs[k].getExtDataKeys(); while (reqKeys.hasMoreElements()) { - String reqKey = (String) reqKeys.nextElement(); + String reqKey = reqKeys.nextElement(); String reqVal = reqs[k].getExtDataInString(reqKey); if (reqVal != null) { CMS.debug("ProfileSubmitCMCServlet: key=$request." + reqKey + "$ value=" + reqVal); -- cgit