diff options
author | Adam Young <ayoung@redhat.com> | 2011-11-17 11:30:34 -0500 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-12-22 16:39:30 -0500 |
commit | 90c761917754c18c18e9df643e8dd60368a3510f (patch) | |
tree | 4553442aa950fffa16c80ee33cfaa2b0f77424d6 /pki | |
parent | be9ed32e9a4435e15ea60f61d0ea39a1917f0afd (diff) | |
download | pki-90c761917754c18c18e9df643e8dd60368a3510f.tar.gz pki-90c761917754c18c18e9df643e8dd60368a3510f.tar.xz pki-90c761917754c18c18e9df643e8dd60368a3510f.zip |
Type safety for CMS and by extension, much of common
Diffstat (limited to 'pki')
15 files changed, 95 insertions, 92 deletions
diff --git a/pki/base/common/src/com/netscape/certsrv/apps/CMS.java b/pki/base/common/src/com/netscape/certsrv/apps/CMS.java index 137a609f1..f093bb74b 100644 --- a/pki/base/common/src/com/netscape/certsrv/apps/CMS.java +++ b/pki/base/common/src/com/netscape/certsrv/apps/CMS.java @@ -468,7 +468,7 @@ public final class CMS { * * @return a list of string-based subsystem names */ - public static Enumeration getSubsystemNames() { + public static Enumeration<String> getSubsystemNames() { return _engine.getSubsystemNames(); } @@ -481,7 +481,7 @@ public final class CMS { * * @return a list of ISubsystem-based subsystems */ - public static Enumeration getSubsystems() { + public static Enumeration<ISubsystem> getSubsystems() { return _engine.getSubsystems(); } @@ -1042,7 +1042,7 @@ public final class CMS { * @param params configuration parameters */ public static void getSubjAltNameConfigDefaultParams(String name, - Vector params) { + Vector<String> params) { _engine.getSubjAltNameConfigDefaultParams(name, params); } @@ -1053,7 +1053,7 @@ public final class CMS { * @param params configuration parameters */ public static void getSubjAltNameConfigExtendedPluginInfo(String name, - Vector params) { + Vector<String> params) { _engine.getSubjAltNameConfigExtendedPluginInfo(name, params); } @@ -1079,7 +1079,7 @@ public final class CMS { * @exception EBaseException failed to create subject alt name configuration */ public static void getGeneralNameConfigDefaultParams(String name, - boolean isValueConfigured, Vector params) { + boolean isValueConfigured, Vector<String> params) { _engine.getGeneralNameConfigDefaultParams(name, isValueConfigured, params); } @@ -1093,7 +1093,7 @@ public final class CMS { * @exception EBaseException failed to create subject alt name configuration */ public static void getGeneralNamesConfigDefaultParams(String name, - boolean isValueConfigured, Vector params) { + boolean isValueConfigured, Vector<String> params) { _engine.getGeneralNamesConfigDefaultParams(name, isValueConfigured, params); } @@ -1107,7 +1107,7 @@ public final class CMS { * @exception EBaseException failed to create subject alt name configuration */ public static void getGeneralNameConfigExtendedPluginInfo(String name, - boolean isValueConfigured, Vector info) { + boolean isValueConfigured, Vector<String> info) { _engine.getGeneralNameConfigExtendedPluginInfo(name, isValueConfigured, info); } @@ -1121,7 +1121,7 @@ public final class CMS { * @exception EBaseException failed to create subject alt name configuration */ public static void getGeneralNamesConfigExtendedPluginInfo(String name, - boolean isValueConfigured, Vector info) { + boolean isValueConfigured, Vector<String> info) { _engine.getGeneralNamesConfigExtendedPluginInfo(name, isValueConfigured, info); } @@ -1594,11 +1594,11 @@ public final class CMS { return _engine.createArgBlock(); } - public static IArgBlock createArgBlock(String realm, Hashtable httpReq) { + public static IArgBlock createArgBlock(String realm, Hashtable<String, String> httpReq) { return _engine.createArgBlock(realm, httpReq); } - public static IArgBlock createArgBlock(Hashtable httpReq) { + public static IArgBlock createArgBlock(Hashtable<String, String> httpReq) { return _engine.createArgBlock(httpReq); } diff --git a/pki/base/common/src/com/netscape/certsrv/apps/ICMSEngine.java b/pki/base/common/src/com/netscape/certsrv/apps/ICMSEngine.java index 506a5e33f..7f5e46055 100644 --- a/pki/base/common/src/com/netscape/certsrv/apps/ICMSEngine.java +++ b/pki/base/common/src/com/netscape/certsrv/apps/ICMSEngine.java @@ -158,14 +158,14 @@ public interface ICMSEngine extends ISubsystem { * * @return a list of string-based subsystem names */ - public Enumeration getSubsystemNames(); + public Enumeration<String> getSubsystemNames(); /** * Returns all the registered subsystems. * * @return a list of ISubsystem-based subsystems */ - public Enumeration getSubsystems(); + public Enumeration<ISubsystem> getSubsystems(); /** * Retrieves the registered subsytem with the given name. @@ -890,7 +890,7 @@ public interface ICMSEngine extends ISubsystem { * @exception EBaseException failed to create subject alt name configuration */ public void getGeneralNameConfigDefaultParams(String name, - boolean isValueConfigured, Vector params); + boolean isValueConfigured, Vector<String> params); /** * Retrieves default general names configuration. @@ -901,7 +901,7 @@ public interface ICMSEngine extends ISubsystem { * @exception EBaseException failed to create subject alt name configuration */ public void getGeneralNamesConfigDefaultParams(String name, - boolean isValueConfigured, Vector params); + boolean isValueConfigured, Vector<String> params); /** * Retrieves extended plugin info for general name configuration. @@ -912,7 +912,7 @@ public interface ICMSEngine extends ISubsystem { * @exception EBaseException failed to create subject alt name configuration */ public void getGeneralNameConfigExtendedPluginInfo(String name, - boolean isValueConfigured, Vector info); + boolean isValueConfigured, Vector<String> info); /** * Retrieves extended plugin info for general name configuration. @@ -923,7 +923,7 @@ public interface ICMSEngine extends ISubsystem { * @exception EBaseException failed to create subject alt name configuration */ public void getGeneralNamesConfigExtendedPluginInfo(String name, - boolean isValueConfigured, Vector info); + boolean isValueConfigured, Vector<String> info); /** * Created general names configuration. @@ -968,7 +968,7 @@ public interface ICMSEngine extends ISubsystem { * @param name configuration name * @param params configuration parameters */ - public void getSubjAltNameConfigDefaultParams(String name, Vector params); + public void getSubjAltNameConfigDefaultParams(String name, Vector<String> params); /** * Get extended plugin info for subject alt name configuration. @@ -976,7 +976,7 @@ public interface ICMSEngine extends ISubsystem { * @param name configuration name * @param params configuration parameters */ - public void getSubjAltNameConfigExtendedPluginInfo(String name, Vector params); + public void getSubjAltNameConfigExtendedPluginInfo(String name, Vector<String> params); /** * Creates subject alt name configuration. @@ -1064,12 +1064,12 @@ public interface ICMSEngine extends ISubsystem { /** * Creates argument block. */ - public IArgBlock createArgBlock(String realm, Hashtable httpReq); + public IArgBlock createArgBlock(String realm, Hashtable<String, String> httpReq); /** * Creates argument block. */ - public IArgBlock createArgBlock(Hashtable httpReq); + public IArgBlock createArgBlock(Hashtable<String, String> httpReq); /** * Checks against the local certificate repository to see diff --git a/pki/base/common/src/com/netscape/certsrv/apps/ICommandQueue.java b/pki/base/common/src/com/netscape/certsrv/apps/ICommandQueue.java index 5e2231921..f41b2989a 100644 --- a/pki/base/common/src/com/netscape/certsrv/apps/ICommandQueue.java +++ b/pki/base/common/src/com/netscape/certsrv/apps/ICommandQueue.java @@ -17,6 +17,10 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.apps; +import javax.servlet.Servlet; + +import com.netscape.cms.servlet.common.CMSRequest; + @@ -34,7 +38,7 @@ public interface ICommandQueue { * @param currentRequest request object * @param currentServlet servlet that serves the request object */ - public boolean registerProcess(Object currentRequest, Object currentServlet); + public boolean registerProcess(CMSRequest currentRequest, Servlet currentServlet); /** * UnRegisters a thread from the command queue. * diff --git a/pki/base/common/src/com/netscape/certsrv/base/IArgBlock.java b/pki/base/common/src/com/netscape/certsrv/base/IArgBlock.java index 83c8f85fa..65ca140e8 100644 --- a/pki/base/common/src/com/netscape/certsrv/base/IArgBlock.java +++ b/pki/base/common/src/com/netscape/certsrv/base/IArgBlock.java @@ -212,7 +212,7 @@ public interface IArgBlock extends Serializable { * * @return a list of string-based keys */ - public Enumeration elements(); + public Enumeration<String> elements(); /** * Adds long-type arguments to this block. @@ -279,5 +279,5 @@ public interface IArgBlock extends Serializable { * * @return a list of string-based keys */ - public Enumeration getElements(); + public Enumeration<String> getElements(); } diff --git a/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameAsConstraintsConfig.java b/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameAsConstraintsConfig.java index ff30dc11b..757780d3e 100644 --- a/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameAsConstraintsConfig.java +++ b/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameAsConstraintsConfig.java @@ -42,7 +42,7 @@ public interface IGeneralNameAsConstraintsConfig { * * @param params parameters */ - public void getInstanceParams(Vector params); + public void getInstanceParams(Vector<String> params); /** * Retrieves the general name. diff --git a/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameConfig.java b/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameConfig.java index 1f93719d3..0d44be081 100644 --- a/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameConfig.java +++ b/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameConfig.java @@ -64,5 +64,5 @@ public interface IGeneralNameConfig { * * @param params parameters */ - public void getInstanceParams(Vector params); + public void getInstanceParams(Vector<String> params); } diff --git a/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNamesAsConstraintsConfig.java b/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNamesAsConstraintsConfig.java index e64187b86..c461efd39 100644 --- a/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNamesAsConstraintsConfig.java +++ b/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNamesAsConstraintsConfig.java @@ -49,6 +49,6 @@ public interface IGeneralNamesAsConstraintsConfig { * * @param params instance parameters */ - public void getInstanceParams(Vector params); + public void getInstanceParams(Vector<String> params); } diff --git a/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNamesConfig.java b/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNamesConfig.java index 644258567..4c2330dff 100644 --- a/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNamesConfig.java +++ b/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNamesConfig.java @@ -49,5 +49,5 @@ public interface IGeneralNamesConfig { * * @param params instance parameters */ - public void getInstanceParams(Vector params); + public void getInstanceParams(Vector<String> params); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java b/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java index f5f06becb..1c5062758 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java @@ -239,14 +239,14 @@ public abstract class CMSServlet extends HttpServlet { protected boolean mRenderResult = true; protected String mFinalErrorMsg = FINAL_ERROR_MSG; - protected Hashtable mTemplates = new Hashtable(); + protected Hashtable<Integer, CMSLoadTemplate> mTemplates = new Hashtable<Integer, CMSLoadTemplate>(); protected ServletConfig mServletConfig = null; protected ServletContext mServletContext = null; private CMSFileLoader mFileLoader = null; - protected Vector mDontSaveHttpParams = new Vector(); - protected Vector mSaveHttpHeaders = new Vector(); + protected Vector<String> mDontSaveHttpParams = new Vector<String>(); + protected Vector<String> mSaveHttpHeaders = new Vector<String>(); protected String mId = null; protected IConfigStore mConfig = null; @@ -286,9 +286,9 @@ public abstract class CMSServlet extends HttpServlet { public CMSServlet() { } - public static Hashtable toHashtable(HttpServletRequest req) { - Hashtable httpReqHash = new Hashtable(); - Enumeration names = req.getParameterNames(); + public static Hashtable<String, String> toHashtable(HttpServletRequest req) { + Hashtable<String, String> httpReqHash = new Hashtable<String, String>(); + Enumeration<?> names = req.getParameterNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); @@ -355,7 +355,7 @@ public abstract class CMSServlet extends HttpServlet { mFinalErrorMsg = eMsg; // get any configured templates. - Enumeration templs = mTemplates.elements(); + Enumeration<CMSLoadTemplate> templs = mTemplates.elements(); while (templs.hasMoreElements()) { CMSLoadTemplate templ = (CMSLoadTemplate) templs.nextElement(); @@ -419,7 +419,7 @@ public abstract class CMSServlet extends HttpServlet { public void outputHttpParameters(HttpServletRequest httpReq) { CMS.debug("CMSServlet:service() uri = " + httpReq.getRequestURI()); - Enumeration paramNames = httpReq.getParameterNames(); + Enumeration<?> paramNames = httpReq.getParameterNames(); while (paramNames.hasMoreElements()) { String pn = (String)paramNames.nextElement(); // added this facility so that password can be hidden, @@ -511,7 +511,7 @@ public abstract class CMSServlet extends HttpServlet { ICommandQueue iCommandQueue = CMS.getCommandQueue(); try { - if (iCommandQueue.registerProcess((Object) cmsRequest, (Object) this) == false) { + if (iCommandQueue.registerProcess(cmsRequest, this) == false) { cmsRequest.setStatus(CMSRequest.ERROR); renderResult(cmsRequest); SessionContext.releaseContext(); @@ -604,7 +604,7 @@ public abstract class CMSServlet extends HttpServlet { Node argBlockContainer = xmlObj.createContainer(parent, argBlockName); if (argBlock != null) { - Enumeration names = argBlock.getElements(); + Enumeration<String> names = argBlock.getElements(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); String val = argBlock.get(name).toString(); @@ -624,7 +624,7 @@ public abstract class CMSServlet extends HttpServlet { outputArgBlockAsXML(xmlObj, root, "header", params.getHeader()); outputArgBlockAsXML(xmlObj, root, "fixed", params.getFixed()); - Enumeration records = params.queryRecords(); + Enumeration<IArgBlock> records = params.queryRecords(); Node recordsNode = xmlObj.createContainer(root, "records"); if (records != null) { while (records.hasMoreElements()) { @@ -1023,11 +1023,11 @@ public abstract class CMSServlet extends HttpServlet { protected void saveHttpHeaders( HttpServletRequest httpReq, IRequest req) throws EBaseException { - Hashtable headers = new Hashtable(); - Enumeration hdrs = mSaveHttpHeaders.elements(); + Hashtable<String, String> headers = new Hashtable<String, String>(); + Enumeration<String> hdrs = mSaveHttpHeaders.elements(); while (hdrs.hasMoreElements()) { - String hdr = (String) hdrs.nextElement(); + String hdr = hdrs.nextElement(); String val = httpReq.getHeader(hdr); if (val != null) { @@ -1042,17 +1042,17 @@ public abstract class CMSServlet extends HttpServlet { */ protected void saveHttpParams( IArgBlock httpParams, IRequest req) { - Hashtable saveParams = new Hashtable(); + Hashtable<String, Object> saveParams = new Hashtable<String, Object>(); - Enumeration names = httpParams.elements(); + Enumeration<String> names = httpParams.elements(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); - Enumeration params = mDontSaveHttpParams.elements(); + Enumeration<String> params = mDontSaveHttpParams.elements(); boolean dosave = true; while (params.hasMoreElements()) { - String param = (String) params.nextElement(); + String param = params.nextElement(); if (name.equalsIgnoreCase(param)) { dosave = false; diff --git a/pki/base/common/src/com/netscape/cms/servlet/common/CMSTemplateParams.java b/pki/base/common/src/com/netscape/cms/servlet/common/CMSTemplateParams.java index ced37b93e..4f8cfc2a7 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/common/CMSTemplateParams.java +++ b/pki/base/common/src/com/netscape/cms/servlet/common/CMSTemplateParams.java @@ -32,7 +32,7 @@ import com.netscape.certsrv.base.IArgBlock; public class CMSTemplateParams { private IArgBlock mHeader = null; private IArgBlock mFixed = null; - private Vector mRepeat = new Vector(); + private Vector<IArgBlock> mRepeat = new Vector<IArgBlock>(); public CMSTemplateParams() { } @@ -63,10 +63,10 @@ public class CMSTemplateParams { } public void clearRepeatRecords() { - mRepeat = new Vector(); + mRepeat = new Vector<IArgBlock>(); } - public Enumeration queryRecords() { + public Enumeration<IArgBlock> queryRecords() { return mRepeat.elements(); } } diff --git a/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java b/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java index e812cf10a..2c17d088d 100644 --- a/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java +++ b/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java @@ -408,7 +408,7 @@ public class CMSEngine implements ICMSEngine { } ACL acl = null; - Vector rights = null; + Vector<String> rights = null; int idx1 = resACLs.indexOf(":"); if (idx1 <= 0) { @@ -446,7 +446,7 @@ public class CMSEngine implements ICMSEngine { } if (rightsString != null) { - rights = new Vector(); + rights = new Vector<String>(); StringTokenizer rtok = new StringTokenizer(rightsString, ","); while (rtok.hasMoreTokens()) { @@ -645,11 +645,11 @@ public class CMSEngine implements ICMSEngine { return new ArgBlock(); } - public IArgBlock createArgBlock(Hashtable httpReq) { + public IArgBlock createArgBlock(Hashtable<String, String> httpReq) { return new ArgBlock(httpReq); } - public IArgBlock createArgBlock(String realm, Hashtable httpReq) { + public IArgBlock createArgBlock(String realm, Hashtable<String, String> httpReq) { return new ArgBlock(realm, httpReq); } @@ -827,11 +827,11 @@ public class CMSEngine implements ICMSEngine { return new HttpRequestEncoder(); } - public Enumeration getSubsystemNames() { + public Enumeration<String> getSubsystemNames() { return mSSReg.keys(); } - public Enumeration getSubsystems() { + public Enumeration<ISubsystem> getSubsystems() { return mSSReg.elements(); } @@ -859,7 +859,7 @@ public class CMSEngine implements ICMSEngine { IConfigStore ssconfig = mConfig.getSubStore(PROP_SUBSYSTEM); // count number of dyn loaded subsystems. - Enumeration ssnames = ssconfig.getSubStoreNames(); + Enumeration<String> ssnames = ssconfig.getSubStoreNames(); int nsubsystems = 0; for (nsubsystems = 0; ssnames.hasMoreElements(); nsubsystems++) @@ -1310,12 +1310,12 @@ public class CMSEngine implements ICMSEngine { } public void getSubjAltNameConfigDefaultParams(String name, - Vector params) { + Vector<String> params) { GeneralNameUtil.SubjAltNameGN.getDefaultParams(name, params); } public void getSubjAltNameConfigExtendedPluginInfo(String name, - Vector params) { + Vector<String> params) { GeneralNameUtil.SubjAltNameGN.getExtendedPluginInfo(name, params); } @@ -1333,22 +1333,22 @@ public class CMSEngine implements ICMSEngine { } public void getGeneralNameConfigDefaultParams(String name, - boolean isValueConfigured, Vector params) { + boolean isValueConfigured, Vector<String> params) { GeneralNameUtil.GeneralNameConfig.getDefaultParams(name, isValueConfigured, params); } public void getGeneralNamesConfigDefaultParams(String name, - boolean isValueConfigured, Vector params) { + boolean isValueConfigured, Vector<String> params) { GeneralNameUtil.GeneralNamesConfig.getDefaultParams(name, isValueConfigured, params); } public void getGeneralNameConfigExtendedPluginInfo(String name, - boolean isValueConfigured, Vector info) { + boolean isValueConfigured, Vector<String> info) { GeneralNameUtil.GeneralNameConfig.getExtendedPluginInfo(name, isValueConfigured, info); } public void getGeneralNamesConfigExtendedPluginInfo(String name, - boolean isValueConfigured, Vector info) { + boolean isValueConfigured, Vector<String> info) { GeneralNameUtil.GeneralNamesConfig.getExtendedPluginInfo(name, isValueConfigured, info); } @@ -1514,7 +1514,7 @@ public class CMSEngine implements ICMSEngine { } public void terminateRequests() { - java.util.Enumeration e = CommandQueue.mCommandQueue.keys(); + Enumeration e = CommandQueue.mCommandQueue.keys(); while (e.hasMoreElements()) { Object thisRequest = e.nextElement(); diff --git a/pki/base/common/src/com/netscape/cmscore/apps/CommandQueue.java b/pki/base/common/src/com/netscape/cmscore/apps/CommandQueue.java index 5a4dd6fb8..41b31049f 100644 --- a/pki/base/common/src/com/netscape/cmscore/apps/CommandQueue.java +++ b/pki/base/common/src/com/netscape/cmscore/apps/CommandQueue.java @@ -20,7 +20,10 @@ package com.netscape.cmscore.apps; import java.util.Hashtable; +import javax.servlet.Servlet; + import com.netscape.certsrv.apps.ICommandQueue; +import com.netscape.cms.servlet.common.CMSRequest; /*--------------------------------------------------------------- @@ -32,7 +35,7 @@ import com.netscape.certsrv.apps.ICommandQueue; */ public class CommandQueue implements Runnable, ICommandQueue { - public static Hashtable mCommandQueue = new Hashtable(); + public static Hashtable<CMSRequest, Servlet> mCommandQueue = new Hashtable<CMSRequest, Servlet>(); public static boolean mShuttingDown = false; /*----------------------------------------------------------- @@ -70,7 +73,7 @@ public class CommandQueue implements Runnable, ICommandQueue { } } // run - public boolean registerProcess(Object currentRequest, Object currentServlet) { + public boolean registerProcess(CMSRequest currentRequest, Servlet currentServlet) { if (mShuttingDown == false) { if ((currentServlet instanceof com.netscape.cms.servlet.base.CMSStartServlet) == false) mCommandQueue.put(currentRequest, currentServlet); diff --git a/pki/base/common/src/com/netscape/cmscore/base/ArgBlock.java b/pki/base/common/src/com/netscape/cmscore/base/ArgBlock.java index 10cc7a05f..8f29fc1b3 100644 --- a/pki/base/common/src/com/netscape/cmscore/base/ArgBlock.java +++ b/pki/base/common/src/com/netscape/cmscore/base/ArgBlock.java @@ -64,7 +64,7 @@ public class ArgBlock implements IArgBlock { public static final String CERT_RENEWAL_TRAILER = "-----END RENEWAL CERTIFICATE REQUEST-----"; - private Hashtable mArgs = new Hashtable(); + private Hashtable<String, Object> mArgs = new Hashtable<String, Object>(); private String mType = "unspecified-argblock"; @@ -75,7 +75,7 @@ public class ArgBlock implements IArgBlock { * Constructs an argument block with the given hashtable values. * @param realm the type of argblock - used for debugging the values */ - public ArgBlock(String realm, Hashtable httpReq) { + public ArgBlock(String realm, Hashtable<String, String> httpReq) { mType = realm; populate(httpReq); } @@ -85,18 +85,18 @@ public class ArgBlock implements IArgBlock { * * @param httpReq hashtable keys and values */ - public ArgBlock(Hashtable httpReq) { + public ArgBlock(Hashtable<String, String> httpReq) { populate(httpReq); } - private void populate(Hashtable httpReq) { + private void populate(Hashtable<String, String> httpReq) { // Add all parameters from the request - Enumeration e = httpReq.keys(); + Enumeration<String> e = httpReq.keys(); if (e != null) { while (e.hasMoreElements()) { - String name = (String) e.nextElement(); - String value = (String) httpReq.get(name); + String name = e.nextElement(); + String value = httpReq.get(name); addStringValue(name, value); } @@ -555,7 +555,7 @@ public class ArgBlock implements IArgBlock { * * @return a list of string-based keys */ - public Enumeration getElements() { + public Enumeration<String> getElements() { return mArgs.keys(); } @@ -564,7 +564,7 @@ public class ArgBlock implements IArgBlock { * * @return a list of string-based keys */ - public Enumeration elements() { + public Enumeration<String> elements() { return mArgs.keys(); } diff --git a/pki/base/common/src/com/netscape/cmscore/base/SubsystemRegistry.java b/pki/base/common/src/com/netscape/cmscore/base/SubsystemRegistry.java index ad8580187..72b4105a5 100644 --- a/pki/base/common/src/com/netscape/cmscore/base/SubsystemRegistry.java +++ b/pki/base/common/src/com/netscape/cmscore/base/SubsystemRegistry.java @@ -22,11 +22,7 @@ import java.util.Hashtable; import com.netscape.certsrv.base.ISubsystem; - -public class SubsystemRegistry extends Hashtable { - /** - * - */ +public class SubsystemRegistry extends Hashtable<String, ISubsystem> { private static final long serialVersionUID = 7801949114531559118L; private static SubsystemRegistry mInstance = null; @@ -42,7 +38,7 @@ public class SubsystemRegistry extends Hashtable { } public ISubsystem get(String key) { - return (ISubsystem) super.get(key); + return super.get(key); } } diff --git a/pki/base/common/src/com/netscape/cmscore/policy/GeneralNameUtil.java b/pki/base/common/src/com/netscape/cmscore/policy/GeneralNameUtil.java index 8f16548db..4587bca69 100644 --- a/pki/base/common/src/com/netscape/cmscore/policy/GeneralNameUtil.java +++ b/pki/base/common/src/com/netscape/cmscore/policy/GeneralNameUtil.java @@ -338,7 +338,7 @@ public class GeneralNameUtil implements IGeneralNameUtil { * adds params to default */ public static void getDefaultParams( - String name, boolean isValueConfigured, Vector params) { + String name, boolean isValueConfigured, Vector<String> params) { String nameDot = ""; if (name != null) @@ -354,7 +354,7 @@ public class GeneralNameUtil implements IGeneralNameUtil { /** * Get instance params. */ - public void getInstanceParams(Vector params) { + public void getInstanceParams(Vector<String> params) { params.addElement( PROP_NUM_GENERALNAMES + '=' + mGenNameConfigs.length); for (int i = 0; i < mGenNameConfigs.length; i++) { @@ -366,7 +366,7 @@ public class GeneralNameUtil implements IGeneralNameUtil { * Get extended plugin info. */ public static void getExtendedPluginInfo( - String name, boolean isValueConfigured, Vector info) { + String name, boolean isValueConfigured, Vector<String> info) { String nameDot = ""; if (name != null && name.length() > 0) @@ -485,9 +485,9 @@ public class GeneralNameUtil implements IGeneralNameUtil { * either a Vector of strings, string array or just a string. * Returned Vector can be null if value is not of expected type. */ - public Vector formGeneralNames(Object value) + public Vector<GeneralName> formGeneralNames(Object value) throws EBaseException { - Vector gns = new Vector(); + Vector<GeneralName> gns = new Vector<GeneralName>(); GeneralName gn = null; if (value instanceof String) { @@ -507,9 +507,9 @@ public class GeneralNameUtil implements IGeneralNameUtil { } } } else if (value instanceof Vector) { - Vector vals = (Vector) value; + Vector<?> vals = (Vector<?>) value; - for (Enumeration n = vals.elements(); n.hasMoreElements();) { + for (Enumeration<?> n = vals.elements(); n.hasMoreElements();) { Object val = n.nextElement(); if (val != null && (val instanceof String) && @@ -553,7 +553,7 @@ public class GeneralNameUtil implements IGeneralNameUtil { */ public static void getDefaultParams( - String name, boolean isValueConfigured, Vector params) { + String name, boolean isValueConfigured, Vector<String> params) { String nameDot = ""; if (name != null) @@ -567,7 +567,7 @@ public class GeneralNameUtil implements IGeneralNameUtil { /** * Get instance params */ - public void getInstanceParams(Vector params) { + public void getInstanceParams(Vector<String> params) { String value = (mValue == null) ? "" : mValue; String choice = (mGenNameChoice == null) ? "" : mGenNameChoice; @@ -580,7 +580,7 @@ public class GeneralNameUtil implements IGeneralNameUtil { * Get extended plugin info */ public static void getExtendedPluginInfo( - String name, boolean isValueConfigured, Vector info) { + String name, boolean isValueConfigured, Vector<String> info) { String nameDot = ""; if (name != null && name.length() > 0) @@ -666,12 +666,12 @@ public class GeneralNameUtil implements IGeneralNameUtil { return mAttr; } - public void getInstanceParams(Vector params) { + public void getInstanceParams(Vector<String> params) { params.addElement(mNameDot + PROP_REQUEST_ATTR + "=" + mRequestAttr); super.getInstanceParams(params); } - public static void getDefaultParams(String name, Vector params) { + public static void getDefaultParams(String name, Vector<String> params) { String nameDot = ""; if (name != null && name.length() > 0) @@ -680,7 +680,7 @@ public class GeneralNameUtil implements IGeneralNameUtil { GeneralNameUtil.GeneralNameConfig.getDefaultParams(name, false, params); } - public static void getExtendedPluginInfo(String name, Vector params) { + public static void getExtendedPluginInfo(String name, Vector<String> params) { String nameDot = ""; if (name != null && name.length() > 0) |