diff options
105 files changed, 647 insertions, 620 deletions
diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/certdb/ICertRecordList.java b/pki/base/common/src/com/netscape/certsrv/dbs/certdb/ICertRecordList.java index 5db7e473e..59a826ee2 100644 --- a/pki/base/common/src/com/netscape/certsrv/dbs/certdb/ICertRecordList.java +++ b/pki/base/common/src/com/netscape/certsrv/dbs/certdb/ICertRecordList.java @@ -78,7 +78,7 @@ public interface ICertRecordList { * @param endidx ending index * @exception EBaseException failed to retrieve */ - public Enumeration getCertRecords(int startidx, int endidx) + public Enumeration<ICertRecord> getCertRecords(int startidx, int endidx) throws EBaseException; /** diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/certdb/ICertificateRepository.java b/pki/base/common/src/com/netscape/certsrv/dbs/certdb/ICertificateRepository.java index e354970b0..60f867368 100644 --- a/pki/base/common/src/com/netscape/certsrv/dbs/certdb/ICertificateRepository.java +++ b/pki/base/common/src/com/netscape/certsrv/dbs/certdb/ICertificateRepository.java @@ -404,7 +404,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of certificate records * @exception EBaseException failed to retrieve cert records */ - public Enumeration findCertRecs(String filter) + public Enumeration<Object> findCertRecs(String filter) throws EBaseException; /** @@ -438,7 +438,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of certificates * @exception EBaseException failed to retrieve */ - public Enumeration getValidNotPublishedCertificates(String from, String to) + public Enumeration<ICertRecord> getValidNotPublishedCertificates(String from, String to) throws EBaseException; /** @@ -449,7 +449,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of certificates * @exception EBaseException failed to retrieve */ - public Enumeration getExpiredPublishedCertificates(String from, String to) + public Enumeration<ICertRecord> getExpiredPublishedCertificates(String from, String to) throws EBaseException; /** @@ -460,7 +460,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of certificates * @exception EBaseException failed to retrieve */ - public Enumeration getRevokedPublishedCertificates(String from, String to) + public Enumeration<ICertRecord> getRevokedPublishedCertificates(String from, String to) throws EBaseException; /** @@ -471,7 +471,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of certificates * @exception EBaseException failed to retrieve */ - public Enumeration getValidCertificates(String from, String to) + public Enumeration<ICertRecord> getValidCertificates(String from, String to) throws EBaseException; /** @@ -482,7 +482,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of certificates * @exception EBaseException failed to retrieve */ - public Enumeration getExpiredCertificates(String from, String to) + public Enumeration<ICertRecord> getExpiredCertificates(String from, String to) throws EBaseException; /** @@ -493,7 +493,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of certificates * @exception EBaseException failed to retrieve */ - public Enumeration getRevokedCertificates(String from, String to) + public Enumeration<ICertRecord> getRevokedCertificates(String from, String to) throws EBaseException; /** diff --git a/pki/base/common/src/com/netscape/certsrv/request/AgentApprovals.java b/pki/base/common/src/com/netscape/certsrv/request/AgentApprovals.java index 48738d810..54277b611 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/AgentApprovals.java +++ b/pki/base/common/src/com/netscape/certsrv/request/AgentApprovals.java @@ -82,7 +82,7 @@ public class AgentApprovals // search for (int i = 0; i < mVector.size(); i++) { - a = (AgentApproval) mVector.elementAt(i); + a = mVector.elementAt(i); if (a.mUserName.equals(userName)) break; @@ -96,7 +96,7 @@ public class AgentApprovals * * @return an enumeration of the agent approvals */ - public Enumeration elements() { + public Enumeration<AgentApproval> elements() { return mVector.elements(); } @@ -110,8 +110,8 @@ public class AgentApprovals * * @return The string vector. */ - public Vector toStringVector() { - Vector retval = new Vector(mVector.size()); + public Vector<String> toStringVector() { + Vector<String> retval = new Vector<String>(mVector.size()); for (int i = 0; i < mVector.size(); i++) { AgentApproval a = (AgentApproval) mVector.elementAt(i); retval.add(a.getDate().getTime() + ";" + a.getUserName()); @@ -155,5 +155,5 @@ public class AgentApprovals return approvals; } - protected Vector mVector = new Vector(); + protected Vector<AgentApproval> mVector = new Vector<AgentApproval>(); } diff --git a/pki/base/common/src/com/netscape/certsrv/util/StatsEvent.java b/pki/base/common/src/com/netscape/certsrv/util/StatsEvent.java index 9e004b629..eafd90d05 100644 --- a/pki/base/common/src/com/netscape/certsrv/util/StatsEvent.java +++ b/pki/base/common/src/com/netscape/certsrv/util/StatsEvent.java @@ -34,7 +34,7 @@ public class StatsEvent { private long mTimeTaken = 0; private long mTimeTakenSqSum = 0; private long mNoOfOperations = 0; - private Vector mSubEvents = new Vector(); + private Vector<StatsEvent> mSubEvents = new Vector<StatsEvent>(); private StatsEvent mParent = null; public StatsEvent(StatsEvent parent) { @@ -59,11 +59,11 @@ public class StatsEvent { /** * Retrieves a list of sub transaction names. */ - public Enumeration getSubEventNames() { - Vector names = new Vector(); - Enumeration e = mSubEvents.elements(); + public Enumeration<String> getSubEventNames() { + Vector<String> names = new Vector<String>(); + Enumeration<StatsEvent> e = mSubEvents.elements(); while (e.hasMoreElements()) { - StatsEvent st = (StatsEvent) e.nextElement(); + StatsEvent st = e.nextElement(); names.addElement(st.getName()); } return names.elements(); @@ -73,9 +73,9 @@ public class StatsEvent { * Retrieves a sub transaction. */ public StatsEvent getSubEvent(String name) { - Enumeration e = mSubEvents.elements(); + Enumeration<StatsEvent> e = mSubEvents.elements(); while (e.hasMoreElements()) { - StatsEvent st = (StatsEvent) e.nextElement(); + StatsEvent st = e.nextElement(); if (st.getName().equals(name)) { return st; } @@ -89,9 +89,9 @@ public class StatsEvent { mNoOfOperations = 0; mTimeTaken = 0; mTimeTakenSqSum = 0; - Enumeration e = getSubEventNames(); + Enumeration<String> e = getSubEventNames(); while (e.hasMoreElements()) { - String n = (String) e.nextElement(); + String n = e.nextElement(); StatsEvent c = getSubEvent(n); c.resetCounters(); } diff --git a/pki/base/common/src/com/netscape/cms/authentication/CMCAuth.java b/pki/base/common/src/com/netscape/cms/authentication/CMCAuth.java index 3098e0016..cf57098b6 100644 --- a/pki/base/common/src/com/netscape/cms/authentication/CMCAuth.java +++ b/pki/base/common/src/com/netscape/cms/authentication/CMCAuth.java @@ -946,8 +946,8 @@ public class CMCAuth implements IAuthManager, IExtendedPluginInfo, /** * Retrieves a list of names of the value parameter. */ - public Enumeration getValueNames() { - Vector v = new Vector(); + public Enumeration<String> getValueNames() { + Vector<String> v = new Vector<String>(); v.addElement("cert_request"); return v.elements(); } diff --git a/pki/base/common/src/com/netscape/cms/authentication/FlatFileAuth.java b/pki/base/common/src/com/netscape/cms/authentication/FlatFileAuth.java index 37e076d4a..f60110b0b 100644 --- a/pki/base/common/src/com/netscape/cms/authentication/FlatFileAuth.java +++ b/pki/base/common/src/com/netscape/cms/authentication/FlatFileAuth.java @@ -121,7 +121,7 @@ public class FlatFileAuth * Hashtable of entries from Auth File. Hash index is the * concatenation of the attributes from matchAttributes property */ - protected Hashtable entries = null; + protected Hashtable<String, Hashtable<String, String>> entries = null; /** * Get the named property @@ -241,7 +241,7 @@ public class FlatFileAuth */ public String[] unionOfStrings(String[][] stringArrays) { - Hashtable ht = new Hashtable(); + Hashtable<String, String> ht = new Hashtable<String, String>(); for (int i = 0; i < stringArrays.length; i++) { String[] sa = stringArrays[i]; @@ -253,10 +253,10 @@ public class FlatFileAuth } String[] s = new String[ht.size()]; - Enumeration e = ht.keys(); + Enumeration<String> e = ht.keys(); for (int i = 0; e.hasMoreElements(); i++) { - s[i] = (String) e.nextElement(); + s[i] = e.nextElement(); } return s; @@ -412,7 +412,7 @@ public class FlatFileAuth * key * @return a hashtable of hashtables. */ - protected Hashtable readFile(File f, String[] keys) + protected Hashtable<String, Hashtable<String, String>> readFile(File f, String[] keys) throws IOException { log(ILogger.LL_INFO, "Reading file: " + f.getName()); BufferedReader file = new BufferedReader( @@ -420,8 +420,8 @@ public class FlatFileAuth ); String line; - Hashtable allusers = new Hashtable(); - Hashtable entry = null; + Hashtable<String, Hashtable<String, String>> allusers = new Hashtable<String, Hashtable<String, String>>(); + Hashtable<String, String> entry = null; int linenum = 0; while ((line = file.readLine()) != null) { @@ -433,7 +433,7 @@ public class FlatFileAuth int colon = line.indexOf(':'); if (entry == null) { - entry = new Hashtable(); + entry = new Hashtable<String, String>(); } if (colon == -1) { // no colon -> empty line signifies end of record @@ -464,8 +464,8 @@ public class FlatFileAuth return allusers; } - private void putEntry(Hashtable allUsers, - Hashtable entry, + private void putEntry(Hashtable<String, Hashtable<String, String>> allUsers, + Hashtable<String, String> entry, String[] keys) { if (entry == null) { return; @@ -474,7 +474,7 @@ public class FlatFileAuth print("keys.length = " + keys.length); for (int i = 0; i < keys.length; i++) { - String s = (String) entry.get(keys[i]); + String s = entry.get(keys[i]); print(" concatenating: " + s); if (s != null) { @@ -486,17 +486,17 @@ public class FlatFileAuth } void printAllEntries() { - Enumeration e = entries.keys(); + Enumeration<String> e = entries.keys(); while (e.hasMoreElements()) { - String key = (String) e.nextElement(); + String key = e.nextElement(); print("* " + key + " *"); - Hashtable ht = (Hashtable) entries.get(key); - Enumeration f = ht.keys(); + Hashtable<String, String> ht = entries.get(key); + Enumeration<String> f = ht.keys(); while (f.hasMoreElements()) { - String fkey = (String) f.nextElement(); + String fkey = f.nextElement(); print(" " + fkey + " -> " + ht.get(fkey)); } @@ -509,7 +509,7 @@ public class FlatFileAuth * */ - private IAuthToken doAuthentication(Hashtable user, IAuthCredentials authCred) + private IAuthToken doAuthentication(Hashtable<String, String> user, IAuthCredentials authCred) throws EMissingCredential, EInvalidCredentials, EBaseException { AuthToken authToken = new AuthToken(this); @@ -567,7 +567,7 @@ public class FlatFileAuth } print("authenticating user: finding user from key: " + keyForUser); - Hashtable user = (Hashtable) entries.get(keyForUser); + Hashtable<String, String> user = entries.get(keyForUser); try { if (user != null) { @@ -660,7 +660,7 @@ public class FlatFileAuth /** * Retrieves a list of names of the value parameter. */ - public Enumeration getValueNames() { + public Enumeration<String> getValueNames() { return null; } diff --git a/pki/base/common/src/com/netscape/cms/authentication/HashAuthData.java b/pki/base/common/src/com/netscape/cms/authentication/HashAuthData.java index a2d3bc728..3a447d282 100644 --- a/pki/base/common/src/com/netscape/cms/authentication/HashAuthData.java +++ b/pki/base/common/src/com/netscape/cms/authentication/HashAuthData.java @@ -29,7 +29,7 @@ import java.util.Vector; * * @version $Revision$, $Date$ */ -public class HashAuthData extends Hashtable { +public class HashAuthData extends Hashtable<String, Vector<Object>> { /** * @@ -42,7 +42,7 @@ public class HashAuthData extends Hashtable { } public String getAgentName(String hostname) { - Vector val = (Vector) get(hostname); + Vector<Object> val = get(hostname); if (val != null) return (String) val.elementAt(0); @@ -50,17 +50,17 @@ public class HashAuthData extends Hashtable { } public void setAgentName(String hostname, String agentName) { - Vector val = (Vector) get(hostname); + Vector<Object> val = get(hostname); if (val == null) { - val = new Vector(); + val = new Vector<Object>(); put(hostname, val); } val.setElementAt(agentName, 0); } public long getTimeout(String hostname) { - Vector val = (Vector) get(hostname); + Vector<Object> val = get(hostname); if (val != null) { return ((Long) val.elementAt(1)).longValue(); @@ -69,17 +69,17 @@ public class HashAuthData extends Hashtable { } public void setTimeout(String hostname, long timeout) { - Vector val = (Vector) get(hostname); + Vector<Object> val = get(hostname); if (val == null) { - val = new Vector(); + val = new Vector<Object>(); put(hostname, val); } val.setElementAt(Long.valueOf(timeout), 1); } public String getSecret(String hostname) { - Vector val = (Vector) get(hostname); + Vector<Object> val = get(hostname); if (val != null) { return (String) val.elementAt(2); @@ -88,17 +88,17 @@ public class HashAuthData extends Hashtable { } public void setSecret(String hostname, String secret) { - Vector val = (Vector) get(hostname); + Vector<Object> val = get(hostname); if (val == null) { - val = new Vector(); + val = new Vector<Object>(); put(hostname, val); } val.setElementAt(secret, 2); } public long getLastLogin(String hostname) { - Vector val = (Vector) get(hostname); + Vector<Object> val = get(hostname); if (val != null) { return ((Long) val.elementAt(3)).longValue(); @@ -107,10 +107,10 @@ public class HashAuthData extends Hashtable { } public void setLastLogin(String hostname, long lastLogin) { - Vector val = (Vector) get(hostname); + Vector<Object> val = get(hostname); if (val == null) { - val = new Vector(); + val = new Vector<Object>(); put(hostname, val); } val.setElementAt(Long.valueOf(lastLogin), 3); diff --git a/pki/base/common/src/com/netscape/cms/authentication/HashAuthentication.java b/pki/base/common/src/com/netscape/cms/authentication/HashAuthentication.java index a0199a9be..4aae1f159 100644 --- a/pki/base/common/src/com/netscape/cms/authentication/HashAuthentication.java +++ b/pki/base/common/src/com/netscape/cms/authentication/HashAuthentication.java @@ -123,7 +123,7 @@ public class HashAuthentication implements IAuthManager, IExtendedPluginInfo { public void createEntry(String host, String dn, long timeout, String secret, long lastLogin) { - Vector v = new Vector(); + Vector<Object> v = new Vector<Object>(); v.addElement(dn); v.addElement(Long.valueOf(timeout)); @@ -193,7 +193,7 @@ public class HashAuthentication implements IAuthManager, IExtendedPluginInfo { return false; } - public Enumeration getHosts() { + public Enumeration<String> getHosts() { return mHosts.keys(); } diff --git a/pki/base/common/src/com/netscape/cms/authentication/PortalEnroll.java b/pki/base/common/src/com/netscape/cms/authentication/PortalEnroll.java index e2c3ec871..8049ffb11 100644 --- a/pki/base/common/src/com/netscape/cms/authentication/PortalEnroll.java +++ b/pki/base/common/src/com/netscape/cms/authentication/PortalEnroll.java @@ -355,14 +355,14 @@ public class PortalEnroll extends DirBasedAuthentication { attr.addValue((String) objectclass_values.elementAt(i)); attrs.add(attr); - Enumeration objClasses = mRequiredAttrs.elements(); - Enumeration attrnames = null; + Enumeration<Enumeration<String>> objClasses = mRequiredAttrs.elements(); + Enumeration<String> attrnames = null; while (objClasses.hasMoreElements()) { - attrnames = (Enumeration) objClasses.nextElement(); + attrnames = objClasses.nextElement(); CMS.debug("PortalEnroll: Required attrs:"); while (attrnames.hasMoreElements()) { - String attrname = (String) attrnames.nextElement(); + String attrname = attrnames.nextElement(); String attrval = null; CMS.debug("PortalEnroll: attrname is: " + attrname); @@ -385,10 +385,10 @@ public class PortalEnroll extends DirBasedAuthentication { attrnames = null; while (objClasses.hasMoreElements()) { - attrnames = (Enumeration) objClasses.nextElement(); + attrnames = objClasses.nextElement(); CMS.debug("PortalEnroll: Optional attrs:"); while (attrnames.hasMoreElements()) { - String attrname = (String) attrnames.nextElement(); + String attrname = attrnames.nextElement(); String attrval = null; CMS.debug("PortalEnroll: attrname is: " + attrname); diff --git a/pki/base/common/src/com/netscape/cms/jobs/PublishCertsJob.java b/pki/base/common/src/com/netscape/cms/jobs/PublishCertsJob.java index 29c5f21a5..efca74168 100644 --- a/pki/base/common/src/com/netscape/cms/jobs/PublishCertsJob.java +++ b/pki/base/common/src/com/netscape/cms/jobs/PublishCertsJob.java @@ -185,7 +185,7 @@ public class PublishCertsJob extends AJobBase "(!(certMetainfo=" + ICertRecord.META_LDAPPUBLISH + ":true))"; - Enumeration unpublishedCerts = null; + Enumeration<Object> unpublishedCerts = null; try { unpublishedCerts = mRepository.findCertRecs(filter); diff --git a/pki/base/common/src/com/netscape/cms/jobs/RenewalNotificationJob.java b/pki/base/common/src/com/netscape/cms/jobs/RenewalNotificationJob.java index 2a3fffed3..0c6178e99 100644 --- a/pki/base/common/src/com/netscape/cms/jobs/RenewalNotificationJob.java +++ b/pki/base/common/src/com/netscape/cms/jobs/RenewalNotificationJob.java @@ -423,10 +423,10 @@ public class RenewalNotificationJob //CertRecordList list = mCertDB.findCertRecordsInList(filter, null, "serialno", 5); //list.processCertRecords(0, list.getSize() - 1, cp); - Enumeration en = mCertDB.findCertRecs(filter); + Enumeration<Object> en = mCertDB.findCertRecs(filter); while (en.hasMoreElements()) { - Object element = (Object) en.nextElement(); + Object element = en.nextElement(); try { cp.process(element); diff --git a/pki/base/common/src/com/netscape/cms/jobs/UnpublishExpiredJob.java b/pki/base/common/src/com/netscape/cms/jobs/UnpublishExpiredJob.java index 6aea0c514..c61d953eb 100644 --- a/pki/base/common/src/com/netscape/cms/jobs/UnpublishExpiredJob.java +++ b/pki/base/common/src/com/netscape/cms/jobs/UnpublishExpiredJob.java @@ -189,7 +189,7 @@ public class UnpublishExpiredJob extends AJobBase // a test for without CertRecord.META_LDAPPUBLISH //String filter = "(x509Cert.notAfter<="+ now +")"; - Enumeration expired = null; + Enumeration<Object> expired = null; try { expired = mRepository.findCertRecs(filter); diff --git a/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java b/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java index 4a0225a40..bdfbc9ca2 100644 --- a/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java +++ b/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java @@ -156,12 +156,13 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { } LDAPEntry entry = results.next(); LDAPAttribute crls = entry.getAttribute(mCACertAttr); - Enumeration vals = crls.getByteValues(); + @SuppressWarnings("unchecked") + Enumeration<byte[]> vals = crls.getByteValues(); if (!vals.hasMoreElements()) { throw new EBaseException("error - no values"); } - byte caCertData[] = (byte[]) vals.nextElement(); + byte caCertData[] = vals.nextElement(); X509CertImpl caCert = new X509CertImpl(caCertData); return caCert; @@ -188,12 +189,13 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { } LDAPEntry entry = results.next(); LDAPAttribute crls = entry.getAttribute(mCRLAttr); - Enumeration vals = crls.getByteValues(); + @SuppressWarnings("unchecked") + Enumeration<byte[]> vals = crls.getByteValues(); if (!vals.hasMoreElements()) { throw new EBaseException("error - no values"); } - byte crlData[] = (byte[]) vals.nextElement(); + byte crlData[] = vals.nextElement(); X509CRLImpl crl = new X509CRLImpl(crlData); return crl; @@ -457,10 +459,10 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { X509CertImpl theCert = null; X509CRLImpl theCRL = null; - Enumeration caCerts = mCRLs.keys(); + Enumeration<X509CertImpl> caCerts = mCRLs.keys(); while (caCerts.hasMoreElements()) { - X509CertImpl caCert = (X509CertImpl) caCerts.nextElement(); + X509CertImpl caCert = caCerts.nextElement(); MessageDigest md = null; try { @@ -565,10 +567,10 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { public void setConfigParameters(NameValuePairs pairs) throws EBaseException { - Enumeration k = pairs.getNames(); + Enumeration<String> k = pairs.getNames(); while (k.hasMoreElements()) { - String key = (String) k.nextElement(); + String key = k.nextElement(); mConfig.put(key, pairs.getValue(key)); } diff --git a/pki/base/common/src/com/netscape/cms/policy/constraints/KeyAlgorithmConstraints.java b/pki/base/common/src/com/netscape/cms/policy/constraints/KeyAlgorithmConstraints.java index 14cd9ece4..9bb806eba 100644 --- a/pki/base/common/src/com/netscape/cms/policy/constraints/KeyAlgorithmConstraints.java +++ b/pki/base/common/src/com/netscape/cms/policy/constraints/KeyAlgorithmConstraints.java @@ -52,7 +52,7 @@ import com.netscape.cms.policy.APolicyRule; */ public class KeyAlgorithmConstraints extends APolicyRule implements IEnrollmentPolicy, IExtendedPluginInfo { - private Vector mAlgorithms; + private Vector<String> mAlgorithms; private final static String DEF_KEY_ALGORITHM = "RSA,DSA"; private final static String PROP_ALGORITHMS = "algorithms"; private final static String[] supportedAlgorithms = @@ -96,7 +96,7 @@ public class KeyAlgorithmConstraints extends APolicyRule public void init(ISubsystem owner, IConfigStore config) throws EPolicyException { - mAlgorithms = new Vector(); + mAlgorithms = new Vector<String>(); if (config == null || config.size() == 0) { mAlgorithms.addElement(DEF_KEY_ALGORITHM); @@ -130,9 +130,9 @@ public class KeyAlgorithmConstraints extends APolicyRule } // Check if configured algorithms are supported. - for (Enumeration e = mAlgorithms.elements(); e.hasMoreElements();) { + for (Enumeration<String> e = mAlgorithms.elements(); e.hasMoreElements();) { int i; - String configuredAlg = (String) e.nextElement(); + String configuredAlg = e.nextElement(); // See if it is a supported algorithm. for (i = 0; i < supportedAlgorithms.length; i++) { @@ -200,12 +200,12 @@ public class KeyAlgorithmConstraints extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { - Vector v = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> v = new Vector<String>(); StringBuffer sb = new StringBuffer(); - for (Enumeration e = mAlgorithms.elements(); e.hasMoreElements();) { - sb.append((String) e.nextElement()); + for (Enumeration<String> e = mAlgorithms.elements(); e.hasMoreElements();) { + sb.append(e.nextElement()); sb.append(","); } if (sb.length() > 0) diff --git a/pki/base/common/src/com/netscape/cms/profile/common/CAEnrollProfile.java b/pki/base/common/src/com/netscape/cms/profile/common/CAEnrollProfile.java index aa18acd3b..c03f90a4b 100644 --- a/pki/base/common/src/com/netscape/cms/profile/common/CAEnrollProfile.java +++ b/pki/base/common/src/com/netscape/cms/profile/common/CAEnrollProfile.java @@ -226,9 +226,9 @@ public class CAEnrollProfile extends EnrollProfile { request.setRequestStatus(RequestStatus.COMPLETE); // notifies updater plugins - Enumeration updaterIds = getProfileUpdaterIds(); + Enumeration<String> updaterIds = getProfileUpdaterIds(); while (updaterIds.hasMoreElements()) { - String updaterId = (String) updaterIds.nextElement(); + String updaterId = updaterIds.nextElement(); IProfileUpdater updater = getProfileUpdater(updaterId); updater.update(request, RequestStatus.COMPLETE); } diff --git a/pki/base/common/src/com/netscape/cms/profile/constraint/ExtendedKeyUsageExtConstraint.java b/pki/base/common/src/com/netscape/cms/profile/constraint/ExtendedKeyUsageExtConstraint.java index 9c8e04784..3c737e8a5 100644 --- a/pki/base/common/src/com/netscape/cms/profile/constraint/ExtendedKeyUsageExtConstraint.java +++ b/pki/base/common/src/com/netscape/cms/profile/constraint/ExtendedKeyUsageExtConstraint.java @@ -108,7 +108,7 @@ public class ExtendedKeyUsageExtConstraint extends EnrollConstraint { } // Build local cache of configured OIDs - Vector mCache = new Vector(); + Vector<String> mCache = new Vector<String>(); StringTokenizer st = new StringTokenizer(getConfig(CONFIG_OIDS), ","); while (st.hasMoreTokens()) { @@ -118,10 +118,10 @@ public class ExtendedKeyUsageExtConstraint extends EnrollConstraint { } // check OIDs - Enumeration e = ext.getOIDs(); + Enumeration<ObjectIdentifier> e = ext.getOIDs(); while (e.hasMoreElements()) { - ObjectIdentifier oid = (ObjectIdentifier) e.nextElement(); + ObjectIdentifier oid = e.nextElement(); if (!mCache.contains(oid.toString())) { throw new ERejectException( diff --git a/pki/base/common/src/com/netscape/cms/profile/constraint/NoConstraint.java b/pki/base/common/src/com/netscape/cms/profile/constraint/NoConstraint.java index 0d81c583f..459e9f219 100644 --- a/pki/base/common/src/com/netscape/cms/profile/constraint/NoConstraint.java +++ b/pki/base/common/src/com/netscape/cms/profile/constraint/NoConstraint.java @@ -43,9 +43,9 @@ public class NoConstraint implements IPolicyConstraint { public static final String CONFIG_NAME = "name"; private IConfigStore mConfig = null; - private Vector mNames = new Vector(); + private Vector<String> mNames = new Vector<String>(); - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { return mNames.elements(); } diff --git a/pki/base/common/src/com/netscape/cms/profile/constraint/UniqueKeyConstraint.java b/pki/base/common/src/com/netscape/cms/profile/constraint/UniqueKeyConstraint.java index 1526686e9..f10130aa6 100644 --- a/pki/base/common/src/com/netscape/cms/profile/constraint/UniqueKeyConstraint.java +++ b/pki/base/common/src/com/netscape/cms/profile/constraint/UniqueKeyConstraint.java @@ -191,9 +191,9 @@ public class UniqueKeyConstraint extends EnrollConstraint { sjname_in_req = (X500Name) subName.get(CertificateSubjectName.DN_NAME); CMS.debug("UniqueKeyConstraint: cert request subject DN =" + sjname_in_req.toString()); - Enumeration e = list.getCertRecords(0, size - 1); + Enumeration<ICertRecord> e = list.getCertRecords(0, size - 1); while (e != null && e.hasMoreElements()) { - ICertRecord rec = (ICertRecord) e.nextElement(); + ICertRecord rec = e.nextElement(); X509CertImpl cert = rec.getCertificate(); String certDN = cert.getSubjectDN().toString(); diff --git a/pki/base/common/src/com/netscape/cms/profile/def/AuthInfoAccessExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/AuthInfoAccessExtDefault.java index c9ea70624..f23b7e24c 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/AuthInfoAccessExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/AuthInfoAccessExtDefault.java @@ -114,7 +114,7 @@ public class AuthInfoAccessExtDefault extends EnrollExtDefault { super.setConfig(name, value); } - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { refreshConfigAndValueNames(); return super.getConfigNames(); } @@ -236,10 +236,10 @@ public class AuthInfoAccessExtDefault extends EnrollExtDefault { for (int i = 0; i < size; i++) { NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration names = nvps.getNames(); + Enumeration<String> names = nvps.getNames(); while (names.hasMoreElements()) { - String name1 = (String) names.nextElement(); + String name1 = names.nextElement(); if (name1.equals(AD_METHOD)) { method = nvps.getValue(name1); diff --git a/pki/base/common/src/com/netscape/cms/profile/def/ExtendedKeyUsageExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/ExtendedKeyUsageExtDefault.java index 15dec5412..f1d63a348 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/ExtendedKeyUsageExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/ExtendedKeyUsageExtDefault.java @@ -187,11 +187,10 @@ public class ExtendedKeyUsageExtDefault extends EnrollExtDefault { if (ext == null) { return ""; } - Enumeration e = ext.getOIDs(); + Enumeration<ObjectIdentifier> e = ext.getOIDs(); while (e.hasMoreElements()) { - ObjectIdentifier oid = (ObjectIdentifier) - e.nextElement(); + ObjectIdentifier oid = e.nextElement(); if (!sb.toString().equals("")) { sb.append(","); diff --git a/pki/base/common/src/com/netscape/cms/profile/def/NoDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/NoDefault.java index 8197d3de4..a58b18008 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/NoDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/NoDefault.java @@ -41,10 +41,10 @@ public class NoDefault implements IPolicyDefault { public static final String PROP_NAME = "name"; protected Vector mValues = new Vector(); - protected Vector mNames = new Vector(); + protected Vector<String> mNames = new Vector<String>(); protected IConfigStore mConfig = null; - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { return mNames.elements(); } diff --git a/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java b/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java index db3945785..c4269ba7d 100644 --- a/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java +++ b/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java @@ -51,8 +51,8 @@ public abstract class EnrollInput implements IProfileInput { "LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION_2"; protected IConfigStore mConfig = null; - protected Vector mValueNames = new Vector(); - protected Vector mConfigNames = new Vector(); + protected Vector<String> mValueNames = new Vector<String>(); + protected Vector<String> mConfigNames = new Vector<String>(); protected IProfile mProfile = null; protected ILogger mSignedAuditLogger = CMS.getSignedAuditLogger(); @@ -113,7 +113,7 @@ public abstract class EnrollInput implements IProfileInput { /** * Retrieves a list of names of the value parameter. */ - public Enumeration getValueNames() { + public Enumeration<String> getValueNames() { return mValueNames.elements(); } @@ -121,7 +121,7 @@ public abstract class EnrollInput implements IProfileInput { mConfigNames.addElement(name); } - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { return mConfigNames.elements(); } diff --git a/pki/base/common/src/com/netscape/cms/profile/input/GenericInput.java b/pki/base/common/src/com/netscape/cms/profile/input/GenericInput.java index 029e497f4..e8edfaa6d 100644 --- a/pki/base/common/src/com/netscape/cms/profile/input/GenericInput.java +++ b/pki/base/common/src/com/netscape/cms/profile/input/GenericInput.java @@ -94,8 +94,8 @@ public class GenericInput extends EnrollInput implements IProfileInput { /** * Returns selected value names based on the configuration. */ - public Enumeration getValueNames() { - Vector v = new Vector(); + public Enumeration<String> getValueNames() { + Vector<String> v = new Vector<String>(); int num = getNum(); for (int i = 0; i < num; i++) { String enable = getConfig(CONFIG_ENABLE + i); diff --git a/pki/base/common/src/com/netscape/cms/publish/publishers/LdapCertSubjPublisher.java b/pki/base/common/src/com/netscape/cms/publish/publishers/LdapCertSubjPublisher.java index e2c41a591..fed865122 100644 --- a/pki/base/common/src/com/netscape/cms/publish/publishers/LdapCertSubjPublisher.java +++ b/pki/base/common/src/com/netscape/cms/publish/publishers/LdapCertSubjPublisher.java @@ -254,11 +254,12 @@ public class LdapCertSubjPublisher implements ILdapPublisher { if (certs != null) { hasCert = LdapUserCertPublisher.ByteValueExists(certs, certEnc); // check for other certs with the same subject name - Enumeration vals = certs.getByteValues(); + @SuppressWarnings("unchecked") + Enumeration<byte[]> vals = certs.getByteValues(); byte[] val = null; while (vals.hasMoreElements()) { - val = (byte[]) vals.nextElement(); + val = vals.nextElement(); if (Utils.byteArraysAreEqual(certEnc, val)) { hasCert = true; continue; diff --git a/pki/base/common/src/com/netscape/cms/publish/publishers/LdapUserCertPublisher.java b/pki/base/common/src/com/netscape/cms/publish/publishers/LdapUserCertPublisher.java index 8c74382a7..afa0601dc 100644 --- a/pki/base/common/src/com/netscape/cms/publish/publishers/LdapUserCertPublisher.java +++ b/pki/base/common/src/com/netscape/cms/publish/publishers/LdapUserCertPublisher.java @@ -295,11 +295,12 @@ public class LdapUserCertPublisher implements ILdapPublisher, IExtendedPluginInf if (attr == null) { return false; } - Enumeration vals = attr.getByteValues(); + @SuppressWarnings("unchecked") + Enumeration<byte[]> vals = attr.getByteValues(); byte[] val = null; while (vals.hasMoreElements()) { - val = (byte[]) vals.nextElement(); + val = vals.nextElement(); if (val.length == 0) continue; if (Utils.byteArraysAreEqual(val, bval)) { @@ -316,11 +317,12 @@ public class LdapUserCertPublisher implements ILdapPublisher, IExtendedPluginInf if (attr == null) { return false; } - Enumeration vals = attr.getStringValues(); + @SuppressWarnings("unchecked") + Enumeration<String> vals = attr.getStringValues(); String val = null; while (vals.hasMoreElements()) { - val = (String) vals.nextElement(); + val = vals.nextElement(); if (val.equalsIgnoreCase(sval)) { return true; } 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<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 @@ -793,11 +794,11 @@ public class AdminServlet extends HttpServlet { StringBuffer buf = new StringBuffer(); if (params != null) { - Enumeration e = params.getNames(); + Enumeration<String> 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<String> 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<String> 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<String> 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<String> 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<IGroup> 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<String, Object> authCreds = null; // Inserted by bskim private IArgBlock argblk = null; // Insert end public AuthCredentials() { - authCreds = new Hashtable(); + authCreds = new Hashtable<String, Object>(); } /** @@ -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<Object> 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<String> 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<String> 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<String> 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<String> 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<ICRLIssuingPoint> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<ICRLIssuingPoint> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<IJob> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> policyImplNames = mProcessor.getPolicyImplsInfo(); + Enumeration<IPolicyRule> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String, String> ht = new Hashtable<String, String>(); 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<String> 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<String> 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<String, String> ht = new Hashtable<String, String>(); 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<String> 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<String> 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<Integer, String> 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<Integer, String>(); 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<Integer> 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<IAuthManager> 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<String> 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<ICertRecord> 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<ICertRecord> 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<ICRLIssuingPoint> 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<ICRLIssuingPoint> 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<ICRLIssuingPoint> 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<String> 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<ICRLIssuingPoint> 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<Object> 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<ICertRecord> 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<ICertRecord> 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<ICertRecord> 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<String, Object> authCreds = null; // Inserted by bskim private IArgBlock argblk = null; // Insert end public AuthCredentials() { - authCreds = new Hashtable(); + authCreds = new Hashtable<String, Object>(); } /** @@ -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<Object> 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<String, CMSFile> mLoadedFiles = new Hashtable<String, CMSFile>(); // 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<CMSFile> 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<String> 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<String> 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<String>(); mErrorDescr.addElement(descr); } @@ -215,7 +215,7 @@ public class CMSRequest { return mError; } - public Vector getErrorDescr() { + public Vector<String> 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<String> descr = cmsReq.getErrorDescr(); if (descr != null) { - Enumeration num = descr.elements(); + Enumeration<String> 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<String> messages = req.getExtDataInStringVector(IRequest.ERRORS); if (messages != null) { - Enumeration msgs = messages.elements(); + Enumeration<String> 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<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) 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<String, Object> 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<Credential> dc = ((IKeyRecoveryAuthority) mService).getAppAgents(recoveryID); + Enumeration<Credential> 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<String> 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<String> 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<String> 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<String> 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<String> 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<ProfilePolicy> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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("<set>"); - Enumeration names = set.getNames(); + Enumeration<String> names = set.getNames(); while (names.hasMoreElements()) { - String n = (String) names.nextElement(); + String n = names.nextElement(); outputArgValueAsXML(ps, n, set.get(n)); } ps.println("</set>"); @@ -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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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); 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 c4b14dc10..6604fea5b 100644 --- a/pki/base/common/src/com/netscape/cmscore/apps/CommandQueue.java +++ b/pki/base/common/src/com/netscape/cmscore/apps/CommandQueue.java @@ -17,6 +17,7 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.apps; +import java.util.Enumeration; import java.util.Hashtable; import javax.servlet.Servlet; @@ -82,7 +83,7 @@ public class CommandQueue implements Runnable, ICommandQueue { } public void unRegisterProccess(Object currentRequest, Object currentServlet) { - java.util.Enumeration e = mCommandQueue.keys(); + Enumeration<CMSRequest> e = mCommandQueue.keys(); while (e.hasMoreElements()) { Object thisRequest = e.nextElement(); diff --git a/pki/base/common/src/com/netscape/cmscore/base/FileConfigStore.java b/pki/base/common/src/com/netscape/cmscore/base/FileConfigStore.java index 8aac76e70..f0c52866e 100644 --- a/pki/base/common/src/com/netscape/cmscore/base/FileConfigStore.java +++ b/pki/base/common/src/com/netscape/cmscore/base/FileConfigStore.java @@ -172,8 +172,8 @@ public class FileConfigStore extends PropConfigStore implements String name) throws EBaseException, IOException { // print keys - Enumeration e0 = store.getPropertyNames(); - Vector v = new Vector(); + Enumeration<String> e0 = store.getPropertyNames(); + Vector<String> v = new Vector<String>(); while (e0.hasMoreElements()) { v.addElement(e0.nextElement()); @@ -197,7 +197,7 @@ public class FileConfigStore extends PropConfigStore implements } // print substores - Enumeration e1 = store.getSubStoreNames(); + Enumeration<String> e1 = store.getSubStoreNames(); while (e1.hasMoreElements()) { v.addElement(e1.nextElement()); diff --git a/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java b/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java index d587a81f5..1f453a573 100644 --- a/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java +++ b/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java @@ -170,8 +170,8 @@ public class PropConfigStore implements IConfigStore, Cloneable { * @see java.util.Hashtable#elements * @see java.util.Enumeration */ - public Enumeration keys() { - Hashtable h = new Hashtable(); + public Enumeration<String> keys() { + Hashtable<String, Object> h = new Hashtable<String, Object>(); enumerate(h); return h.keys(); @@ -182,8 +182,8 @@ public class PropConfigStore implements IConfigStore, Cloneable { * * @return hashtable */ - public Hashtable hashtable() { - Hashtable h = new Hashtable(); + public Hashtable<String, Object> hashtable() { + Hashtable<String, Object> h = new Hashtable<String, Object>(); enumerate(h); return h; @@ -193,7 +193,7 @@ public class PropConfigStore implements IConfigStore, Cloneable { * Return the number of items in this substore */ public int size() { - Hashtable h = new Hashtable(); + Hashtable<String, Object> h = new Hashtable<String, Object>(); enumerate(h); return h.size(); @@ -206,8 +206,8 @@ public class PropConfigStore implements IConfigStore, Cloneable { * * @param h the hashtable */ - private synchronized void enumerate(Hashtable h) { - Enumeration e = mSource.keys(); + private synchronized void enumerate(Hashtable<String, Object> h) { + Enumeration<String> e = mSource.keys(); // We only want the keys which match the current substore name // without the current substore prefix. This code works even // if mStoreName is null. @@ -215,7 +215,7 @@ public class PropConfigStore implements IConfigStore, Cloneable { int kIndex = fullName.length(); while (e.hasMoreElements()) { - String key = (String) e.nextElement(); + String key = e.nextElement(); if (key.startsWith(fullName)) { h.put(key.substring(kIndex), nakedGet(key)); @@ -589,10 +589,11 @@ public class PropConfigStore implements IConfigStore, Cloneable { * * @param name substore name */ + @SuppressWarnings("unchecked") public void removeSubStore(String name) { // this operation is expensive!!! - Enumeration e = mSource.keys(); + Enumeration<String> e = mSource.keys(); // We only want the keys which match the current substore name // without the current substore prefix. This code works even // if mStoreName is null. @@ -600,10 +601,10 @@ public class PropConfigStore implements IConfigStore, Cloneable { int kIndex = fullName.length(); while (e.hasMoreElements()) { - String key = (String) e.nextElement(); + String key = e.nextElement(); if (key.startsWith(fullName + ".")) { - ((Hashtable) mSource).remove(key); + ((Hashtable<String, String>) mSource).remove(key); } } } @@ -649,16 +650,16 @@ public class PropConfigStore implements IConfigStore, Cloneable { * * @return a list of string-based property names */ - public Enumeration getPropertyNames() { + public Enumeration<String> getPropertyNames() { // XXX - this operation is expensive!!! - Hashtable h = new Hashtable(); + Hashtable<String, Object> h = new Hashtable<String, Object>(); enumerate(h); - Enumeration e = h.keys(); - Vector v = new Vector(); + Enumeration<String> e = h.keys(); + Vector<String> v = new Vector<String>(); while (e.hasMoreElements()) { - String pname = (String) e.nextElement(); + String pname = e.nextElement(); int i = pname.indexOf('.'); // substores have "." if (i == -1) { @@ -678,16 +679,16 @@ public class PropConfigStore implements IConfigStore, Cloneable { * * @return list of substore names */ - public Enumeration getSubStoreNames() { + public Enumeration<String> getSubStoreNames() { // XXX - this operation is expensive!!! - Hashtable h = new Hashtable(); + Hashtable<String, Object> h = new Hashtable<String, Object>(); enumerate(h); - Enumeration e = h.keys(); - Vector v = new Vector(); + Enumeration<String> e = h.keys(); + Vector<String> v = new Vector<String>(); while (e.hasMoreElements()) { - String pname = (String) e.nextElement(); + String pname = e.nextElement(); int i = pname.indexOf('.'); // substores have "." if (i != -1) { @@ -717,10 +718,10 @@ public class PropConfigStore implements IConfigStore, Cloneable { * substore. */ public void printProperties() { - Enumeration keys = mSource.keys(); + Enumeration<String> keys = mSource.keys(); while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); + String key = keys.nextElement(); if (mStoreName == null) { System.out.println(key); @@ -762,10 +763,10 @@ public class PropConfigStore implements IConfigStore, Cloneable { subs.nextElement(); IConfigStore newSub = that.makeSubStore( sub.getName()); - Enumeration props = sub.getPropertyNames(); + Enumeration<String> props = sub.getPropertyNames(); while (props.hasMoreElements()) { - String n = (String) props.nextElement(); + String n = props.nextElement(); try { newSub.putString(n, diff --git a/pki/base/common/src/com/netscape/cmscore/cert/CrossCertPairSubsystem.java b/pki/base/common/src/com/netscape/cmscore/cert/CrossCertPairSubsystem.java index dbc0c607f..8d8a337c5 100644 --- a/pki/base/common/src/com/netscape/cmscore/cert/CrossCertPairSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/cert/CrossCertPairSubsystem.java @@ -204,7 +204,8 @@ public class CrossCertPairSubsystem implements ICrossCertPairSubsystem { return; } - Enumeration en = caCerts.getByteValues(); + @SuppressWarnings("unchecked") + Enumeration<byte[]> en = caCerts.getByteValues(); if ((en == null) || (en.hasMoreElements() == false)) { debug("1st potential xcert"); @@ -216,7 +217,7 @@ public class CrossCertPairSubsystem implements ICrossCertPairSubsystem { boolean match = false; while (en.hasMoreElements()) { - val = (byte[]) en.nextElement(); + val = en.nextElement(); debug("val =" + val.length); if (val.length == 0) { continue; @@ -332,11 +333,12 @@ public class CrossCertPairSubsystem implements ICrossCertPairSubsystem { if (attr == null) { return false; } - Enumeration vals = attr.getByteValues(); + @SuppressWarnings("unchecked") + Enumeration<byte[]> vals = attr.getByteValues(); byte[] val = null; while (vals.hasMoreElements()) { - val = (byte[]) vals.nextElement(); + val = vals.nextElement(); if (val.length == 0) continue; if (byteArraysAreEqual(val, bval)) { @@ -418,7 +420,8 @@ public class CrossCertPairSubsystem implements ICrossCertPairSubsystem { return; } - Enumeration en = xcerts.getByteValues(); + @SuppressWarnings("unchecked") + Enumeration<byte[]> en = xcerts.getByteValues(); if ((en == null) || (en.hasMoreElements() == false)) { debug("publishCertPair found no pairs in internal db"); @@ -427,7 +430,7 @@ public class CrossCertPairSubsystem implements ICrossCertPairSubsystem { byte[] val = null; while (en.hasMoreElements()) { - val = (byte[]) en.nextElement(); + val = en.nextElement(); debug("val =" + val.length); if (val.length == 0) { continue; diff --git a/pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java b/pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java index af72fee45..d7024f4ad 100644 --- a/pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java +++ b/pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java @@ -43,7 +43,7 @@ public class HttpPKIMessage implements IHttpPKIMessage { public String reqType = ""; public String reqId = ""; protected String reqStatus = ""; - protected Vector mNameVals = new Vector(); // sequence of name/vals. + protected Vector<Object> mNameVals = new Vector<Object>(); // sequence of name/vals. public HttpPKIMessage() { } @@ -94,6 +94,7 @@ public class HttpPKIMessage implements IHttpPKIMessage { /** * copy contents to request. */ + @SuppressWarnings("unchecked") public void toRequest(IRequest r) { // id, type and status // type had to have been set in instantiation. @@ -105,7 +106,7 @@ public class HttpPKIMessage implements IHttpPKIMessage { int len = RequestTransfer.getTransferAttributes(r).length; String key; Object value; - Enumeration enum1 = mNameVals.elements(); + Enumeration<Object> enum1 = mNameVals.elements(); while (enum1.hasMoreElements()) { key = (String) enum1.nextElement(); @@ -137,7 +138,7 @@ public class HttpPKIMessage implements IHttpPKIMessage { out.writeObject(reqStatus); if (Debug.ON) Debug.trace("read object req source status " + reqStatus); - Enumeration enum1 = mNameVals.elements(); + Enumeration<Object> enum1 = mNameVals.elements(); while (enum1.hasMoreElements()) { Object key = null; @@ -175,7 +176,7 @@ public class HttpPKIMessage implements IHttpPKIMessage { reqType = (String) in.readObject(); reqId = (String) in.readObject(); reqStatus = (String) in.readObject(); - mNameVals = new Vector(); + mNameVals = new Vector<Object>(); Object keyorval = null; try { diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/ByteArrayMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/ByteArrayMapper.java index a51905c79..38362f341 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/ByteArrayMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/ByteArrayMapper.java @@ -39,7 +39,7 @@ import com.netscape.certsrv.dbs.IDBObj; public class ByteArrayMapper implements IDBAttrMapper { private String mLdapName = null; - private Vector v = new Vector(); + private Vector<String> v = new Vector<String>(); /** * Constructs a byte array mapper. @@ -52,7 +52,7 @@ public class ByteArrayMapper implements IDBAttrMapper { /** * Lists a list of supported ldap attribute names. */ - public Enumeration getSupportedLDAPAttributeNames() { + public Enumeration<String> getSupportedLDAPAttributeNames() { return v.elements(); } diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/CRLIssuingPointRecord.java b/pki/base/common/src/com/netscape/cmscore/dbs/CRLIssuingPointRecord.java index df44797f1..9f0797d40 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/CRLIssuingPointRecord.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/CRLIssuingPointRecord.java @@ -56,7 +56,7 @@ public class CRLIssuingPointRecord implements ICRLIssuingPointRecord, IDBObj { protected Hashtable mUnrevokedCerts = null; protected Hashtable mExpiredCerts = null; protected byte mDeltaCRL[] = null; - protected static Vector mNames = new Vector(); + protected static Vector<String> mNames = new Vector<String>(); static { mNames.addElement(ATTR_ID); mNames.addElement(ATTR_CRL_NUMBER); @@ -197,11 +197,11 @@ public class CRLIssuingPointRecord implements ICRLIssuingPointRecord, IDBObj { throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTRIBUTE", name)); } - public Enumeration getElements() { + public Enumeration<String> getElements() { return mNames.elements(); } - public Enumeration getSerializableAttrNames() { + public Enumeration<String> getSerializableAttrNames() { return mNames.elements(); } diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/CertRecordMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/CertRecordMapper.java index 3f5895ade..f4074c213 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/CertRecordMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/CertRecordMapper.java @@ -49,8 +49,8 @@ public class CertRecordMapper implements IDBAttrMapper { mDB = db; } - public Enumeration getSupportedLDAPAttributeNames() { - Vector v = new Vector(); + public Enumeration<String> getSupportedLDAPAttributeNames() { + Vector<String> v = new Vector<String>(); v.addElement(CertDBSchema.LDAP_ATTR_CERT_RECORD_ID); return v.elements(); diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java b/pki/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java index 9ee5be524..8b29dec53 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java @@ -752,10 +752,10 @@ public class CertificateRepository extends Repository modifyCertificateRecord(id, mods); } - public Enumeration searchCertificates(String filter, int maxSize) + public Enumeration<Object> searchCertificates(String filter, int maxSize) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<Object> e = null; CMS.debug("searchCertificates filter " + filter + " maxSize " + maxSize); try { @@ -767,10 +767,10 @@ public class CertificateRepository extends Repository return e; } - public Enumeration searchCertificates(String filter, int maxSize, int timeLimit) + public Enumeration<Object> searchCertificates(String filter, int maxSize, int timeLimit) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<Object> e = null; CMS.debug("searchCertificateswith time limit filter " + filter); try { @@ -787,11 +787,11 @@ public class CertificateRepository extends Repository * * @deprecated replaced by <code>findCertificatesInList</code> */ - public Enumeration findCertRecs(String filter) + public Enumeration<Object> findCertRecs(String filter) throws EBaseException { CMS.debug("findCertRecs " + filter); IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<Object> e = null; try { e = s.search(getDN(), filter); } finally { @@ -801,13 +801,13 @@ public class CertificateRepository extends Repository return e; } - public Enumeration findCertRecs(String filter, String[] attrs) + public Enumeration<Object> findCertRecs(String filter, String[] attrs) throws EBaseException { CMS.debug("findCertRecs " + filter + "attrs " + Arrays.toString(attrs)); IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<Object> e = null; try { e = s.search(getDN(), filter, attrs); } finally { @@ -820,11 +820,11 @@ public class CertificateRepository extends Repository public Enumeration<X509CertImpl> findCertificates(String filter) throws EBaseException { - Enumeration e = findCertRecords(filter); + Enumeration<ICertRecord> e = findCertRecords(filter); Vector<X509CertImpl> v = new Vector<X509CertImpl>(); while (e.hasMoreElements()) { - CertRecord rec = (CertRecord) e.nextElement(); + ICertRecord rec = e.nextElement(); v.addElement(rec.getCertificate()); } @@ -837,10 +837,10 @@ public class CertificateRepository extends Repository * If you are going to process everything in the list, * use this. */ - public Enumeration findCertRecords(String filter) + public Enumeration<ICertRecord> findCertRecords(String filter) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; try { //e = s.search(getDN(), filter); @@ -1066,7 +1066,7 @@ public class CertificateRepository extends Repository list = findCertRecordsInList(filter, null, "serialno", 10); int size = list.getSize(); - Enumeration e = list.getCertRecords(0, size - 1); + Enumeration<ICertRecord> e = list.getCertRecords(0, size - 1); tab = new Hashtable<String, RenewableCertificateCollection>(); while (e.hasMoreElements()) { @@ -1134,7 +1134,7 @@ public class CertificateRepository extends Repository list = findCertRecordsInList(filter, null, "serialno", 10); int size = list.getSize(); - Enumeration e = list.getCertRecords(0, size - 1); + Enumeration<ICertRecord> e = list.getCertRecords(0, size - 1); Vector<X509CertImpl> v = new Vector<X509CertImpl>(); @@ -1161,7 +1161,7 @@ public class CertificateRepository extends Repository X509CertImpl certs[] = null; try { - Enumeration e = null; + Enumeration<ICertRecord> e = null; if (filter != null && filter.length() > 0) { //e = s.search(getDN(), filter); @@ -1197,10 +1197,10 @@ public class CertificateRepository extends Repository * @param from The starting point of the serial number range. * @param to The ending point of the serial number range. */ - public Enumeration<CertRecord> getValidCertificates(String from, String to) + public Enumeration<ICertRecord> getValidCertificates(String from, String to) throws EBaseException { IDBSSession s = mDBService.createSession(); - Vector<CertRecord> v = new Vector<CertRecord>(); + Vector<ICertRecord> v = new Vector<ICertRecord>(); try { @@ -1256,10 +1256,10 @@ public class CertificateRepository extends Repository /** * Retrives all valid certificates excluding ones already revoked. */ - public Enumeration getAllValidCertificates() + public Enumeration<ICertRecord> getAllValidCertificates() throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; try { Date now = CMS.getCurrentDate(); @@ -1293,10 +1293,10 @@ public class CertificateRepository extends Repository * @param from The starting point of the serial number range. * @param to The ending point of the serial number range. */ - public Enumeration getValidNotPublishedCertificates(String from, String to) + public Enumeration<ICertRecord> getValidNotPublishedCertificates(String from, String to) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; try { Date now = CMS.getCurrentDate(); @@ -1335,10 +1335,10 @@ public class CertificateRepository extends Repository * Retrives all valid not published certificates * excluding ones already revoked. */ - public Enumeration getAllValidNotPublishedCertificates() + public Enumeration<ICertRecord> getAllValidNotPublishedCertificates() throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; try { Date now = CMS.getCurrentDate(); @@ -1374,10 +1374,10 @@ public class CertificateRepository extends Repository * @param from The starting point of the serial number range. * @param to The ending point of the serial number range. */ - public Enumeration getExpiredCertificates(String from, String to) + public Enumeration<ICertRecord> getExpiredCertificates(String from, String to) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; try { Date now = CMS.getCurrentDate(); @@ -1409,10 +1409,10 @@ public class CertificateRepository extends Repository /** * Retrives all expired certificates. */ - public Enumeration getAllExpiredCertificates() + public Enumeration<ICertRecord> getAllExpiredCertificates() throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; try { Date now = CMS.getCurrentDate(); @@ -1441,10 +1441,10 @@ public class CertificateRepository extends Repository * @param from The starting point of the serial number range. * @param to The ending point of the serial number range. */ - public Enumeration getExpiredPublishedCertificates(String from, String to) + public Enumeration<ICertRecord> getExpiredPublishedCertificates(String from, String to) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; try { Date now = CMS.getCurrentDate(); @@ -1480,10 +1480,10 @@ public class CertificateRepository extends Repository /** * Retrives all expired publishedcertificates. */ - public Enumeration getAllExpiredPublishedCertificates() + public Enumeration<ICertRecord> getAllExpiredPublishedCertificates() throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; try { Date now = CMS.getCurrentDate(); @@ -1621,10 +1621,10 @@ public class CertificateRepository extends Repository * @param from The starting point of the serial number range. * @param to The ending point of the serial number range. */ - public Enumeration getRevokedCertificates(String from, String to) + public Enumeration<ICertRecord> getRevokedCertificates(String from, String to) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; try { String ldapfilter = "(&(" + CertRecord.ATTR_REVO_INFO + "=*)"; @@ -1653,10 +1653,10 @@ public class CertificateRepository extends Repository * Retrives all revoked certificates including ones already expired or * not yet valid. */ - public Enumeration getAllRevokedCertificates() + public Enumeration<ICertRecord> getAllRevokedCertificates() throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; // index is setup for this filter String ldapfilter = "(|(" + CertRecord.ATTR_CERT_STATUS + "=" + CertRecord.STATUS_REVOKED + ")(" + CertRecord.ATTR_CERT_STATUS + "=" + CertRecord.STATUS_REVOKED_EXPIRED + "))"; @@ -1682,10 +1682,10 @@ public class CertificateRepository extends Repository * @param from The starting point of the serial number range. * @param to The ending point of the serial number range. */ - public Enumeration getRevokedPublishedCertificates(String from, String to) + public Enumeration<ICertRecord> getRevokedPublishedCertificates(String from, String to) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; try { String ldapfilter = "(&(" + CertRecord.ATTR_REVO_INFO + "=*)"; @@ -1717,10 +1717,10 @@ public class CertificateRepository extends Repository * Retrives all revoked published certificates including ones * already expired or not yet valid. */ - public Enumeration getAllRevokedPublishedCertificates() + public Enumeration<ICertRecord> getAllRevokedPublishedCertificates() throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; // index is setup for this filter String ldapfilter = "(&(|(" + CertRecord.ATTR_CERT_STATUS + "=" + CertRecord.STATUS_REVOKED + ")(" + CertRecord.ATTR_CERT_STATUS + "=" + CertRecord.STATUS_REVOKED_EXPIRED + "))"; @@ -1746,10 +1746,10 @@ public class CertificateRepository extends Repository /** * Retrieves all revoked certificates that have not expired. */ - public Enumeration getRevokedCertificates(Date asOfDate) + public Enumeration<ICertRecord> getRevokedCertificates(Date asOfDate) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; try { @@ -1778,10 +1778,10 @@ public class CertificateRepository extends Repository /** * Retrives all revoked certificates excluing ones already expired. */ - public Enumeration getAllRevokedNonExpiredCertificates() + public Enumeration<ICertRecord> getAllRevokedNonExpiredCertificates() throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<ICertRecord> e = null; String ldapfilter = "(" + CertRecord.ATTR_CERT_STATUS + "=" + CertRecord.STATUS_REVOKED + ")"; // index is setup for this filter try { diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/DateArrayMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/DateArrayMapper.java index a2dfc9c01..20562404b 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/DateArrayMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/DateArrayMapper.java @@ -39,7 +39,7 @@ import com.netscape.certsrv.dbs.IDBObj; public class DateArrayMapper implements IDBAttrMapper { private String mLdapName = null; - private Vector v = new Vector(); + private Vector<String> v = new Vector<String>(); /** * Constructs a date array mapper. @@ -52,7 +52,7 @@ public class DateArrayMapper implements IDBAttrMapper { /** * Retrieves a list of support ldap attributes. */ - public Enumeration getSupportedLDAPAttributeNames() { + public Enumeration<String> getSupportedLDAPAttributeNames() { return v.elements(); } @@ -84,12 +84,12 @@ public class DateArrayMapper implements IDBAttrMapper { if (attr == null) return; - Enumeration e = attr.getStringValues(); - Vector v = new Vector(); + @SuppressWarnings("unchecked") + Enumeration<String> e = attr.getStringValues(); + Vector<Date> v = new Vector<Date>(); while (e.hasMoreElements()) { - v.addElement(DateMapper.dateFromDB((String) - e.nextElement())); + v.addElement(DateMapper.dateFromDB(e.nextElement())); } if (v.size() == 0) return; diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/DateMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/DateMapper.java index 58cd1bfee..a767758f6 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/DateMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/DateMapper.java @@ -41,7 +41,7 @@ import com.netscape.certsrv.dbs.IDBObj; public class DateMapper implements IDBAttrMapper { private String mLdapName = null; - private Vector v = new Vector(); + private Vector<String> v = new Vector<String>(); private static SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss'Z'"); @@ -56,7 +56,7 @@ public class DateMapper implements IDBAttrMapper { /** * Retrieves a list of ldap attribute names. */ - public Enumeration getSupportedLDAPAttributeNames() { + public Enumeration<String> getSupportedLDAPAttributeNames() { return v.elements(); } diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/IntegerMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/IntegerMapper.java index 8d9384927..8dc07e4d9 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/IntegerMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/IntegerMapper.java @@ -38,7 +38,7 @@ import com.netscape.certsrv.dbs.IDBObj; public class IntegerMapper implements IDBAttrMapper { private String mLdapName = null; - private Vector v = new Vector(); + private Vector<String> v = new Vector<String>(); /** * Constructs mapper to deal with Integer. @@ -51,7 +51,7 @@ public class IntegerMapper implements IDBAttrMapper { /** * Retrieves a list of supported ldap attributes. */ - public Enumeration getSupportedLDAPAttributeNames() { + public Enumeration<String> getSupportedLDAPAttributeNames() { return v.elements(); } diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRecord.java b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRecord.java index f42377fe2..8f2888715 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRecord.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRecord.java @@ -57,7 +57,7 @@ public class KeyRecord implements IDBObj, IKeyRecord { private Date mModifyTime = null; private String mArchivedBy = null; - protected static Vector mNames = new Vector(); + protected static Vector<String> mNames = new Vector<String>(); static { mNames.addElement(ATTR_STATE); mNames.addElement(ATTR_ID); @@ -179,14 +179,14 @@ public class KeyRecord implements IDBObj, IKeyRecord { * Retrieves an enumeration of attributes. * <P> */ - public Enumeration getElements() { + public Enumeration<String> getElements() { return mNames.elements(); } /** * Retrieves serializable attribute names. */ - public Enumeration getSerializableAttrNames() { + public Enumeration<String> getSerializableAttrNames() { return mNames.elements(); } diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRecordList.java b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRecordList.java index dd0c88a97..34e50c711 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRecordList.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRecordList.java @@ -34,12 +34,12 @@ import com.netscape.certsrv.dbs.keydb.IKeyRecordList; */ public class KeyRecordList implements IKeyRecordList { - private IDBVirtualList mVlist = null; + private IDBVirtualList<Object> mVlist = null; /** * Constructs a key list. */ - public KeyRecordList(IDBVirtualList vlist) { + public KeyRecordList(IDBVirtualList<Object> vlist) { mVlist = vlist; } @@ -62,7 +62,7 @@ public class KeyRecordList implements IKeyRecordList { } public IKeyRecord getKeyRecord(int i) { - KeyRecord record = (KeyRecord) mVlist.getElementAt(i); + IKeyRecord record = (IKeyRecord) mVlist.getElementAt(i); if (record == null) return null; @@ -73,12 +73,12 @@ public class KeyRecordList implements IKeyRecordList { /** * Retrieves requests. */ - public Enumeration getKeyRecords(int startidx, int endidx) + public Enumeration<IKeyRecord> getKeyRecords(int startidx, int endidx) throws EBaseException { - Vector entries = new Vector(); + Vector<IKeyRecord> entries = new Vector<IKeyRecord>(); for (int i = startidx; i <= endidx; i++) { - Object element = mVlist.getElementAt(i); + IKeyRecord element = (IKeyRecord) mVlist.getElementAt(i); if (element != null) { entries.addElement(element); diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRecordMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRecordMapper.java index 550cd15e7..1a6103492 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRecordMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRecordMapper.java @@ -50,8 +50,8 @@ public class KeyRecordMapper implements IDBAttrMapper { mDB = db; } - public Enumeration getSupportedLDAPAttributeNames() { - Vector v = new Vector(); + public Enumeration<String> getSupportedLDAPAttributeNames() { + Vector<String> v = new Vector<String>(); v.addElement(KeyDBSchema.LDAP_ATTR_KEY_RECORD_ID); return v.elements(); diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/KeyStateMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/KeyStateMapper.java index dc6aadff1..2622cdbc6 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/KeyStateMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/KeyStateMapper.java @@ -43,8 +43,8 @@ public class KeyStateMapper implements IDBAttrMapper { mLdapName = ldapName; } - public Enumeration getSupportedLDAPAttributeNames() { - Vector v = new Vector(); + public Enumeration<String> getSupportedLDAPAttributeNames() { + Vector<String> v = new Vector<String>(); v.addElement(mLdapName); return v.elements(); diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/LongMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/LongMapper.java index 2d2d539ed..b4d6c75d6 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/LongMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/LongMapper.java @@ -38,7 +38,7 @@ import com.netscape.certsrv.dbs.IDBObj; public class LongMapper implements IDBAttrMapper { private String mLdapName = null; - private Vector v = new Vector(); + private Vector<String> v = new Vector<String>(); /** * Constructs Long mapper. @@ -51,7 +51,7 @@ public class LongMapper implements IDBAttrMapper { /** * Returns a list of supported ldap attribute names. */ - public Enumeration getSupportedLDAPAttributeNames() { + public Enumeration<String> getSupportedLDAPAttributeNames() { return v.elements(); } diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/MetaInfoMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/MetaInfoMapper.java index f175c811a..9b224508c 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/MetaInfoMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/MetaInfoMapper.java @@ -48,7 +48,7 @@ public class MetaInfoMapper implements IDBAttrMapper { public static final String SEP = ":"; private String mLdapName = null; - private Vector v = new Vector(); + private Vector<String> v = new Vector<String>(); /** * Constructs a metainfo object. @@ -61,7 +61,7 @@ public class MetaInfoMapper implements IDBAttrMapper { /** * Returns a list of supported ldap attribute names. */ - public Enumeration getSupportedLDAPAttributeNames() { + public Enumeration<String> getSupportedLDAPAttributeNames() { return v.elements(); } @@ -72,7 +72,7 @@ public class MetaInfoMapper implements IDBAttrMapper { String name, Object obj, LDAPAttributeSet attrs) throws EBaseException { MetaInfo info = (MetaInfo) obj; - Enumeration e = info.getElements(); + Enumeration<String> e = info.getElements(); if (!e.hasMoreElements()) return; // dont add anything @@ -80,7 +80,7 @@ public class MetaInfoMapper implements IDBAttrMapper { while (e.hasMoreElements()) { String s = null; - String attrName = (String) e.nextElement(); + String attrName = e.nextElement(); String value = (String) info.get(attrName); s = attrName + SEP + value; @@ -99,11 +99,12 @@ public class MetaInfoMapper implements IDBAttrMapper { if (attr == null) return; - Enumeration values = attr.getStringValues(); + @SuppressWarnings("unchecked") + Enumeration<String> values = attr.getStringValues(); MetaInfo info = new MetaInfo(); while (values.hasMoreElements()) { - String s = (String) values.nextElement(); + String s = values.nextElement(); StringTokenizer st = new StringTokenizer(s, SEP); info.set(st.nextToken(), st.nextToken()); diff --git a/pki/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java b/pki/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java index 580658eaa..5af8e533d 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java +++ b/pki/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java @@ -350,7 +350,7 @@ class AttributeSet implements IAttrSet { * */ private static final long serialVersionUID = -3155846653754028803L; - Hashtable ht = new Hashtable(); + Hashtable<String, Object> ht = new Hashtable<String, Object>(); public AttributeSet() { } @@ -372,7 +372,7 @@ class AttributeSet implements IAttrSet { ht.put(name, ob); } - public Enumeration getElements() { + public Enumeration<Object> getElements() { return ht.elements(); } } diff --git a/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java b/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java index 325d2a0d3..97297de48 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java +++ b/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java @@ -188,10 +188,10 @@ public class LdapPublishModule implements ILdapPublishModule { System.out.println("No ldap publishing configurations."); return; } - Enumeration substores = types.getSubStoreNames(); + Enumeration<String> substores = types.getSubStoreNames(); while (substores.hasMoreElements()) { - String certType = (String) substores.nextElement(); + String certType = substores.nextElement(); IConfigStore current = types.getSubStore(certType); if (current == null || current.size() <= 0) { diff --git a/pki/base/common/src/com/netscape/cmscore/notification/EmailResolverKeys.java b/pki/base/common/src/com/netscape/cmscore/notification/EmailResolverKeys.java index 1cd8abd83..d0dedafa7 100644 --- a/pki/base/common/src/com/netscape/cmscore/notification/EmailResolverKeys.java +++ b/pki/base/common/src/com/netscape/cmscore/notification/EmailResolverKeys.java @@ -35,10 +35,10 @@ public class EmailResolverKeys implements IEmailResolverKeys { * */ private static final long serialVersionUID = -8823197350102151516L; - private Hashtable mKeys = null; + private Hashtable<String, Object> mKeys = null; public EmailResolverKeys() { - mKeys = new Hashtable(); + mKeys = new Hashtable<String, Object>(); } /** @@ -65,7 +65,7 @@ public class EmailResolverKeys implements IEmailResolverKeys { * @return the named email resolver key */ public Object get(String name) { - return ((Object) mKeys.get(name)); + return mKeys.get(name); } /** @@ -87,7 +87,7 @@ public class EmailResolverKeys implements IEmailResolverKeys { * @return an enumeration of the values in this key set * @see java.util.Enumeration */ - public Enumeration getElements() { - return (mKeys.elements()); + public Enumeration<Object> getElements() { + return mKeys.elements(); } } diff --git a/pki/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java b/pki/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java index ebdeba4ce..2386f6e0f 100644 --- a/pki/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java +++ b/pki/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java @@ -350,7 +350,7 @@ class AttributeSet implements IAttrSet { * */ private static final long serialVersionUID = -3985810281989018413L; - Hashtable ht = new Hashtable(); + Hashtable<String, Object> ht = new Hashtable<String, Object>(); public AttributeSet() { } @@ -372,7 +372,7 @@ class AttributeSet implements IAttrSet { ht.put(name, ob); } - public Enumeration getElements() { + public Enumeration<Object> getElements() { return ht.elements(); } } diff --git a/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java b/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java index c7f8c493a..4c25d6813 100644 --- a/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java +++ b/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java @@ -869,7 +869,7 @@ class ExtAttrDynMapper implements IDBDynAttrMapper { protected final static String extAttrPrefix = "extdata-"; - protected final static Vector mAttrs = new Vector(); + protected final static Vector<String> mAttrs = new Vector<String>(); static { mAttrs.add(Schema.LDAP_ATTR_EXT_ATTR); diff --git a/pki/base/common/src/com/netscape/cmscore/security/PWsdrCache.java b/pki/base/common/src/com/netscape/cmscore/security/PWsdrCache.java index 3d57c6276..e0fe0252d 100644 --- a/pki/base/common/src/com/netscape/cmscore/security/PWsdrCache.java +++ b/pki/base/common/src/com/netscape/cmscore/security/PWsdrCache.java @@ -217,20 +217,20 @@ public class PWsdrCache { } public void addEntry(String tag, String pwd) throws EBaseException { - addEntry(tag, pwd, (Hashtable) null); + addEntry(tag, pwd, (Hashtable<String, String>) null); } /* * Store passwd in pwcache. */ - public void addEntry(Hashtable ht) throws EBaseException { + public void addEntry(Hashtable<String, String> ht) throws EBaseException { addEntry((String) null, (String) null, ht); } /* * add passwd in pwcache. */ - public void addEntry(String tag, String pwd, Hashtable tagPwds) throws EBaseException { + public void addEntry(String tag, String pwd, Hashtable<String, String> tagPwds) throws EBaseException { String stringToAdd = null; String bufs = null; @@ -238,11 +238,11 @@ public class PWsdrCache { if (tagPwds == null) { stringToAdd = tag + ":" + pwd + "\n"; } else { - Enumeration enum1 = tagPwds.keys(); + Enumeration<String> enum1 = tagPwds.keys(); while (enum1.hasMoreElements()) { - tag = (String) enum1.nextElement(); - pwd = (String) tagPwds.get(tag); + tag = enum1.nextElement(); + pwd = tagPwds.get(tag); debug("password tag: " + tag + " stored in " + mPWcachedb); if (stringToAdd == null) { @@ -435,13 +435,13 @@ public class PWsdrCache { } } - public String hashtable2String(Hashtable ht) { - Enumeration enum1 = ht.keys(); + public String hashtable2String(Hashtable<String, String> ht) { + Enumeration<String> enum1 = ht.keys(); String returnString = null; while (enum1.hasMoreElements()) { - String tag = (String) enum1.nextElement(); - String pwd = (String) ht.get(tag); + String tag = enum1.nextElement(); + String pwd = ht.get(tag); if (returnString == null) { returnString = tag + ":" + pwd + "\n"; @@ -452,8 +452,8 @@ public class PWsdrCache { return returnString; } - public Hashtable string2Hashtable(String cache) { - Hashtable ht = new Hashtable(); + public Hashtable<String, String> string2Hashtable(String cache) { + Hashtable<String, String> ht = new Hashtable<String, String>(); // first, break into lines StringTokenizer st = new StringTokenizer(cache, "\n"); diff --git a/pki/base/common/test/com/netscape/certsrv/request/AgentApprovalsTest.java b/pki/base/common/test/com/netscape/certsrv/request/AgentApprovalsTest.java index 0cd27840d..8770dca2b 100644 --- a/pki/base/common/test/com/netscape/certsrv/request/AgentApprovalsTest.java +++ b/pki/base/common/test/com/netscape/certsrv/request/AgentApprovalsTest.java @@ -34,7 +34,7 @@ public class AgentApprovalsTest extends CMSBaseTestCase { agentApprovals.mVector.add(approval2); agentApprovals.mVector.add(approval3); - Vector stringVector = agentApprovals.toStringVector(); + Vector<String> stringVector = agentApprovals.toStringVector(); assertNotNull(stringVector); assertEquals(3, stringVector.size()); assertEquals(approval1.getDate().getTime() + ";" + approval1.getUserName(), diff --git a/pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryTest.java b/pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryTest.java index b76cfd78c..c74f66ba1 100644 --- a/pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryTest.java +++ b/pki/base/common/test/com/netscape/cmscore/dbs/DBRegistryTest.java @@ -168,7 +168,7 @@ class RequestRecordStub extends RequestRecordDefaultStub { return "foo"; } - public Enumeration getSerializableAttrNames() { + public Enumeration<String> getSerializableAttrNames() { getSerializedAttrNamesCalled = true; return Collections.enumeration(Arrays.asList(attrs)); } diff --git a/pki/base/common/test/com/netscape/cmscore/request/DBDynAttrMapperDefaultStub.java b/pki/base/common/test/com/netscape/cmscore/request/DBDynAttrMapperDefaultStub.java index 6f3bf7fe3..cccbe600f 100644 --- a/pki/base/common/test/com/netscape/cmscore/request/DBDynAttrMapperDefaultStub.java +++ b/pki/base/common/test/com/netscape/cmscore/request/DBDynAttrMapperDefaultStub.java @@ -16,7 +16,7 @@ public class DBDynAttrMapperDefaultStub implements IDBDynAttrMapper { return false; } - public Enumeration getSupportedLDAPAttributeNames() { + public Enumeration<String> getSupportedLDAPAttributeNames() { return null; } diff --git a/pki/base/java-tools/src/com/netscape/cmstools/PasswordCache.java b/pki/base/java-tools/src/com/netscape/cmstools/PasswordCache.java index ae0af3d44..470e06cf9 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/PasswordCache.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/PasswordCache.java @@ -431,20 +431,20 @@ class PWsdrCache { } public void addEntry(String tag, String pwd) throws IOException { - addEntry(tag, pwd, (Hashtable) null); + addEntry(tag, pwd, (Hashtable<String, String>) null); } /* * Store passwd in pwcache. */ - public void addEntry(Hashtable ht) throws IOException { + public void addEntry(Hashtable<String, String> ht) throws IOException { addEntry((String) null, (String) null, ht); } /* * add passwd in pwcache. */ - public void addEntry(String tag, String pwd, Hashtable tagPwds) throws IOException { + public void addEntry(String tag, String pwd, Hashtable<String, String> tagPwds) throws IOException { System.out.println("PWsdrCache: in addEntry"); String stringToAdd = null; String bufs = null; @@ -452,11 +452,11 @@ class PWsdrCache { if (tagPwds == null) { stringToAdd = tag + ":" + pwd + "\n"; } else { - Enumeration enum1 = tagPwds.keys(); + Enumeration<String> enum1 = tagPwds.keys(); while (enum1.hasMoreElements()) { - tag = (String) enum1.nextElement(); - pwd = (String) tagPwds.get(tag); + tag = enum1.nextElement(); + pwd = tagPwds.get(tag); debug("password tag: " + tag + " stored in " + mPWcachedb); if (stringToAdd == null) { @@ -472,7 +472,7 @@ class PWsdrCache { if (dcrypts != null) { // converts to Hashtable, replace if tag exists, add // if tag doesn't exist - Hashtable ht = string2Hashtable(dcrypts); + Hashtable<String, String> ht = string2Hashtable(dcrypts); if (ht.containsKey(tag) == false) { debug("adding new tag: " + tag); @@ -502,7 +502,7 @@ class PWsdrCache { if (dcrypts != null) { // converts to Hashtable, replace if tag exists, add // if tag doesn't exist - Hashtable ht = string2Hashtable(dcrypts); + Hashtable<String, String> ht = string2Hashtable(dcrypts); if (ht.containsKey(tag) == false) { debug("tag: " + tag + " does not exist"); @@ -673,13 +673,13 @@ class PWsdrCache { } } - public String hashtable2String(Hashtable ht) { - Enumeration enum1 = ht.keys(); + public String hashtable2String(Hashtable<String, String> ht) { + Enumeration<String> enum1 = ht.keys(); String returnString = null; while (enum1.hasMoreElements()) { - String tag = (String) enum1.nextElement(); - String pwd = (String) ht.get(tag); + String tag = enum1.nextElement(); + String pwd = ht.get(tag); if (returnString == null) { returnString = tag + ":" + pwd + "\n"; @@ -690,8 +690,8 @@ class PWsdrCache { return returnString; } - public Hashtable string2Hashtable(String cache) { - Hashtable ht = new Hashtable(); + public Hashtable<String, String> string2Hashtable(String cache) { + Hashtable<String, String> ht = new Hashtable<String, String>(); // first, break into lines StringTokenizer st = new StringTokenizer(cache, "\n"); @@ -727,7 +727,7 @@ class PWsdrCache { * if tag not found, return null, which will cause it to give up */ public Password getEntry(String tag) { - Hashtable pwTable = null; + Hashtable<String, String> pwTable = null; String pw = null; debug("in getEntry, tag=" + tag); diff --git a/pki/base/ocsp/src/com/netscape/ocsp/OCSPAuthority.java b/pki/base/ocsp/src/com/netscape/ocsp/OCSPAuthority.java index c4d77c783..91763ed83 100644 --- a/pki/base/ocsp/src/com/netscape/ocsp/OCSPAuthority.java +++ b/pki/base/ocsp/src/com/netscape/ocsp/OCSPAuthority.java @@ -140,7 +140,7 @@ public class OCSPAuthority implements IOCSPAuthority, IOCSPService, ISubsystem, } IConfigStore storeConfig = mConfig.getSubStore(PROP_STORE); - Enumeration ids = storeConfig.getSubStoreNames(); + Enumeration<String> ids = storeConfig.getSubStoreNames(); while (ids.hasMoreElements()) { String id = (String) ids.nextElement(); diff --git a/pki/base/util/src/com/netscape/cmsutil/http/HttpMessage.java b/pki/base/util/src/com/netscape/cmsutil/http/HttpMessage.java index 100cbb5af..badec5930 100644 --- a/pki/base/util/src/com/netscape/cmsutil/http/HttpMessage.java +++ b/pki/base/util/src/com/netscape/cmsutil/http/HttpMessage.java @@ -30,14 +30,14 @@ import java.util.Hashtable; */ public class HttpMessage { protected String mLine = null; // request or response line. - protected Hashtable mHeaders = null; + protected Hashtable<String, String> mHeaders = null; protected String mContent = null; // arbitrary content chars assumed. /** * Instantiate a HttpResponse for write to http client. */ public HttpMessage() { - mHeaders = new Hashtable(); + mHeaders = new Hashtable<String, String>(); } /** @@ -48,7 +48,7 @@ public class HttpMessage { */ public void setHeader(String name, String value) { if (mHeaders == null) - mHeaders = new Hashtable(); + mHeaders = new Hashtable<String, String>(); mHeaders.put(name.toLowerCase(), value); } @@ -66,12 +66,12 @@ public class HttpMessage { public void writeHeaders(OutputStreamWriter writer) throws IOException { if (mHeaders != null) { - Enumeration keys = mHeaders.keys(); + Enumeration<String> keys = mHeaders.keys(); String header, value; while (keys.hasMoreElements()) { - header = (String) keys.nextElement(); - value = (String) mHeaders.get(header); + header = keys.nextElement(); + value = mHeaders.get(header); writer.write(header + ":" + value + Http.CRLF); } } @@ -84,7 +84,7 @@ public class HttpMessage { */ public void readHeaders(BufferedReader reader) throws IOException { - mHeaders = new Hashtable(); + mHeaders = new Hashtable<String, String>(); int colon; String line, key, value; @@ -129,7 +129,7 @@ public class HttpMessage { readHeaders(reader); // won't work if content length is not set. - String lenstr = (String) mHeaders.get("content-length"); + String lenstr = mHeaders.get("content-length"); if (lenstr != null) { int len = Integer.parseInt(lenstr); diff --git a/pki/base/util/src/com/netscape/cmsutil/radius/AttributeSet.java b/pki/base/util/src/com/netscape/cmsutil/radius/AttributeSet.java index 46860de19..d6974d371 100644 --- a/pki/base/util/src/com/netscape/cmsutil/radius/AttributeSet.java +++ b/pki/base/util/src/com/netscape/cmsutil/radius/AttributeSet.java @@ -21,7 +21,7 @@ import java.util.Enumeration; import java.util.Vector; public class AttributeSet { - private Vector _attrs = new Vector(); + private Vector<Attribute> _attrs = new Vector<Attribute>(); public AttributeSet() { } @@ -34,7 +34,7 @@ public class AttributeSet { return _attrs.size(); } - public Enumeration getAttributes() { + public Enumeration<Attribute> getAttributes() { return _attrs.elements(); } @@ -51,6 +51,6 @@ public class AttributeSet { } public Attribute getAttributeAt(int pos) { - return (Attribute) _attrs.elementAt(pos); + return _attrs.elementAt(pos); } } diff --git a/pki/base/util/src/com/netscape/cmsutil/xml/XMLObject.java b/pki/base/util/src/com/netscape/cmsutil/xml/XMLObject.java index 8890d79fe..8317ad785 100644 --- a/pki/base/util/src/com/netscape/cmsutil/xml/XMLObject.java +++ b/pki/base/util/src/com/netscape/cmsutil/xml/XMLObject.java @@ -137,8 +137,8 @@ public class XMLObject { return v; } - public Vector getValuesFromContainer(Node container, String tagname) { - Vector v = new Vector(); + public Vector<String> getValuesFromContainer(Node container, String tagname) { + Vector<String> v = new Vector<String>(); NodeList c = container.getChildNodes(); int len = c.getLength(); for (int i = 0; i < len; i++) { diff --git a/pki/base/util/src/netscape/security/acl/GroupImpl.java b/pki/base/util/src/netscape/security/acl/GroupImpl.java index fc50714f8..ed087a544 100644 --- a/pki/base/util/src/netscape/security/acl/GroupImpl.java +++ b/pki/base/util/src/netscape/security/acl/GroupImpl.java @@ -28,7 +28,7 @@ import java.util.Vector; * @author Satish Dharmaraj */ public class GroupImpl implements Group { - private Vector groupMembers = new Vector(50, 100); + private Vector<Principal> groupMembers = new Vector<Principal>(50, 100); private String group; /** @@ -73,7 +73,7 @@ public class GroupImpl implements Group { /** * returns the enumeration of the members in the group. */ - public Enumeration members() { + public Enumeration<Principal> members() { return groupMembers.elements(); } @@ -118,7 +118,7 @@ public class GroupImpl implements Group { if (groupMembers.contains(member)) { return true; } else { - Vector alreadySeen = new Vector(10); + Vector<Group> alreadySeen = new Vector<Group>(10); return isMemberRecurse(member, alreadySeen); } } @@ -136,11 +136,11 @@ public class GroupImpl implements Group { // a vector of already seen groups. Only new groups are considered, // thereby avoiding loops. // - boolean isMemberRecurse(Principal member, Vector alreadySeen) { - Enumeration e = members(); + boolean isMemberRecurse(Principal member, Vector<Group> alreadySeen) { + Enumeration<Principal> e = members(); while (e.hasMoreElements()) { boolean mem = false; - Principal p = (Principal) e.nextElement(); + Principal p = e.nextElement(); // if the member is in this collection, return true if (p.equals(member)) { diff --git a/pki/base/util/src/netscape/security/pkcs/PKCS10Attributes.java b/pki/base/util/src/netscape/security/pkcs/PKCS10Attributes.java index 46b309cc7..8beb1e64c 100644 --- a/pki/base/util/src/netscape/security/pkcs/PKCS10Attributes.java +++ b/pki/base/util/src/netscape/security/pkcs/PKCS10Attributes.java @@ -35,19 +35,19 @@ import netscape.security.util.DerValue; * @author Hemma Prafullchandra * @version 1.10 */ -public class PKCS10Attributes extends Vector implements DerEncoder { +public class PKCS10Attributes extends Vector<PKCS10Attribute> implements DerEncoder { /** * */ private static final long serialVersionUID = 1362260612357629542L; - private Hashtable map; + private Hashtable<String, PKCS10Attribute> map; /** * Default constructor for the certificate attribute. */ public PKCS10Attributes() { - map = new Hashtable(); + map = new Hashtable<String, PKCS10Attribute>(); } /** @@ -59,7 +59,7 @@ public class PKCS10Attributes extends Vector implements DerEncoder { public PKCS10Attributes(DerInputStream in) throws IOException { - map = new Hashtable(); + map = new Hashtable<String, PKCS10Attribute>(); DerValue[] attrs = in.getSet(5, true); if (attrs != null) { @@ -107,41 +107,41 @@ public class PKCS10Attributes extends Vector implements DerEncoder { /** * Set the attribute value. */ - public void setAttribute(String name, Object obj) throws IOException { - map.put(name, obj); - addElement(obj); + public void setAttribute(String name, PKCS10Attribute attr) throws IOException { + map.put(name, attr); + addElement(attr); } /** * Get the attribute value. */ - public Object getAttribute(String name) throws IOException { - Object obj = map.get(name); + public PKCS10Attribute getAttribute(String name) throws IOException { + PKCS10Attribute attr = map.get(name); /* - if (obj == null) { + if (attr == null) { throw new IOException("No attribute found with name " + name); } */ - return (obj); + return (attr); } /** * Delete the attribute value. */ public void deleteAttribute(String name) throws IOException { - Object obj = map.get(name); - if (obj == null) { + PKCS10Attribute attr = map.get(name); + if (attr == null) { throw new IOException("No attribute found with name " + name); } map.remove(name); - removeElement(obj); + removeElement(attr); } /** * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration getElements() { - return (map.elements()); + public Enumeration<PKCS10Attribute> getElements() { + return map.elements(); } } diff --git a/pki/base/util/src/netscape/security/x509/Attribute.java b/pki/base/util/src/netscape/security/x509/Attribute.java index b026e30c3..11e22db10 100644 --- a/pki/base/util/src/netscape/security/x509/Attribute.java +++ b/pki/base/util/src/netscape/security/x509/Attribute.java @@ -64,7 +64,7 @@ public final class Attribute implements Serializable, DerEncoder { private static final long serialVersionUID = -931486084625476764L; //private variables ObjectIdentifier oid; - Vector valueSet = new Vector(); + Vector<String> valueSet = new Vector<String>(); transient protected X500NameAttrMap attrMap; //========== CONSTRUCTOR ================================== @@ -93,7 +93,7 @@ public final class Attribute implements Serializable, DerEncoder { * @param oid the object identifier of the attribute type * @param values String value vector */ - public Attribute(ObjectIdentifier oid, Vector values) + public Attribute(ObjectIdentifier oid, Vector<String> values) throws IOException { //pre-condition verification @@ -104,13 +104,9 @@ public final class Attribute implements Serializable, DerEncoder { this.oid = oid; //copy the value into the valueSet list - Enumeration vals = values.elements(); + Enumeration<String> vals = values.elements(); while (vals.hasMoreElements()) { - Object obj = vals.nextElement(); - if (obj instanceof String) - valueSet.addElement(obj); - else - throw new IOException("values vectore must consist of String object"); + valueSet.addElement(vals.nextElement()); } } @@ -120,7 +116,7 @@ public final class Attribute implements Serializable, DerEncoder { * @param oid attribute type string CN,OU,O,C,L,TITLE,ST,STREET,UID,MAIL,E,DC * @param values String value vector */ - public Attribute(String attr, Vector values) + public Attribute(String attr, Vector<String> values) throws IOException { //pre-condition verification @@ -143,13 +139,9 @@ public final class Attribute implements Serializable, DerEncoder { this.oid = id; //copy the value into the valueSet list - Enumeration vals = values.elements(); + Enumeration<String> vals = values.elements(); while (vals.hasMoreElements()) { - Object obj = vals.nextElement(); - if (obj instanceof String) - valueSet.addElement(obj); - else - throw new IOException("Values vectore must consist of String object"); + valueSet.addElement(vals.nextElement()); } } @@ -188,7 +180,7 @@ public final class Attribute implements Serializable, DerEncoder { * * @return Enumeration of values of this Attribute. */ - public Enumeration getValues() { + public Enumeration<String> getValues() { if (valueSet == null) return null; return valueSet.elements(); @@ -223,11 +215,11 @@ public final class Attribute implements Serializable, DerEncoder { public String toString() { String theoid = "Attribute: " + oid + "\n"; String values = "Values: "; - Enumeration n = valueSet.elements(); + Enumeration<String> n = valueSet.elements(); if (n.hasMoreElements()) { - values += (String) n.nextElement(); + values += n.nextElement(); while (n.hasMoreElements()) - values += "," + (String) n.nextElement(); + values += "," + n.nextElement(); } return theoid + values + "\n"; } @@ -260,9 +252,9 @@ public final class Attribute implements Serializable, DerEncoder { } //loop through all the values and encode - Enumeration vals = valueSet.elements(); + Enumeration<String> vals = valueSet.elements(); while (vals.hasMoreElements()) { - String val = (String) vals.nextElement(); + String val = vals.nextElement(); DerValue derobj = converter.getValue(val); derobj.encode(tmp); } |