summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms/servlet/csadmin
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2012-01-12 23:25:43 -0600
committerEndi Sukma Dewata <edewata@redhat.com>2012-01-18 12:56:06 -0600
commit84e512223229b2d54e1a04b7899f888732c8fdba (patch)
tree33c022adbd60ce1103d0f0c97fcfc1e229a86643 /pki/base/common/src/com/netscape/cms/servlet/csadmin
parent2a535f04f7b7bf670b19b95801e25178af5c91f9 (diff)
downloadpki-84e512223229b2d54e1a04b7899f888732c8fdba.tar.gz
pki-84e512223229b2d54e1a04b7899f888732c8fdba.tar.xz
pki-84e512223229b2d54e1a04b7899f888732c8fdba.zip
Added generics (part 2).
This patch brings down the warnings from 4648 to 3992. Ticket #2
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/servlet/csadmin')
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/BaseServlet.java4
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java6
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/ConfigBaseServlet.java5
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/ConfigHSMServlet.java28
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java15
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/GetConfigEntries.java2
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/GetDomainXML.java5
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/ModulePanel.java34
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java20
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java12
10 files changed, 70 insertions, 61 deletions
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<String> 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<Cert> 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<Cert>();
IConfigStore config = CMS.getConfigStore();
@@ -499,7 +499,7 @@ public class CertRequestPanel extends WizardPanelBase {
}
try {
- Enumeration c = mCerts.elements();
+ Enumeration<Cert> 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<String> 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<Module> mSupportedModules = null;
private Vector mOtherModules = null;
private String mDefaultTok = null;
- private Hashtable mCurrModTable = new Hashtable();
+ private Hashtable<String, PK11Module> mCurrModTable = new Hashtable<String, PK11Module>();
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<PK11Module> 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<PK11Module> m = mCurrModTable.elements();
mOtherModules = new Vector();
while (m.hasMoreElements()) {
- PK11Module mod = (PK11Module) m.nextElement();
- Enumeration s = mSupportedModules.elements();
+ PK11Module mod = m.nextElement();
+ Enumeration<Module> 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<CryptoToken> 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<Module>();
// 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<String> 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<LDAPAttribute> 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<String> 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<String> 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<LDAPAttribute> 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<Module> mSupportedModules = null;
+ private Vector<Module> mOtherModules = null;
+ private Hashtable<String, PK11Module> mCurrModTable = new Hashtable<String, PK11Module>();
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<PK11Module> 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<PK11Module> m = mCurrModTable.elements();
- mOtherModules = new Vector();
+ mOtherModules = new Vector<Module>();
while (m.hasMoreElements()) {
- PK11Module mod = (PK11Module) m.nextElement();
- Enumeration s = mSupportedModules.elements();
+ PK11Module mod = m.nextElement();
+ Enumeration<Module> 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<CryptoToken> 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<Module>();
// 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<Cert> 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<Cert>();
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<Cert> 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<Cert> 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<Cert> 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<Cert> 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<String> getUrlListFromSecurityDomain(IConfigStore config,
String type,
String portType) {
- Vector v = new Vector();
+ Vector<String> v = new Vector<String>();
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<String> v_name = parser.getValuesFromContainer(nodeList.item(i),
"SubsystemName");
- Vector v_host = parser.getValuesFromContainer(nodeList.item(i),
+ Vector<String> v_host = parser.getValuesFromContainer(nodeList.item(i),
"Host");
- Vector v_port = parser.getValuesFromContainer(nodeList.item(i),
+ Vector<String> v_port = parser.getValuesFromContainer(nodeList.item(i),
portType);
- Vector v_admin_port = parser.getValuesFromContainer(nodeList.item(i),
+ Vector<String> v_admin_port = parser.getValuesFromContainer(nodeList.item(i),
"SecureAdminPort");
if (v_host.elementAt(0).equals(hostname)