diff options
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore')
24 files changed, 151 insertions, 144 deletions
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"); |