diff options
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore')
26 files changed, 122 insertions, 125 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/authentication/ChallengePhraseAuthentication.java b/pki/base/common/src/com/netscape/cmscore/authentication/ChallengePhraseAuthentication.java index 2f8a33faa..48f743ee3 100644 --- a/pki/base/common/src/com/netscape/cmscore/authentication/ChallengePhraseAuthentication.java +++ b/pki/base/common/src/com/netscape/cmscore/authentication/ChallengePhraseAuthentication.java @@ -22,8 +22,6 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Vector; -import netscape.security.x509.X509CertImpl; - import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.authentication.AuthToken; import com.netscape.certsrv.authentication.EAuthException; @@ -211,7 +209,6 @@ public class ChallengePhraseAuthentication implements IAuthManager { } */ - X509CertImpl[] certsToRevoke = null; BigInteger[] bigIntArray = null; // check challenge phrase against request 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 1f453a573..1cc0330c7 100644 --- a/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java +++ b/pki/base/common/src/com/netscape/cmscore/base/PropConfigStore.java @@ -335,8 +335,6 @@ public class PropConfigStore implements IConfigStore, Cloneable { throws EBaseException { String str = (String) get(name); - byte returnval; - if (str == null || str.length() == 0) { CMS.traceHashKey(mDebugType, getFullName(name), "<notpresent>", "<bytearray>"); @@ -598,7 +596,6 @@ public class PropConfigStore implements IConfigStore, Cloneable { // without the current substore prefix. This code works even // if mStoreName is null. String fullName = getFullName(name); - int kIndex = fullName.length(); while (e.hasMoreElements()) { String key = e.nextElement(); @@ -756,13 +753,14 @@ public class PropConfigStore implements IConfigStore, Cloneable { mStoreName = getName(); mSource = new SourceConfigStore(); - Enumeration subs = getSubStoreNames(); + Enumeration<String> subs = getSubStoreNames(); while (subs.hasMoreElements()) { - IConfigStore sub = (IConfigStore) - subs.nextElement(); - IConfigStore newSub = that.makeSubStore( - sub.getName()); + String name = subs.nextElement(); + + IConfigStore sub = getSubStore(name); + IConfigStore newSub = that.makeSubStore(sub.getName()); + Enumeration<String> props = sub.getPropertyNames(); while (props.hasMoreElements()) { diff --git a/pki/base/common/src/com/netscape/cmscore/cert/CertDateCompare.java b/pki/base/common/src/com/netscape/cmscore/cert/CertDateCompare.java index d8b298126..7078c3440 100644 --- a/pki/base/common/src/com/netscape/cmscore/cert/CertDateCompare.java +++ b/pki/base/common/src/com/netscape/cmscore/cert/CertDateCompare.java @@ -28,17 +28,17 @@ import netscape.security.x509.X509CertImpl; * @author kanda * @version $Revision$, $Date$ */ -public class CertDateCompare implements Comparator { +public class CertDateCompare implements Comparator<X509CertImpl> { public CertDateCompare() { } - public int compare(Object cert1, Object cert2) { + public int compare(X509CertImpl cert1, X509CertImpl cert2) { Date d1 = null; Date d2 = null; try { - d1 = ((X509CertImpl) cert1).getNotAfter(); - d2 = ((X509CertImpl) cert2).getNotAfter(); + d1 = cert1.getNotAfter(); + d2 = cert2.getNotAfter(); } catch (Exception e) { e.printStackTrace(); } diff --git a/pki/base/common/src/com/netscape/cmscore/cert/CertUtils.java b/pki/base/common/src/com/netscape/cmscore/cert/CertUtils.java index 12965a52e..a5c6fec90 100644 --- a/pki/base/common/src/com/netscape/cmscore/cert/CertUtils.java +++ b/pki/base/common/src/com/netscape/cmscore/cert/CertUtils.java @@ -1001,7 +1001,6 @@ public class CertUtils { public static boolean verifySystemCerts() { String auditMessage = null; IConfigStore config = CMS.getConfigStore(); - String certlsit = ""; boolean verifyResult = true; boolean r = true; /* the final return value */ try { diff --git a/pki/base/common/src/com/netscape/cmscore/cert/X500NameSubsystem.java b/pki/base/common/src/com/netscape/cmscore/cert/X500NameSubsystem.java index 89a229216..de5e233c9 100644 --- a/pki/base/common/src/com/netscape/cmscore/cert/X500NameSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/cert/X500NameSubsystem.java @@ -227,7 +227,7 @@ public class X500NameSubsystem implements ISubsystem { private static String BMPSTRING = "BMPString"; private static String UNIVERSALSTRING = "UniversalString"; private static String UFT8STRING = "UTF8String"; - private static Hashtable mDerStr2TagHash = new Hashtable(); + private static Hashtable<String, Byte> mDerStr2TagHash = new Hashtable<String, Byte>(); static { mDerStr2TagHash.put( @@ -249,7 +249,7 @@ public class X500NameSubsystem implements ISubsystem { private byte derStr2Tag(String s) { if (s == null || s.length() == 0) throw new IllegalArgumentException(); - Byte tag = (Byte) mDerStr2TagHash.get(s); + Byte tag = mDerStr2TagHash.get(s); if (tag == null) throw new IllegalArgumentException(); diff --git a/pki/base/common/src/com/netscape/cmscore/connector/LocalConnector.java b/pki/base/common/src/com/netscape/cmscore/connector/LocalConnector.java index 5898e3228..42c6636ce 100644 --- a/pki/base/common/src/com/netscape/cmscore/connector/LocalConnector.java +++ b/pki/base/common/src/com/netscape/cmscore/connector/LocalConnector.java @@ -39,7 +39,7 @@ public class LocalConnector implements IConnector { ILogger mLogger = CMS.getLogger(); ICertAuthority mSource = null; IAuthority mDest = null; - Hashtable mSourceReqs = new Hashtable(); + Hashtable<String, IRequest> mSourceReqs = new Hashtable<String, IRequest>(); public LocalConnector(ICertAuthority source, IAuthority dest) { mSource = source; @@ -184,7 +184,7 @@ public class LocalConnector implements IConnector { // are persistent before the servicing. // Please see stateEngine() function in // ARequestQueue.java for details. - r = (IRequest) mSourceReqs.get(rId); + r = mSourceReqs.get(rId); if (r != null) { if (r.getRequestStatus() != RequestStatus.SVC_PENDING) { mSource.log(ILogger.LL_FAILURE, 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 9f0797d40..0a3a46f14 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/CRLIssuingPointRecord.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/CRLIssuingPointRecord.java @@ -23,6 +23,8 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; +import netscape.security.x509.RevokedCertificate; + import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.IDBObj; @@ -51,10 +53,10 @@ public class CRLIssuingPointRecord implements ICRLIssuingPointRecord, IDBObj { protected String mFirstUnsaved = null; protected byte mCRL[] = null; protected byte mCACert[] = null; - protected Hashtable mCRLCache = null; - protected Hashtable mRevokedCerts = null; - protected Hashtable mUnrevokedCerts = null; - protected Hashtable mExpiredCerts = null; + protected Hashtable<BigInteger, RevokedCertificate> mCRLCache = null; + protected Hashtable<BigInteger, RevokedCertificate> mRevokedCerts = null; + protected Hashtable<BigInteger, RevokedCertificate> mUnrevokedCerts = null; + protected Hashtable<BigInteger, RevokedCertificate> mExpiredCerts = null; protected byte mDeltaCRL[] = null; protected static Vector<String> mNames = new Vector<String>(); static { @@ -106,7 +108,9 @@ public class CRLIssuingPointRecord implements ICRLIssuingPointRecord, IDBObj { */ public CRLIssuingPointRecord(String id, BigInteger crlNumber, Long crlSize, Date thisUpdate, Date nextUpdate, BigInteger deltaCRLNumber, Long deltaCRLSize, - Hashtable revokedCerts, Hashtable unrevokedCerts, Hashtable expiredCerts) { + Hashtable<BigInteger, RevokedCertificate> revokedCerts, + Hashtable<BigInteger, RevokedCertificate> unrevokedCerts, + Hashtable<BigInteger, RevokedCertificate> expiredCerts) { mId = id; mCRLNumber = crlNumber; mCRLSize = crlSize; @@ -121,6 +125,7 @@ public class CRLIssuingPointRecord implements ICRLIssuingPointRecord, IDBObj { mExpiredCerts = expiredCerts; } + @SuppressWarnings({ "unchecked" }) public void set(String name, Object obj) throws EBaseException { if (name.equalsIgnoreCase(ATTR_ID)) { mId = (String) obj; @@ -143,13 +148,13 @@ public class CRLIssuingPointRecord implements ICRLIssuingPointRecord, IDBObj { } else if (name.equalsIgnoreCase(ATTR_CA_CERT)) { mCACert = (byte[]) obj; } else if (name.equalsIgnoreCase(ATTR_CRL_CACHE)) { - mCRLCache = (Hashtable) obj; + mCRLCache = (Hashtable<BigInteger, RevokedCertificate>) obj; } else if (name.equalsIgnoreCase(ATTR_REVOKED_CERTS)) { - mRevokedCerts = (Hashtable) obj; + mRevokedCerts = (Hashtable<BigInteger, RevokedCertificate>) obj; } else if (name.equalsIgnoreCase(ATTR_UNREVOKED_CERTS)) { - mUnrevokedCerts = (Hashtable) obj; + mUnrevokedCerts = (Hashtable<BigInteger, RevokedCertificate>) obj; } else if (name.equalsIgnoreCase(ATTR_EXPIRED_CERTS)) { - mExpiredCerts = (Hashtable) obj; + mExpiredCerts = (Hashtable<BigInteger, RevokedCertificate>) obj; } else if (name.equalsIgnoreCase(ATTR_DELTA_CRL)) { mDeltaCRL = (byte[]) obj; } else { @@ -279,47 +284,51 @@ public class CRLIssuingPointRecord implements ICRLIssuingPointRecord, IDBObj { return mCACert; } - public Hashtable getCRLCacheNoClone() { + public Hashtable<BigInteger, RevokedCertificate> getCRLCacheNoClone() { if (mCRLCache == null) return null; else - return (Hashtable) mCRLCache; + return mCRLCache; } - public Hashtable getCRLCache() { + @SuppressWarnings("unchecked") + public Hashtable<BigInteger, RevokedCertificate> getCRLCache() { if (mCRLCache == null) return null; else - return (Hashtable) mCRLCache.clone(); + return (Hashtable<BigInteger, RevokedCertificate>) mCRLCache.clone(); } /** * Retrieves cache info of revoked certificates. */ - public Hashtable getRevokedCerts() { + @SuppressWarnings("unchecked") + public Hashtable<BigInteger, RevokedCertificate> getRevokedCerts() { if (mRevokedCerts == null) return null; else - return (Hashtable) mRevokedCerts.clone(); + return (Hashtable<BigInteger, RevokedCertificate>) mRevokedCerts.clone(); } /** * Retrieves cache info of unrevoked certificates. */ - public Hashtable getUnrevokedCerts() { + @SuppressWarnings("unchecked") + public Hashtable<BigInteger, RevokedCertificate> getUnrevokedCerts() { if (mUnrevokedCerts == null) return null; else - return (Hashtable) mUnrevokedCerts.clone(); + return (Hashtable<BigInteger, RevokedCertificate>) mUnrevokedCerts.clone(); } /** * Retrieves cache info of expired certificates. */ - public Hashtable getExpiredCerts() { + @SuppressWarnings("unchecked") + public Hashtable<BigInteger, RevokedCertificate> getExpiredCerts() { if (mExpiredCerts == null) return null; else - return (Hashtable) mExpiredCerts.clone(); + return (Hashtable<BigInteger, RevokedCertificate>) mExpiredCerts.clone(); } } diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/CRLRepository.java b/pki/base/common/src/com/netscape/cmscore/dbs/CRLRepository.java index a54ff500f..f9c4369a2 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/CRLRepository.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/CRLRepository.java @@ -22,6 +22,8 @@ import java.util.Date; import java.util.Hashtable; import java.util.Vector; +import netscape.security.x509.RevokedCertificate; + import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.EDBException; @@ -230,7 +232,9 @@ public class CRLRepository extends Repository implements ICRLRepository { */ public void updateCRLIssuingPointRecord(String id, byte[] newCRL, Date thisUpdate, Date nextUpdate, BigInteger crlNumber, Long crlSize, - Hashtable revokedCerts, Hashtable unrevokedCerts, Hashtable expiredCerts) + Hashtable<BigInteger, RevokedCertificate> revokedCerts, + Hashtable<BigInteger, RevokedCertificate> unrevokedCerts, + Hashtable<BigInteger, RevokedCertificate> expiredCerts) throws EBaseException { ModificationSet mods = new ModificationSet(); @@ -270,8 +274,9 @@ public class CRLRepository extends Repository implements ICRLRepository { /** * Updates CRL issuing point record with recently revoked certificates info. */ - public void updateRevokedCerts(String id, Hashtable revokedCerts, - Hashtable unrevokedCerts) + public void updateRevokedCerts(String id, + Hashtable<BigInteger, RevokedCertificate> revokedCerts, + Hashtable<BigInteger, RevokedCertificate> unrevokedCerts) throws EBaseException { ModificationSet mods = new ModificationSet(); @@ -287,7 +292,7 @@ public class CRLRepository extends Repository implements ICRLRepository { /** * Updates CRL issuing point record with recently expired certificates info. */ - public void updateExpiredCerts(String id, Hashtable expiredCerts) + public void updateExpiredCerts(String id, Hashtable<BigInteger, RevokedCertificate> expiredCerts) throws EBaseException { ModificationSet mods = new ModificationSet(); @@ -300,9 +305,9 @@ public class CRLRepository extends Repository implements ICRLRepository { * Updates CRL issuing point record with CRL cache info. */ public void updateCRLCache(String id, Long crlSize, - Hashtable revokedCerts, - Hashtable unrevokedCerts, - Hashtable expiredCerts) + Hashtable<BigInteger, RevokedCertificate> revokedCerts, + Hashtable<BigInteger, RevokedCertificate> unrevokedCerts, + Hashtable<BigInteger, RevokedCertificate> expiredCerts) throws EBaseException { ModificationSet mods = new ModificationSet(); 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 8b29dec53..6ae379840 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java @@ -45,6 +45,7 @@ import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.dbs.EDBException; import com.netscape.certsrv.dbs.IDBRegistry; import com.netscape.certsrv.dbs.IDBSSession; +import com.netscape.certsrv.dbs.IDBSearchResults; import com.netscape.certsrv.dbs.IDBSubsystem; import com.netscape.certsrv.dbs.IDBVirtualList; import com.netscape.certsrv.dbs.Modification; @@ -450,9 +451,6 @@ public class CertificateRepository extends Repository } } - CertRecord cRec = null; - BigInteger serial = null; - transitCertList(cList, CertRecord.STATUS_EXPIRED); } @@ -622,7 +620,6 @@ public class CertificateRepository extends Repository */ public X509CertImpl getX509Certificate(BigInteger serialNo) throws EBaseException { - X509CertImpl cert = null; ICertRecord cr = readCertificateRecord(serialNo); return (cr.getCertificate()); @@ -767,19 +764,22 @@ public class CertificateRepository extends Repository return e; } - public Enumeration<Object> searchCertificates(String filter, int maxSize, int timeLimit) + public Enumeration<ICertRecord> searchCertificates(String filter, int maxSize, int timeLimit) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration<Object> e = null; + Vector<ICertRecord> v = new Vector<ICertRecord>(); CMS.debug("searchCertificateswith time limit filter " + filter); try { - e = s.search(getDN(), filter, maxSize, timeLimit); + IDBSearchResults sr = s.search(getDN(), filter, maxSize, timeLimit); + while (sr.hasMoreElements()) { + v.add((ICertRecord) sr.nextElement()); + } } finally { if (s != null) s.close(); } - return e; + return v.elements(); } /** @@ -894,7 +894,7 @@ public class CertificateRepository extends Repository CertRecordList list = null; try { - IDBVirtualList<ICertRecord> vlist = s.createVirtualList(getDN(), filter, attrs, + IDBVirtualList<ICertRecord> vlist = s.<ICertRecord>createVirtualList(getDN(), filter, attrs, sortKey, pageSize); list = new CertRecordList(vlist); @@ -1212,7 +1212,7 @@ public class CertificateRepository extends Repository String fromVal = "0"; try { if (from != null) { - int fv = Integer.parseInt(from); + Integer.parseInt(from); fromVal = from; } } catch (Exception e1) { @@ -1515,8 +1515,6 @@ public class CertificateRepository extends Repository public ICertRecordList getInvalidCertsByNotBeforeDate(Date date, int pageSize) throws EBaseException { - String now = null; - Date rightNow = CMS.getCurrentDate(); ICertRecordList list = null; @@ -1555,8 +1553,6 @@ public class CertificateRepository extends Repository public ICertRecordList getValidCertsByNotAfterDate(Date date, int pageSize) throws EBaseException { - String now = null; - ICertRecordList list = null; IDBSSession s = mDBService.createSession(); 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 34e50c711..941b0552d 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<Object> mVlist = null; + private IDBVirtualList<IKeyRecord> mVlist = null; /** * Constructs a key list. */ - public KeyRecordList(IDBVirtualList<Object> vlist) { + public KeyRecordList(IDBVirtualList<IKeyRecord> vlist) { mVlist = vlist; } @@ -62,7 +62,7 @@ public class KeyRecordList implements IKeyRecordList { } public IKeyRecord getKeyRecord(int i) { - IKeyRecord record = (IKeyRecord) mVlist.getElementAt(i); + IKeyRecord record = mVlist.getElementAt(i); if (record == null) return null; @@ -78,7 +78,7 @@ public class KeyRecordList implements IKeyRecordList { Vector<IKeyRecord> entries = new Vector<IKeyRecord>(); for (int i = startidx; i <= endidx; i++) { - IKeyRecord element = (IKeyRecord) mVlist.getElementAt(i); + IKeyRecord element = mVlist.getElementAt(i); if (element != null) { entries.addElement(element); diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java index 6219bab0c..3b2186b23 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java @@ -21,6 +21,7 @@ import java.math.BigInteger; import java.security.PublicKey; import java.util.Date; import java.util.Enumeration; +import java.util.Vector; import netscape.security.x509.X500Name; @@ -372,32 +373,38 @@ public class KeyRepository extends Repository implements IKeyRepository { return result; } - public Enumeration<Object> searchKeys(String filter, int maxSize) + public Enumeration<IKeyRecord> searchKeys(String filter, int maxSize) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration<Object> e = null; + Vector<IKeyRecord> v = new Vector<IKeyRecord>(); try { - e = s.search(getDN(), filter, maxSize); + IDBSearchResults sr = s.search(getDN(), filter, maxSize); + while (sr.hasMoreElements()) { + v.add((IKeyRecord) sr.nextElement()); + } } finally { if (s != null) s.close(); } - return e; + return v.elements(); } - public Enumeration<Object> searchKeys(String filter, int maxSize, int timeLimit) + public Enumeration<IKeyRecord> searchKeys(String filter, int maxSize, int timeLimit) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration<Object> e = null; + Vector<IKeyRecord> v = new Vector<IKeyRecord>(); try { - e = s.search(getDN(), filter, maxSize, timeLimit); + IDBSearchResults sr = s.search(getDN(), filter, maxSize, timeLimit); + while (sr.hasMoreElements()) { + v.add((IKeyRecord) sr.nextElement()); + } } finally { if (s != null) s.close(); } - return e; + return v.elements(); } /** @@ -418,7 +425,7 @@ public class KeyRepository extends Repository implements IKeyRepository { try { if (s != null) { list = new KeyRecordList( - s.createVirtualList(getDN(), "(&(objectclass=" + + s.<IKeyRecord>createVirtualList(getDN(), "(&(objectclass=" + KeyRecord.class.getName() + ")" + filter + ")", attrs, sortKey, pageSize)); } @@ -448,7 +455,7 @@ public class KeyRepository extends Repository implements IKeyRepository { try { if (s != null) { list = new KeyRecordList( - s.createVirtualList(getDN(), "(&(objectclass=" + + s.<IKeyRecord>createVirtualList(getDN(), "(&(objectclass=" + KeyRecord.class.getName() + ")" + filter + ")", attrs, jumpToVal, sortKey, pageSize)); } diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/LdapFilterConverter.java b/pki/base/common/src/com/netscape/cmscore/dbs/LdapFilterConverter.java index 74ac7ca96..ff867bf52 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/LdapFilterConverter.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/LdapFilterConverter.java @@ -34,12 +34,12 @@ import com.netscape.certsrv.dbs.IFilterConverter; */ public class LdapFilterConverter implements IFilterConverter { - private Hashtable mReg = null; + private Hashtable<String, IDBAttrMapper> mReg = null; /** * Constructs filter convertor. */ - public LdapFilterConverter(Hashtable reg) { + public LdapFilterConverter(Hashtable<String, IDBAttrMapper> reg) { mReg = reg; } diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/PublicKeyMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/PublicKeyMapper.java index f4d8cabeb..8b66d02ca 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/PublicKeyMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/PublicKeyMapper.java @@ -44,7 +44,7 @@ import com.netscape.cmscore.cert.CertUtils; public class PublicKeyMapper implements IDBAttrMapper { private String mLdapName = null; - private Vector v = new Vector(); + private Vector<String> v = new Vector<String>(); private ILogger mLogger = CMS.getLogger(); @@ -59,7 +59,7 @@ public class PublicKeyMapper implements IDBAttrMapper { /** * Lists a list of supported ldap attribute names. */ - public Enumeration getSupportedLDAPAttributeNames() { + public Enumeration<String> getSupportedLDAPAttributeNames() { return v.elements(); } @@ -95,7 +95,7 @@ public class PublicKeyMapper implements IDBAttrMapper { int i = value.indexOf("#"); if (i != -1) { - String tag = value.substring(0, i); + //String tag = value.substring(0, i); String val = value.substring(i + 1); try { diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/X509CertImplMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/X509CertImplMapper.java index 856a8c591..18f0c8e3d 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/X509CertImplMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/X509CertImplMapper.java @@ -31,7 +31,6 @@ import netscape.security.extensions.NSCertTypeExtension; import netscape.security.x509.BasicConstraintsExtension; import netscape.security.x509.Extension; import netscape.security.x509.X509CertImpl; -import netscape.security.x509.X509CertInfo; import netscape.security.x509.X509Key; import com.netscape.certsrv.apps.CMS; @@ -250,7 +249,6 @@ public class X509CertImplMapper implements IDBAttrMapper { // LDAPAttribute attr = attrs.getAttribute( // Schema.LDAP_ATTR_SIGNED_CERT); - X509CertInfo certinfo = new X509CertInfo(); LDAPAttribute attr = attrs.getAttribute( CertDBSchema.LDAP_ATTR_SIGNED_CERT); 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 97297de48..bbe86e8a5 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java +++ b/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java @@ -43,7 +43,6 @@ import com.netscape.certsrv.dbs.certdb.ICertificateRepository; import com.netscape.certsrv.ldap.ELdapException; import com.netscape.certsrv.ldap.ILdapConnFactory; import com.netscape.certsrv.logging.ILogger; -import com.netscape.certsrv.publish.ILdapCrlMapper; import com.netscape.certsrv.publish.ILdapMapper; import com.netscape.certsrv.publish.ILdapPlugin; import com.netscape.certsrv.publish.ILdapPublishModule; @@ -74,13 +73,13 @@ public class LdapPublishModule implements ILdapPublishModule { * to publish the crl. * When publishers are null, the certs are not published. */ - protected Hashtable mMappers = new Hashtable(); + protected Hashtable<String, LdapMappers> mMappers = new Hashtable<String, LdapMappers>(); /** * handlers for request types (events) * values implement IRequestListener */ - protected Hashtable mEventHandlers = new Hashtable(); + protected Hashtable<String, IRequestListener> mEventHandlers = new Hashtable<String, IRequestListener>(); /** * instantiate connection factory. @@ -274,9 +273,8 @@ public class LdapPublishModule implements ILdapPublishModule { public void accept(IRequest r) { String type = r.getRequestType(); - boolean error = false; - IRequestListener handler = (IRequestListener) mEventHandlers.get(type); + IRequestListener handler = mEventHandlers.get(type); if (handler == null) { CMS.debug( @@ -432,8 +430,6 @@ public class LdapPublishModule implements ILdapPublishModule { */ public void publish(X509CRLImpl crl) throws ELdapException { - ILdapCrlMapper mapper = null; - ILdapPublisher publisher = null; LdapMappers mappers = getMappers(PROP_TYPE_CRL); @@ -575,7 +571,6 @@ class HandleEnrollment implements IRequestListener { // publish Integer results[] = new Integer[certs.length]; - X509CertImpl cert; for (int i = 0; i < certs.length; i++) { try { diff --git a/pki/base/common/src/com/netscape/cmscore/ldap/LdapRequestListener.java b/pki/base/common/src/com/netscape/cmscore/ldap/LdapRequestListener.java index 2f6cadf68..cbeeed2df 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldap/LdapRequestListener.java +++ b/pki/base/common/src/com/netscape/cmscore/ldap/LdapRequestListener.java @@ -48,7 +48,7 @@ public class LdapRequestListener implements IRequestListener { * handlers for request types (events) * each handler implement IRequestListener */ - private Hashtable mRequestListeners = new Hashtable(); + private Hashtable<String, IRequestListener> mRequestListeners = new Hashtable<String, IRequestListener>(); private IPublisherProcessor mPublisherProcessor = null; @@ -151,7 +151,7 @@ public class LdapRequestListener implements IRequestListener { public void accept(IRequest r) { String type = r.getRequestType(); - IRequestListener handler = (IRequestListener) mRequestListeners.get(type); + IRequestListener handler = mRequestListeners.get(type); if (handler == null) { CMS.debug( diff --git a/pki/base/common/src/com/netscape/cmscore/ldapconn/LdapAuthInfo.java b/pki/base/common/src/com/netscape/cmscore/ldapconn/LdapAuthInfo.java index d2761e791..b1af367b9 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldapconn/LdapAuthInfo.java +++ b/pki/base/common/src/com/netscape/cmscore/ldapconn/LdapAuthInfo.java @@ -38,7 +38,7 @@ public class LdapAuthInfo implements ILdapAuthInfo { private boolean mInited = false; - private static Hashtable passwords = new Hashtable(); + private static Hashtable<String, String> passwords = new Hashtable<String, String>(); /** * must call init(config) after this constructor. @@ -148,7 +148,7 @@ public class LdapAuthInfo implements ILdapAuthInfo { if (mParms[1] == null) { CMS.debug("LdapAuthInfo: init: try getting from memory cache"); - mParms[1] = (String) passwords.get(prompt); + mParms[1] = passwords.get(prompt); if (mParms[1] != null) { inMem = true; CMS.debug("LdapAuthInfo: init: got password from memory"); diff --git a/pki/base/common/src/com/netscape/cmscore/listeners/ListenerPlugin.java b/pki/base/common/src/com/netscape/cmscore/listeners/ListenerPlugin.java index 720af4939..baedb98de 100644 --- a/pki/base/common/src/com/netscape/cmscore/listeners/ListenerPlugin.java +++ b/pki/base/common/src/com/netscape/cmscore/listeners/ListenerPlugin.java @@ -27,7 +27,7 @@ package com.netscape.cmscore.listeners; public class ListenerPlugin { protected String mId = null; protected String mClassPath = null; - protected Class mClass = null; + protected Class<?> mClass = null; /** * Constructs a Listener plugin. diff --git a/pki/base/common/src/com/netscape/cmscore/logging/Logger.java b/pki/base/common/src/com/netscape/cmscore/logging/Logger.java index 9c814e70c..79895e263 100644 --- a/pki/base/common/src/com/netscape/cmscore/logging/Logger.java +++ b/pki/base/common/src/com/netscape/cmscore/logging/Logger.java @@ -38,7 +38,7 @@ public class Logger implements ILogger { protected static Logger mLogger = new Logger(); protected ILogQueue mLogQueue = null; - protected Hashtable mFactories = new Hashtable(); + protected Hashtable<Integer, ILogEventFactory> mFactories = new Hashtable<Integer, ILogEventFactory>(); /** * Constructs a generic logger, and registers a list @@ -74,7 +74,7 @@ public class Logger implements ILogger { * @param f the event factory name */ public void register(int evtClass, ILogEventFactory f) { - mFactories.put(Integer.toString(evtClass), f); + mFactories.put(evtClass, f); } //************** default level **************** @@ -354,8 +354,7 @@ public class Logger implements ILogger { //XXXXXXXXXXX prop is out dated!!!! XXXXXXXXXXXXXXX public ILogEvent create(int evtClass, Properties prop, int source, int level, String msg, Object params[], boolean multiline) { - ILogEventFactory f = (ILogEventFactory) mFactories.get( - Integer.toString(evtClass)); + ILogEventFactory f = mFactories.get(evtClass); if (f == null) return null; diff --git a/pki/base/common/src/com/netscape/cmscore/request/ARequestQueue.java b/pki/base/common/src/com/netscape/cmscore/request/ARequestQueue.java index 6a5cb1abc..0e252f523 100644 --- a/pki/base/common/src/com/netscape/cmscore/request/ARequestQueue.java +++ b/pki/base/common/src/com/netscape/cmscore/request/ARequestQueue.java @@ -30,7 +30,6 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.Locale; -import java.util.Map; import java.util.Set; import java.util.Vector; diff --git a/pki/base/common/src/com/netscape/cmscore/request/RequestQueue.java b/pki/base/common/src/com/netscape/cmscore/request/RequestQueue.java index e78ff0daf..b23e6fff4 100644 --- a/pki/base/common/src/com/netscape/cmscore/request/RequestQueue.java +++ b/pki/base/common/src/com/netscape/cmscore/request/RequestQueue.java @@ -354,7 +354,7 @@ public class RequestQueue } - protected Enumeration getRawList() { + protected Enumeration<RequestId> getRawList() { IDBSearchResults results = null; IDBSSession dbs = null; @@ -517,7 +517,7 @@ public class RequestQueue public IRequestVirtualList getPagedRequestsByFilter(RequestId from, boolean jumpToEnd, String filter, int pageSize, String sortKey) { - IDBVirtualList results = null; + IDBVirtualList<Object> results = null; IDBSSession dbs = null; try { @@ -633,7 +633,7 @@ class SearchEnumeration return mResults.hasMoreElements(); } - public Object nextElement() { + public RequestId nextElement() { return nextRequestId(); } @@ -699,11 +699,11 @@ class ListEnumeration } - ListEnumeration(RequestQueue queue, IDBVirtualList list) { + ListEnumeration(RequestQueue queue, IDBVirtualList<Object> list) { mQueue = queue; mList = list; } protected RequestQueue mQueue; - protected IDBVirtualList mList; + protected IDBVirtualList<Object> mList; } diff --git a/pki/base/common/src/com/netscape/cmscore/request/RequestRepository.java b/pki/base/common/src/com/netscape/cmscore/request/RequestRepository.java index 92c162ca8..0a4a4ebf9 100644 --- a/pki/base/common/src/com/netscape/cmscore/request/RequestRepository.java +++ b/pki/base/common/src/com/netscape/cmscore/request/RequestRepository.java @@ -18,12 +18,12 @@ package com.netscape.cmscore.request; import java.math.BigInteger; -import java.util.Enumeration; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.EDBException; import com.netscape.certsrv.dbs.IDBSSession; +import com.netscape.certsrv.dbs.IDBSearchResults; import com.netscape.certsrv.dbs.IDBSubsystem; import com.netscape.certsrv.dbs.Modification; import com.netscape.certsrv.dbs.ModificationSet; @@ -109,10 +109,10 @@ class RequestRepository public void removeAllObjects() throws EBaseException { IDBSSession s = mDB.createSession(); try { - Enumeration e = s.search(getBaseDN(), + IDBSearchResults sr = s.search(getBaseDN(), "(" + RequestRecord.ATTR_REQUEST_ID + "=*)"); - while (e.hasMoreElements()) { - RequestRecord r = (RequestRecord) e.nextElement(); + while (sr.hasMoreElements()) { + RequestRecord r = (RequestRecord) sr.nextElement(); String name = "cn" + "=" + r.getRequestId().toString() + "," + getBaseDN(); s.delete(name); diff --git a/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java b/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java index a4f6ee9a0..b6aaa02cc 100644 --- a/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java @@ -1692,7 +1692,6 @@ public final class JssSubsystem implements ICryptoSubsystem { for (int i = 0; i < allcerts.length; i++) { try { X509CertImpl certImpl = new X509CertImpl(allcerts[i].getEncoded()); - String certIssuerName = certImpl.getSubjectDN().getName(); Principal certPrincipal = certImpl.getSubjectDN(); DN certdn = new DN(certPrincipal.getName()); BigInteger certSerialNo = certImpl.getSerialNumber(); 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 e0fe0252d..4142f6abe 100644 --- a/pki/base/common/src/com/netscape/cmscore/security/PWsdrCache.java +++ b/pki/base/common/src/com/netscape/cmscore/security/PWsdrCache.java @@ -17,7 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.security; -import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; @@ -258,7 +257,7 @@ public 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); @@ -288,7 +287,7 @@ public 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"); @@ -489,7 +488,7 @@ public 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); @@ -555,8 +554,6 @@ public class PWsdrCache { Process process = Runtime.getRuntime().exec(cmds); process.waitFor(); - BufferedReader pOut = null; - String l = null; if (process.exitValue() == 0) { @@ -604,7 +601,6 @@ public class PWsdrCache { * list passwds in pwcache. */ public boolean pprint() { - String bufs = null; String dcrypts = null; try { diff --git a/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java b/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java index 9167cbf11..6fac3d9d7 100644 --- a/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java @@ -82,9 +82,9 @@ public class SelfTestSubsystem private String mRootPrefix = null; private String mPrefix = null; - public Hashtable mSelfTestInstances = new Hashtable(); - public Vector mOnDemandOrder = new Vector(); - public Vector mStartupOrder = new Vector(); + public Hashtable<String, ISelfTest> mSelfTestInstances = new Hashtable<String, ISelfTest>(); + public Vector<SelfTestOrderedInstance> mOnDemandOrder = new Vector<SelfTestOrderedInstance>(); + public Vector<SelfTestOrderedInstance> mStartupOrder = new Vector<SelfTestOrderedInstance>(); /////////////////////////// // ISubsystem parameters // diff --git a/pki/base/common/src/com/netscape/cmscore/util/StatsSubsystem.java b/pki/base/common/src/com/netscape/cmscore/util/StatsSubsystem.java index 57eb53f2e..222964261 100644 --- a/pki/base/common/src/com/netscape/cmscore/util/StatsSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/util/StatsSubsystem.java @@ -41,7 +41,7 @@ public class StatsSubsystem implements IStatsSubsystem { private String mId = null; private StatsEvent mAllTrans = new StatsEvent(null); private Date mStartTime = new Date(); - private Hashtable mHashtable = new Hashtable(); + private Hashtable<String, Vector<StatsMilestone>> mHashtable = new Hashtable<String, Vector<StatsMilestone>>(); /** * Constructs a certificate server. @@ -90,11 +90,11 @@ public class StatsSubsystem implements IStatsSubsystem { public void startTiming(String id, boolean mainAction) { Thread t = Thread.currentThread(); - Vector milestones = null; + Vector<StatsMilestone> milestones = null; if (mHashtable.containsKey(t.toString())) { - milestones = (Vector) mHashtable.get(t.toString()); + milestones = mHashtable.get(t.toString()); } else { - milestones = new Vector(); + milestones = new Vector<StatsMilestone>(); mHashtable.put(t.toString(), milestones); } long startTime = CMS.getCurrentDate().getTime(); @@ -128,11 +128,11 @@ public class StatsSubsystem implements IStatsSubsystem { if (!mHashtable.containsKey(t.toString())) { return; /* error */ } - Vector milestones = (Vector) mHashtable.get(t.toString()); + Vector<StatsMilestone> milestones = mHashtable.get(t.toString()); if (milestones.size() == 0) { return; /* error */ } - StatsMilestone last = (StatsMilestone) milestones.remove(milestones.size() - 1); + StatsMilestone last = milestones.remove(milestones.size() - 1); StatsEvent st = last.getStatsEvent(); st.incNoOfOperations(1); st.incTimeTaken(endTime - last.getStartTime()); |