diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-02-06 15:44:34 -0600 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-02-14 16:32:25 -0600 |
commit | d5c6e6c69e678a79f9e8cd312e6007ad88026a36 (patch) | |
tree | 2e5934f2ff9aeb3b5014808799f2862ee262a723 /pki/base | |
parent | a4979af45554d97190180a038a4b438e3161d609 (diff) | |
download | pki-d5c6e6c69e678a79f9e8cd312e6007ad88026a36.tar.gz pki-d5c6e6c69e678a79f9e8cd312e6007ad88026a36.tar.xz pki-d5c6e6c69e678a79f9e8cd312e6007ad88026a36.zip |
Added generics (part 4).
This patch brings down the warnings from 3427 to 2917.
Ticket #2
Diffstat (limited to 'pki/base')
116 files changed, 374 insertions, 498 deletions
diff --git a/pki/base/ca/src/com/netscape/ca/CAService.java b/pki/base/ca/src/com/netscape/ca/CAService.java index d086ee551..d8faa8b34 100644 --- a/pki/base/ca/src/com/netscape/ca/CAService.java +++ b/pki/base/ca/src/com/netscape/ca/CAService.java @@ -410,7 +410,7 @@ public class CAService implements ICAService, IService { } String type = request.getRequestType(); - IServant servant = (IServant) mServants.get(type); + IServant servant = mServants.get(type); if (servant == null) { mCA.log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_CA_INVALID_REQUEST_TYPE", type)); @@ -923,7 +923,7 @@ public class CAService implements ICAService, IService { Enumeration<String> n = oldMeta.getElements(); while (n.hasMoreElements()) { - String name = (String) n.nextElement(); + String name = n.nextElement(); System.out.println("name " + name + " value " + oldMeta.get(name)); @@ -950,7 +950,7 @@ public class CAService implements ICAService, IService { Enumeration<String> n = oldMeta.getElements(); while (n.hasMoreElements()) { - String name = (String) n.nextElement(); + String name = n.nextElement(); } } @@ -1105,7 +1105,7 @@ public class CAService implements ICAService, IService { Enumeration<ICRLIssuingPoint> eIPs = mCRLIssuingPoints.elements(); while (eIPs.hasMoreElements()) { - ICRLIssuingPoint ip = (ICRLIssuingPoint) eIPs.nextElement(); + ICRLIssuingPoint ip = eIPs.nextElement(); if (ip != null) { boolean b = true; @@ -1434,7 +1434,7 @@ class serviceRenewal implements IServant { if (renewed != null) { BigInteger serial = new BigInteger(renewed); - X509CertImpl cert = (X509CertImpl) + X509CertImpl cert = mCA.getCertificateRepository().getX509Certificate(serial); if (cert == null) { @@ -1898,7 +1898,7 @@ class serviceGetCRL implements IServant { throws EBaseException { try { ICRLIssuingPointRecord crlRec = - (ICRLIssuingPointRecord) mCA.getCRLRepository().readCRLIssuingPointRecord( + mCA.getCRLRepository().readCRLIssuingPointRecord( ICertificateAuthority.PROP_MASTER_CRL); X509CRLImpl crl = new X509CRLImpl(crlRec.getCRL()); @@ -1936,7 +1936,7 @@ class serviceGetRevocationInfo implements IServant { Enumeration<String> enum1 = request.getExtDataKeys(); while (enum1.hasMoreElements()) { - String name = (String) enum1.nextElement(); + String name = enum1.nextElement(); if (name.equals(IRequest.ISSUED_CERTS)) { X509CertImpl certsToCheck[] = @@ -1976,7 +1976,7 @@ class serviceGetCertificates implements IServant { Enumeration<String> enum1 = request.getExtDataKeys(); while (enum1.hasMoreElements()) { - String name = (String) enum1.nextElement(); + String name = enum1.nextElement(); if (name.equals(IRequest.CERT_FILTER)) { String filter = request.getExtDataInString(IRequest.CERT_FILTER); @@ -2046,7 +2046,7 @@ class serviceCert4Crl implements IServant { Enumeration<ICRLIssuingPoint> eIPs = hips.elements(); while (eIPs.hasMoreElements()) { - ICRLIssuingPoint ip = (ICRLIssuingPoint) eIPs.nextElement(); + ICRLIssuingPoint ip = eIPs.nextElement(); // form RevokedCertImpl RevokedCertImpl rci = new RevokedCertImpl(revokedCertRecs[i].getSerialNumber(), @@ -2108,7 +2108,7 @@ class serviceUnCert4Crl implements IServant { Enumeration<ICRLIssuingPoint> eIPs = hips.elements(); while (eIPs.hasMoreElements()) { - ICRLIssuingPoint ip = (ICRLIssuingPoint) eIPs.nextElement(); + ICRLIssuingPoint ip = eIPs.nextElement(); if (ip != null) { ip.addUnrevokedCert(oldSerialNo[i]); diff --git a/pki/base/ca/src/com/netscape/ca/CMSCRLExtensions.java b/pki/base/ca/src/com/netscape/ca/CMSCRLExtensions.java index 0d98b9631..8c59d42d8 100644 --- a/pki/base/ca/src/com/netscape/ca/CMSCRLExtensions.java +++ b/pki/base/ca/src/com/netscape/ca/CMSCRLExtensions.java @@ -200,7 +200,7 @@ public class CMSCRLExtensions implements ICMSCRLExtensions { IConfigStore mFileConfig = SubsystemRegistry.getInstance().get("MAIN").getConfigStore(); - IConfigStore crlExtConfig = (IConfigStore) mFileConfig; + IConfigStore crlExtConfig = mFileConfig; StringTokenizer st = new StringTokenizer(mCRLExtConfig.getName(), "."); while (st.hasMoreTokens()) { @@ -471,11 +471,11 @@ public class CMSCRLExtensions implements ICMSCRLExtensions { if (cmsCRLExt != null) { if (ext != null) { if (isCRLExtensionCritical(extName) ^ ext.isCritical()) { - ext = (Extension) cmsCRLExt.setCRLExtensionCriticality( + ext = cmsCRLExt.setCRLExtensionCriticality( ext, isCRLExtensionCritical(extName)); } } else { - ext = (Extension) cmsCRLExt.getCRLExtension(mCRLExtConfig.getSubStore(extName), + ext = cmsCRLExt.getCRLExtension(mCRLExtConfig.getSubStore(extName), mCRLIssuingPoint, isCRLExtensionCritical(extName)); } diff --git a/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java b/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java index 46ddb544d..1c89a29c8 100644 --- a/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java +++ b/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java @@ -635,7 +635,6 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { Vector<String> listedProfiles = new Vector<String>(); StringTokenizer elements = new StringTokenizer(list, ",", true); - int t0 = -1; int n = 0; while (elements.hasMoreTokens()) { String element = elements.nextToken().trim(); @@ -3151,7 +3150,7 @@ class CertRecProcessor implements IElementProcessor { boolean includeCert = checkRevokedCertExtensions(crlExts); if (includeCert == true) { - mCRLCerts.put(serialNumber, (RevokedCertificate) newRevokedCert); + mCRLCerts.put(serialNumber, newRevokedCert); if (serialNumber != null) { CMS.debug("Putting certificate serial: 0x" + serialNumber.toString(16) + " into CRL hashtable"); } diff --git a/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java b/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java index dab9c069d..00fcbae0f 100644 --- a/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java +++ b/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java @@ -93,7 +93,6 @@ import com.netscape.cmscore.dbs.CertRecord; import com.netscape.cmscore.dbs.CertificateRepository; import com.netscape.cmscore.dbs.DBSubsystem; import com.netscape.cmscore.dbs.ReplicaIDRepository; -import com.netscape.cmscore.dbs.Repository; import com.netscape.cmscore.ldap.PublisherProcessor; import com.netscape.cmscore.listeners.ListenerPlugin; import com.netscape.cmscore.request.RequestSubsystem; @@ -590,7 +589,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori public String getStartSerial() { try { BigInteger serial = - ((Repository) mCertRepot).getTheSerialNumber(); + mCertRepot.getTheSerialNumber(); if (serial == null) return ""; @@ -603,11 +602,11 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori } public void setStartSerial(String serial) throws EBaseException { - ((Repository) mCertRepot).setTheSerialNumber(new BigInteger(serial)); + mCertRepot.setTheSerialNumber(new BigInteger(serial)); } public String getMaxSerial() { - String serial = ((Repository) mCertRepot).getMaxSerial(); + String serial = mCertRepot.getMaxSerial(); if (serial != null) return serial; @@ -616,7 +615,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori } public void setMaxSerial(String serial) throws EBaseException { - ((Repository) mCertRepot).setMaxSerial(serial); + mCertRepot.setMaxSerial(serial); } /** @@ -658,7 +657,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori * @return CRL issuing point */ public ICRLIssuingPoint getCRLIssuingPoint(String id) { - return (CRLIssuingPoint) mCRLIssuePoints.get(id); + return mCRLIssuePoints.get(id); } /** @@ -1491,7 +1490,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori Enumeration<String> names = implc.getSubStoreNames(); while (names.hasMoreElements()) { - String id = (String) names.nextElement(); + String id = names.nextElement(); if (Debug.ON) Debug.trace("registering listener impl: " + id); @@ -1698,7 +1697,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori // a Master/full crl must exist. while (issuePointIdEnum.hasMoreElements()) { - String issuePointId = (String) issuePointIdEnum.nextElement(); + String issuePointId = issuePointIdEnum.nextElement(); CMS.debug( "initializing crl issue point " + issuePointId); @@ -1923,7 +1922,6 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori DerOutputStream tmpChain = new DerOutputStream(); DerOutputStream tmp1 = new DerOutputStream(); - DerOutputStream outChain = new DerOutputStream(); java.security.cert.X509Certificate chains[] = mOCSPCertChain.getChain(); diff --git a/pki/base/common/src/com/netscape/certsrv/acls/ACLEntry.java b/pki/base/common/src/com/netscape/certsrv/acls/ACLEntry.java index 448b851e7..2c1b7c3ea 100644 --- a/pki/base/common/src/com/netscape/certsrv/acls/ACLEntry.java +++ b/pki/base/common/src/com/netscape/certsrv/acls/ACLEntry.java @@ -233,7 +233,7 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { Enumeration<String> e = permissions(); for (; e.hasMoreElements();) { - String p = (String) e.nextElement(); + String p = e.nextElement(); entry += p; if (e.hasMoreElements()) diff --git a/pki/base/common/src/com/netscape/certsrv/base/IConfigStoreEventListener.java b/pki/base/common/src/com/netscape/certsrv/base/IConfigStoreEventListener.java index 376b4e91a..06e7d522a 100644 --- a/pki/base/common/src/com/netscape/certsrv/base/IConfigStoreEventListener.java +++ b/pki/base/common/src/com/netscape/certsrv/base/IConfigStoreEventListener.java @@ -34,7 +34,7 @@ public interface IConfigStoreEventListener { * @exception EBaseException failed to validate */ public void validateConfigParams(String action, - Hashtable params) throws EBaseException; + Hashtable<String, String> params) throws EBaseException; /** * Validates the config store parameters that changed @@ -44,5 +44,5 @@ public interface IConfigStoreEventListener { * @exception EBaseException failed to validate */ public void doConfigParams(String action, - Hashtable params) throws EBaseException; + Hashtable<String, String> params) 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 60f867368..2e9e00f60 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 @@ -30,6 +30,7 @@ import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.MetaInfo; import com.netscape.certsrv.dbs.ModificationSet; import com.netscape.certsrv.dbs.repository.IRepository; +import com.netscape.cmscore.dbs.CertificateRepository.RenewableCertificateCollection; /** * An interface represents a CMS certificate repository. @@ -205,7 +206,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of certificates * @exception EBaseException failed to search */ - public Enumeration searchCertificates(String filter, int maxSize) + public Enumeration<Object> searchCertificates(String filter, int maxSize) throws EBaseException; /** @@ -218,7 +219,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of certificates * @exception EBaseException failed to search */ - public Enumeration searchCertificates(String filter, int maxSize, + public Enumeration<ICertRecord> searchCertificates(String filter, int maxSize, int timeLimit) throws EBaseException; /** @@ -308,7 +309,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of revoked certificates * @exception EBaseException failed to retrieve */ - public Enumeration getRevokedCertificates(Date asOfDate) + public Enumeration<ICertRecord> getRevokedCertificates(Date asOfDate) throws EBaseException; /** @@ -318,7 +319,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of revoked certificates * @exception EBaseException failed to search */ - public Enumeration getAllRevokedCertificates() + public Enumeration<ICertRecord> getAllRevokedCertificates() throws EBaseException; /** @@ -327,7 +328,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of revoked certificates * @exception EBaseException failed to search */ - public Enumeration getAllRevokedNonExpiredCertificates() + public Enumeration<ICertRecord> getAllRevokedNonExpiredCertificates() throws EBaseException; /** @@ -337,7 +338,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of certificates * @exception EBaseException failed to search */ - public Enumeration findCertificates(String filter) + public Enumeration<X509CertImpl> findCertificates(String filter) throws EBaseException; /** @@ -347,7 +348,7 @@ public interface ICertificateRepository extends IRepository { * @return a list of certificates * @exception EBaseException failed to search */ - public Enumeration findCertRecords(String filter) + public Enumeration<ICertRecord> findCertRecords(String filter) throws EBaseException; /** @@ -414,7 +415,7 @@ public interface ICertificateRepository extends IRepository { * @return certificates * @exception EBaseException failed to retrieve */ - public Hashtable getRenewableCertificates(String renewalTime) + public Hashtable<String, RenewableCertificateCollection> getRenewableCertificates(String renewalTime) throws EBaseException; /** diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/crldb/ICRLRepository.java b/pki/base/common/src/com/netscape/certsrv/dbs/crldb/ICRLRepository.java index 3fb40b26d..806a2cb19 100644 --- a/pki/base/common/src/com/netscape/certsrv/dbs/crldb/ICRLRepository.java +++ b/pki/base/common/src/com/netscape/certsrv/dbs/crldb/ICRLRepository.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.base.EBaseException; import com.netscape.certsrv.dbs.ModificationSet; @@ -109,7 +111,9 @@ public interface 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; /** @@ -120,7 +124,7 @@ public interface ICRLRepository { * @param unrevokedCerts list of released from hold certificates * @exception EBaseException failed to update issuing point record */ - public void updateRevokedCerts(String id, Hashtable revokedCerts, Hashtable unrevokedCerts) + public void updateRevokedCerts(String id, Hashtable<BigInteger, RevokedCertificate> revokedCerts, Hashtable<BigInteger, RevokedCertificate> unrevokedCerts) throws EBaseException; /** @@ -130,7 +134,7 @@ public interface ICRLRepository { * @param expiredCerts list of expired certificates * @exception EBaseException failed to update issuing point record */ - public void updateExpiredCerts(String id, Hashtable expiredCerts) + public void updateExpiredCerts(String id, Hashtable<BigInteger, RevokedCertificate> expiredCerts) throws EBaseException; /** @@ -144,9 +148,9 @@ public interface ICRLRepository { * @exception EBaseException failed to update issuing point record */ 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; /** diff --git a/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRepository.java b/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRepository.java index ca1e2c8aa..627844286 100644 --- a/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRepository.java +++ b/pki/base/common/src/com/netscape/certsrv/dbs/keydb/IKeyRepository.java @@ -97,7 +97,7 @@ public interface IKeyRepository extends IRepository { * @return a list of private key records * @exception EBaseException failed to search keys */ - public Enumeration searchKeys(String filter, int maxSize) + public Enumeration<IKeyRecord> searchKeys(String filter, int maxSize) throws EBaseException; /** @@ -109,7 +109,7 @@ public interface IKeyRepository extends IRepository { * @return a list of private key records * @exception EBaseException failed to search keys */ - public Enumeration searchKeys(String filter, int maxSize, int timeLimt) + public Enumeration<IKeyRecord> searchKeys(String filter, int maxSize, int timeLimt) throws EBaseException; /** diff --git a/pki/base/common/src/com/netscape/certsrv/ocsp/IDefStore.java b/pki/base/common/src/com/netscape/certsrv/ocsp/IDefStore.java index 7123de303..ee4c76a08 100644 --- a/pki/base/common/src/com/netscape/certsrv/ocsp/IDefStore.java +++ b/pki/base/common/src/com/netscape/certsrv/ocsp/IDefStore.java @@ -110,7 +110,7 @@ public interface IDefStore extends IOCSPStore { * @return Enumeration a list of the CRL issuing points * @exception EBaseException occurs when no CRL issuing point exists */ - public Enumeration<Object> searchAllCRLIssuingPointRecord( + public Enumeration<ICRLIssuingPointRecord> searchAllCRLIssuingPointRecord( int maxSize) throws EBaseException; @@ -124,7 +124,7 @@ public interface IDefStore extends IOCSPStore { * @return Enumeration a list of the CRL issuing points * @exception EBaseException occurs when no CRL issuing point exists */ - public Enumeration searchCRLIssuingPointRecord(String filter, + public Enumeration<ICRLIssuingPointRecord> searchCRLIssuingPointRecord(String filter, int maxSize) throws EBaseException; diff --git a/pki/base/common/src/com/netscape/certsrv/publish/IPublishRuleSet.java b/pki/base/common/src/com/netscape/certsrv/publish/IPublishRuleSet.java index c1af492b8..911d4e132 100644 --- a/pki/base/common/src/com/netscape/certsrv/publish/IPublishRuleSet.java +++ b/pki/base/common/src/com/netscape/certsrv/publish/IPublishRuleSet.java @@ -103,7 +103,7 @@ public interface IPublishRuleSet { * * @return An enumeration of publishing rules. */ - Enumeration getRules(); + Enumeration<ILdapRule> getRules(); /** * Apply publishing rules on a request. diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequestList.java b/pki/base/common/src/com/netscape/certsrv/request/IRequestList.java index e207c0014..5f265941a 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IRequestList.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IRequestList.java @@ -27,7 +27,7 @@ import java.util.Enumeration; * @version $Revision$, $Date$ */ public interface IRequestList - extends Enumeration { + extends Enumeration<RequestId> { /** * Gets the next RequestId from this list. null is diff --git a/pki/base/common/src/com/netscape/certsrv/security/IStorageKeyUnit.java b/pki/base/common/src/com/netscape/certsrv/security/IStorageKeyUnit.java index 336bf57ad..5f3b0ec48 100644 --- a/pki/base/common/src/com/netscape/certsrv/security/IStorageKeyUnit.java +++ b/pki/base/common/src/com/netscape/certsrv/security/IStorageKeyUnit.java @@ -59,7 +59,7 @@ public interface IStorageKeyUnit extends IEncryptionUnit { * * @return a list of string-based agent identifiers */ - public Enumeration getAgentIdentifiers(); + public Enumeration<String> getAgentIdentifiers(); /** * Changes agent password. 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 cf57098b6..905efc42a 100644 --- a/pki/base/common/src/com/netscape/cms/authentication/CMCAuth.java +++ b/pki/base/common/src/com/netscape/cms/authentication/CMCAuth.java @@ -451,7 +451,6 @@ public class CMCAuth implements IAuthManager, IExtendedPluginInfo, // } INTEGER temp = revRequest.getSerialNumber(); - int temp2 = temp.intValue(); bigIntArray[j] = temp; authToken.set(TOKEN_CERT_SERIAL, bigIntArray); @@ -783,7 +782,7 @@ public class CMCAuth implements IAuthManager, IExtendedPluginInfo, SET dais = cmcFullReq.getDigestAlgorithmIdentifiers(); int numDig = dais.size(); - Hashtable digs = new Hashtable(); + Hashtable<String, byte[]> digs = new Hashtable<String, byte[]>(); //if request key is used for signing, there MUST be only one signerInfo //object in the signedData object. 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 4aae1f159..57b86157e 100644 --- a/pki/base/common/src/com/netscape/cms/authentication/HashAuthentication.java +++ b/pki/base/common/src/com/netscape/cms/authentication/HashAuthentication.java @@ -62,19 +62,19 @@ public class HashAuthentication implements IAuthManager, IExtendedPluginInfo { private String mHost; private long mLastLogin = 0; private MessageDigest mSHADigest = null; - private Hashtable mData = null; + private Hashtable<String, IAuthToken> mData = null; private IConfigStore mConfig; private String mName = null; private String mImplName = null; private ILogger mLogger = CMS.getLogger(); - private static Vector mExtendedPluginInfo = null; + private static Vector<String> mExtendedPluginInfo = null; private HashAuthData mHosts = null; static String[] mConfigParams = new String[] {}; static { - mExtendedPluginInfo = new Vector(); + mExtendedPluginInfo = new Vector<String>(); mExtendedPluginInfo.add(IExtendedPluginInfo.HELP_TEXT + ";Authenticate the username and password provided " + "by the user against an LDAP directory. Works with the " + @@ -94,7 +94,7 @@ public class HashAuthentication implements IAuthManager, IExtendedPluginInfo { mName = name; mImplName = implName; mConfig = config; - mData = new Hashtable(); + mData = new Hashtable<String, IAuthToken>(); mHosts = new HashAuthData(); try { @@ -106,7 +106,7 @@ public class HashAuthentication implements IAuthManager, IExtendedPluginInfo { } public IAuthToken getAuthToken(String key) { - return (IAuthToken) mData.remove(key); + return mData.remove(key); } public void addAuthToken(String pageID, IAuthToken token) { @@ -114,7 +114,7 @@ public class HashAuthentication implements IAuthManager, IExtendedPluginInfo { } public void deleteToken(String pageID) { - IAuthToken token = (IAuthToken) mData.remove(pageID); + mData.remove(pageID); } public HashAuthData getData() { 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 0c6178e99..8abe027c4 100644 --- a/pki/base/common/src/com/netscape/cms/jobs/RenewalNotificationJob.java +++ b/pki/base/common/src/com/netscape/cms/jobs/RenewalNotificationJob.java @@ -19,7 +19,6 @@ package com.netscape.cms.jobs; import java.io.IOException; import java.text.DateFormat; -import java.util.Calendar; import java.util.Date; import java.util.Enumeration; import java.util.Locale; diff --git a/pki/base/common/src/com/netscape/cms/listeners/PinRemovalListener.java b/pki/base/common/src/com/netscape/cms/listeners/PinRemovalListener.java index c71b9c603..662e762b0 100644 --- a/pki/base/common/src/com/netscape/cms/listeners/PinRemovalListener.java +++ b/pki/base/common/src/com/netscape/cms/listeners/PinRemovalListener.java @@ -17,8 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cms.listeners; -import java.util.Hashtable; - import netscape.ldap.LDAPAttribute; import netscape.ldap.LDAPConnection; import netscape.ldap.LDAPEntry; @@ -28,7 +26,6 @@ import netscape.ldap.LDAPSearchResults; import netscape.ldap.LDAPv2; import com.netscape.certsrv.apps.CMS; -import com.netscape.certsrv.authority.ICertAuthority; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.ISubsystem; @@ -56,9 +53,7 @@ public class PinRemovalListener implements IRequestListener { private boolean mEnabled = false; private ILogger mLogger = CMS.getLogger(); - private Hashtable mContentParams = new Hashtable(); - private ICertAuthority mSub = null; private IConfigStore mConfig = null; private IConfigStore mLdapConfig = null; private RequestId mReqId = null; diff --git a/pki/base/common/src/com/netscape/cms/listeners/RequestInQListener.java b/pki/base/common/src/com/netscape/cms/listeners/RequestInQListener.java index e5c075208..7ff13db54 100644 --- a/pki/base/common/src/com/netscape/cms/listeners/RequestInQListener.java +++ b/pki/base/common/src/com/netscape/cms/listeners/RequestInQListener.java @@ -71,7 +71,7 @@ public class RequestInQListener implements IRequestListener { private String mEmailSubject = null; private String mFormPath = null; private IConfigStore mConfig = null; - private Hashtable mContentParams = new Hashtable(); + private Hashtable<String, Object> mContentParams = new Hashtable<String, Object>(); private String mId = "RequestInQListener"; private ICertAuthority mSubsystem = null; private String mHttpHost = null; diff --git a/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java b/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java index db61382c5..d3b5d545e 100644 --- a/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java +++ b/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java @@ -27,7 +27,6 @@ import java.util.Hashtable; import java.util.Locale; import java.util.Vector; -import netscape.security.x509.CRLNumberExtension; import netscape.security.x509.RevokedCertificate; import netscape.security.x509.X509CRLImpl; import netscape.security.x509.X509CertImpl; @@ -48,6 +47,7 @@ import com.netscape.certsrv.common.Constants; import com.netscape.certsrv.common.NameValuePairs; 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.Modification; import com.netscape.certsrv.dbs.ModificationSet; @@ -111,8 +111,6 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { private IConfigStore mConfig = null; private String mId = null; private IDBSubsystem mDBService = null; - private X509CRLImpl mCRLImpl = null; - private CRLNumberExtension mCRLNumberExt = null; private int mStateCount = 0; /** @@ -226,15 +224,12 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { * new one is totally committed. */ public void deleteOldCRLs() throws EBaseException { - Enumeration<Object> recs = searchCRLIssuingPointRecord( + Enumeration<ICRLIssuingPointRecord> recs = searchCRLIssuingPointRecord( "objectclass=" + CMS.getCRLIssuingPointRecordName(), 100); - X509CertImpl theCert = null; - ICRLIssuingPointRecord theRec = null; - while (recs.hasMoreElements()) { - ICRLIssuingPointRecord rec = (ICRLIssuingPointRecord) recs.nextElement(); + ICRLIssuingPointRecord rec = recs.nextElement(); deleteOldCRLsInCA(rec.getId()); } } @@ -252,14 +247,14 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { return; // nothing to do String thisUpdate = Long.toString( cp.getThisUpdate().getTime()); - Enumeration<Object> e = searchRepository( + Enumeration<IRepositoryRecord> e = searchRepository( caName, "(!" + IRepositoryRecord.ATTR_SERIALNO + "=" + thisUpdate + ")"); while (e != null && e.hasMoreElements()) { - IRepositoryRecord r = (IRepositoryRecord) e.nextElement(); - Enumeration<Object> recs = + IRepositoryRecord r = e.nextElement(); + Enumeration<ICertRecord> recs = searchCertRecord(caName, r.getSerialNumber().toString(), ICertRecord.ATTR_ID + "=*"); @@ -437,14 +432,13 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { mCacheCRLIssuingPoints.get(new String(keyhsh)); if (matched == null) { - Enumeration<Object> recs = searchCRLIssuingPointRecord( + Enumeration<ICRLIssuingPointRecord> recs = searchCRLIssuingPointRecord( "objectclass=" + CMS.getCRLIssuingPointRecordName(), 100); while (recs.hasMoreElements()) { - ICRLIssuingPointRecord rec = (ICRLIssuingPointRecord) - recs.nextElement(); + ICRLIssuingPointRecord rec = recs.nextElement(); byte certdata[] = rec.getCACert(); X509CertImpl cert = null; @@ -579,7 +573,7 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { return mDBService.getBaseDN(); } - public Enumeration<Object> searchAllCRLIssuingPointRecord(int maxSize) + public Enumeration<ICRLIssuingPointRecord> searchAllCRLIssuingPointRecord(int maxSize) throws EBaseException { return searchCRLIssuingPointRecord( "objectclass=" + @@ -587,19 +581,22 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { maxSize); } - public Enumeration<Object> searchCRLIssuingPointRecord(String filter, + public Enumeration<ICRLIssuingPointRecord> searchCRLIssuingPointRecord(String filter, int maxSize) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration<Object> e = null; + Vector<ICRLIssuingPointRecord> v = new Vector<ICRLIssuingPointRecord>(); try { - e = s.search(getBaseDN(), filter, maxSize); + IDBSearchResults sr = s.search(getBaseDN(), filter, maxSize); + while (sr.hasMoreElements()) { + v.add((ICRLIssuingPointRecord) sr.nextElement()); + } } finally { if (s != null) s.close(); } - return e; + return v.elements(); } public synchronized void modifyCRLIssuingPointRecord(String name, @@ -685,19 +682,22 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { } } - public Enumeration<Object> searchRepository(String name, String filter) + public Enumeration<IRepositoryRecord> searchRepository(String name, String filter) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration<Object> e = null; + Vector<IRepositoryRecord> v = new Vector<IRepositoryRecord>(); try { - e = s.search("cn=" + transformDN(name) + "," + getBaseDN(), + IDBSearchResults sr = s.search("cn=" + transformDN(name) + "," + getBaseDN(), filter); + while (sr.hasMoreElements()) { + v.add((IRepositoryRecord) sr.nextElement()); + } } finally { if (s != null) s.close(); } - return e; + return v.elements(); } /** @@ -736,20 +736,23 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { } } - public Enumeration<Object> searchCertRecord(String name, String thisUpdate, + public Enumeration<ICertRecord> searchCertRecord(String name, String thisUpdate, String filter) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration<Object> e = null; + Vector<ICertRecord> v = new Vector<ICertRecord>(); try { - e = s.search("ou=" + thisUpdate + ",cn=" + + IDBSearchResults sr = s.search("ou=" + thisUpdate + ",cn=" + transformDN(name) + "," + getBaseDN(), filter); + while (sr.hasMoreElements()) { + v.add((ICertRecord) sr.nextElement()); + } } finally { if (s != null) s.close(); } - return e; + return v.elements(); } public ICertRecord readCertRecord(String name, String thisUpdate, 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 765a79504..697d1bb40 100644 --- a/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java +++ b/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java @@ -33,6 +33,7 @@ import netscape.ldap.LDAPEntry; import netscape.ldap.LDAPException; import netscape.ldap.LDAPSearchResults; import netscape.ldap.LDAPv2; +import netscape.security.x509.RevokedCertificate; import netscape.security.x509.X509CRLImpl; import netscape.security.x509.X509CertImpl; import netscape.security.x509.X509Key; @@ -395,9 +396,9 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { throw new EBaseException("NOT SUPPORTED"); } - public Enumeration<Object> searchAllCRLIssuingPointRecord(int maxSize) + public Enumeration<ICRLIssuingPointRecord> searchAllCRLIssuingPointRecord(int maxSize) throws EBaseException { - Vector<Object> recs = new Vector<Object>(); + Vector<ICRLIssuingPointRecord> recs = new Vector<ICRLIssuingPointRecord>(); Enumeration<X509CertImpl> keys = mCRLs.keys(); while (keys.hasMoreElements()) { @@ -409,7 +410,7 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { return recs.elements(); } - public Enumeration searchCRLIssuingPointRecord(String filter, + public Enumeration<ICRLIssuingPointRecord> searchCRLIssuingPointRecord(String filter, int maxSize) throws EBaseException { return null; @@ -672,11 +673,11 @@ class TempCRLIssuingPointRecord implements ICRLIssuingPointRecord { return null; } - public Hashtable getCRLCacheNoClone() { + public Hashtable<BigInteger, RevokedCertificate> getCRLCacheNoClone() { return null; } - public Hashtable getCRLCache() { + public Hashtable<BigInteger, RevokedCertificate> getCRLCache() { return null; } @@ -717,25 +718,25 @@ class TempCRLIssuingPointRecord implements ICRLIssuingPointRecord { /** * Retrieves cache info of revoked certificates. */ - public Hashtable getRevokedCerts() { + public Hashtable<BigInteger, RevokedCertificate> getRevokedCerts() { return mCRL.getListOfRevokedCertificates(); } /** * Retrieves cache info of unrevoked certificates. */ - public Hashtable getUnrevokedCerts() { + public Hashtable<BigInteger, RevokedCertificate> getUnrevokedCerts() { return null; } /** * Retrieves cache info of expired certificates. */ - public Hashtable getExpiredCerts() { + public Hashtable<BigInteger, RevokedCertificate> getExpiredCerts() { return null; } - public Enumeration getSerializableAttrNames() { + public Enumeration<String> getSerializableAttrNames() { return null; } @@ -750,7 +751,7 @@ class TempCRLIssuingPointRecord implements ICRLIssuingPointRecord { } - public Enumeration getElements() { + public Enumeration<Object> getElements() { return null; } } diff --git a/pki/base/common/src/com/netscape/cms/profile/common/ProfileContext.java b/pki/base/common/src/com/netscape/cms/profile/common/ProfileContext.java index 7a275b1e6..7d0686378 100644 --- a/pki/base/common/src/com/netscape/cms/profile/common/ProfileContext.java +++ b/pki/base/common/src/com/netscape/cms/profile/common/ProfileContext.java @@ -27,13 +27,13 @@ import com.netscape.certsrv.profile.IProfileContext; * @version $Revision$, $Date$ */ public class ProfileContext implements IProfileContext { - private Hashtable m_Attrs = new Hashtable(); + private Hashtable<String, String> m_Attrs = new Hashtable<String, String>(); public void set(String name, String value) { m_Attrs.put(name, value); } public String get(String name) { - return (String) m_Attrs.get(name); + return m_Attrs.get(name); } } diff --git a/pki/base/common/src/com/netscape/cms/profile/common/RAEnrollProfile.java b/pki/base/common/src/com/netscape/cms/profile/common/RAEnrollProfile.java index ed028ceeb..36bac1fa7 100644 --- a/pki/base/common/src/com/netscape/cms/profile/common/RAEnrollProfile.java +++ b/pki/base/common/src/com/netscape/cms/profile/common/RAEnrollProfile.java @@ -110,11 +110,11 @@ public class RAEnrollProfile extends EnrollProfile { } // request handling - Enumeration names = ra.getRequestListenerNames(); + Enumeration<String> names = ra.getRequestListenerNames(); if (names != null) { while (names.hasMoreElements()) { - String name = (String) names.nextElement(); + String name = names.nextElement(); CMS.debug("CAEnrollProfile: listener " + name); IRequestListener listener = ra.getRequestListener(name); diff --git a/pki/base/common/src/com/netscape/cms/profile/input/SubjectNameInput.java b/pki/base/common/src/com/netscape/cms/profile/input/SubjectNameInput.java index 55ede1386..db70da666 100644 --- a/pki/base/common/src/com/netscape/cms/profile/input/SubjectNameInput.java +++ b/pki/base/common/src/com/netscape/cms/profile/input/SubjectNameInput.java @@ -113,8 +113,8 @@ public class SubjectNameInput 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>(); String c_uid = getConfig(CONFIG_UID); if (c_uid == null || c_uid.equals("")) { v.addElement(VAL_UID); // default case diff --git a/pki/base/common/src/com/netscape/cms/publish/publishers/Utils.java b/pki/base/common/src/com/netscape/cms/publish/publishers/Utils.java index 5bd342286..03561ee78 100644 --- a/pki/base/common/src/com/netscape/cms/publish/publishers/Utils.java +++ b/pki/base/common/src/com/netscape/cms/publish/publishers/Utils.java @@ -35,7 +35,7 @@ import java.util.Vector; */ public class Utils { public static void checkHost(String hostname) throws UnknownHostException { - InetAddress addr = InetAddress.getByName(hostname); + InetAddress.getByName(hostname); } public static void copyStream(InputStream in, OutputStream out) throws IOException { diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java index 41f0c248f..b77de59c6 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java @@ -799,7 +799,6 @@ public final class CMSAdminServlet extends AdminServlet { IOException, EBaseException { NameValuePairs params = new NameValuePairs(); Enumeration<ISubsystem> e = CMS.getSubsystems(); - StringBuffer buff = new StringBuffer(); while (e.hasMoreElements()) { String type = ""; 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 b93e6eb0b..bfd5004a2 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 @@ -311,7 +311,7 @@ public class JobsAdminServlet extends AdminServlet { destStore.getSubStore(scope); // Does the class exist? - Class newImpl = null; + Class<?> newImpl = null; try { newImpl = Class.forName(classPath); diff --git a/pki/base/common/src/com/netscape/cms/servlet/base/DisplayHtmlServlet.java b/pki/base/common/src/com/netscape/cms/servlet/base/DisplayHtmlServlet.java index ffd602b25..54e453f30 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/base/DisplayHtmlServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/base/DisplayHtmlServlet.java @@ -26,7 +26,6 @@ import javax.servlet.ServletConfig; import javax.servlet.ServletException; import com.netscape.certsrv.apps.CMS; -import com.netscape.certsrv.authentication.IAuthToken; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.logging.ILogger; import com.netscape.cms.servlet.common.CMSRequest; @@ -63,7 +62,7 @@ public class DisplayHtmlServlet extends CMSServlet { public void process(CMSRequest cmsReq) throws EBaseException { CMS.debug("DisplayHtmlServlet about to service "); - IAuthToken authToken = authenticate(cmsReq); + authenticate(cmsReq); try { String realpath = 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 e145ee4db..c21b56835 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 @@ -106,9 +106,6 @@ public class GetStats extends CMSServlet { return; } - // Construct an ArgBlock - IArgBlock args = cmsReq.getHttpParams(); - CMSTemplate form = null; Locale[] locale = new Locale[1]; diff --git a/pki/base/common/src/com/netscape/cms/servlet/base/ProxyServlet.java b/pki/base/common/src/com/netscape/cms/servlet/base/ProxyServlet.java index 0784945ab..41666ab31 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/base/ProxyServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/base/ProxyServlet.java @@ -59,11 +59,11 @@ public class ProxyServlet extends HttpServlet { private String mDestContext = null; private String mSrcContext = null; private String mAppendPathInfo = null; - private Vector mMatchStrings = new Vector(); + private Vector<String> mMatchStrings = new Vector<String>(); private String mDestServletOnNoMatch = null; private String mAppendPathInfoOnNoMatch = null; - private Map mParamMap = new HashMap(); - private Map mParamValue = new HashMap(); + private Map<String, String> mParamMap = new HashMap<String, String>(); + private Map<String, String[]> mParamValue = new HashMap<String, String[]>(); public ProxyServlet() { } @@ -130,7 +130,7 @@ public class ProxyServlet extends HttpServlet { if (mMatchStrings.size() != 0) { boolean matched = false; for (int i = 0; i < mMatchStrings.size(); i++) { - String t = (String) mMatchStrings.elementAt(i); + String t = mMatchStrings.elementAt(i); if (uri.indexOf(t) != -1) { matched = true; } @@ -171,21 +171,22 @@ public class ProxyServlet extends HttpServlet { } class ProxyWrapper extends HttpServletRequestWrapper { - private Map mMap = null; - private Map mValueMap = null; + private Map<String, String> mMap = null; + private Map<String, String[]> mValueMap = null; public ProxyWrapper(HttpServletRequest req) { super(req); } - public void setParameterMapAndValue(Map m, Map v) { + public void setParameterMapAndValue(Map<String, String> m, Map<String, String[]> v) { if (m != null) mMap = m; if (v != null) mValueMap = v; } - public Map getParameterMap() { + @SuppressWarnings("unchecked") + public Map<String, String[]> getParameterMap() { try { // If we haven't specified any parameter mapping, just // use the regular implementation @@ -193,15 +194,15 @@ class ProxyWrapper extends HttpServletRequestWrapper { return super.getParameterMap(); else { // Make a new Map for us to put stuff in - Map n = new HashMap(); + Map<String, String[]> n = new HashMap<String, String[]>(); // get the HTTP parameters the user supplied. - Map m = super.getParameterMap(); - Set s = m.entrySet(); - Iterator i = s.iterator(); + Map<String, String[]> m = super.getParameterMap(); + Set<Map.Entry<String, String[]>> s = m.entrySet(); + Iterator<Map.Entry<String, String[]>> i = s.iterator(); while (i.hasNext()) { - Map.Entry me = (Map.Entry) i.next(); - String name = (String) me.getKey(); - String[] values = (String[]) (me.getValue()); + Map.Entry<String, String[]> me = i.next(); + String name = me.getKey(); + String[] values = me.getValue(); String newname = null; if (name != null) { newname = (String) mMap.get(name); @@ -223,14 +224,14 @@ class ProxyWrapper extends HttpServletRequestWrapper { } // Now, deal with static values set in the config // which weren't set in the HTTP request - Set s2 = mValueMap.entrySet(); - Iterator i2 = s2.iterator(); + Set<Map.Entry<String, String[]>> s2 = mValueMap.entrySet(); + Iterator<Map.Entry<String, String[]>> i2 = s2.iterator(); // Cycle through all the static values while (i2.hasNext()) { - Map.Entry me2 = (Map.Entry) i2.next(); - String name2 = (String) me2.getKey(); + Map.Entry<String, String[]> me2 = i2.next(); + String name2 = me2.getKey(); if (n.get(name2) == null) { - String[] values2 = (String[]) me2.getValue(); + String[] values2 = me2.getValue(); // If the parameter is not set in the map // Set it now n.put(name2, values2); diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayHashUserEnroll.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayHashUserEnroll.java index 9815ff687..bf582a82e 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayHashUserEnroll.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayHashUserEnroll.java @@ -109,9 +109,6 @@ public class DisplayHashUserEnroll extends CMSServlet { String reqHost = httpReq.getRemoteHost(); - // Construct an ArgBlock - IArgBlock args = cmsReq.getHttpParams(); - if (!(mAuthority instanceof IRegistrationAuthority)) { log(ILogger.LL_FAILURE, CMS.getLogMessage("ADMIN_SRVLT_ERR_GET_TEMPLATE")); cmsReq.setError(new ECMSGWException( 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 3297c585c..d0dfb8f9a 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 @@ -108,9 +108,6 @@ public class GetEnableStatus extends CMSServlet { String reqHost = httpReq.getRemoteHost(); - // Construct an ArgBlock - IArgBlock args = cmsReq.getHttpParams(); - if (!(mAuthority instanceof IRegistrationAuthority)) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSGW_CA_FROM_RA_NOT_IMP")); cmsReq.setError(new ECMSGWException( diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/ReasonToRevoke.java b/pki/base/common/src/com/netscape/cms/servlet/cert/ReasonToRevoke.java index b8e56b3e7..0f21e1921 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/ReasonToRevoke.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/ReasonToRevoke.java @@ -245,13 +245,13 @@ public class ReasonToRevoke extends CMSServlet { * revokeAll, null, totalRecordCount); * Enumeration e = list.getCertRecords(0, totalRecordCount - 1); **/ - Enumeration e = mCertDB.searchCertificates(revokeAll, + Enumeration<ICertRecord> e = mCertDB.searchCertificates(revokeAll, totalRecordCount, mTimeLimits); int count = 0; while (e != null && e.hasMoreElements()) { - ICertRecord rec = (ICertRecord) e.nextElement(); + ICertRecord rec = e.nextElement(); if (rec == null) continue; diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/RemoteAuthConfig.java b/pki/base/common/src/com/netscape/cms/servlet/cert/RemoteAuthConfig.java index 55d8bb04c..478df161d 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/RemoteAuthConfig.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/RemoteAuthConfig.java @@ -19,7 +19,6 @@ package com.netscape.cms.servlet.cert; import java.io.IOException; import java.util.Calendar; -import java.util.Date; import java.util.Enumeration; import java.util.Locale; import java.util.StringTokenizer; @@ -42,7 +41,6 @@ import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.authentication.AuthMgrPlugin; import com.netscape.certsrv.authentication.IAuthManager; import com.netscape.certsrv.authentication.IAuthSubsystem; -import com.netscape.certsrv.authentication.IAuthToken; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IArgBlock; import com.netscape.certsrv.base.IConfigStore; @@ -146,7 +144,7 @@ public class RemoteAuthConfig extends CMSServlet { HttpServletRequest req = cmsReq.getHttpReq(); HttpServletResponse resp = cmsReq.getHttpResp(); - IAuthToken authToken = authenticate(cmsReq); + authenticate(cmsReq); IArgBlock header = CMS.createArgBlock(); IArgBlock ctx = CMS.createArgBlock(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/SrchCerts.java b/pki/base/common/src/com/netscape/cms/servlet/cert/SrchCerts.java index 8e6d58216..3602515c9 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/SrchCerts.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/SrchCerts.java @@ -295,7 +295,6 @@ public class SrchCerts extends CMSServlet { private void buildDateFilter(HttpServletRequest req, String prefix, String outStr, long adjustment, StringBuffer filter) { - String queryCertFilter = null; long epoch = 0; try { epoch = Long.parseLong(req.getParameter(prefix)); diff --git a/pki/base/common/src/com/netscape/cms/servlet/common/CMSTemplate.java b/pki/base/common/src/com/netscape/cms/servlet/common/CMSTemplate.java index 4625fb79e..50feb0863 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/common/CMSTemplate.java +++ b/pki/base/common/src/com/netscape/cms/servlet/common/CMSTemplate.java @@ -111,8 +111,6 @@ public class CMSTemplate extends CMSFile { * @return true if successful */ public boolean init(File template) throws EBaseException, IOException { - StringBuffer buf = new StringBuffer(); - /* load template */ String content = loadFile(template); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CheckIdentity.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CheckIdentity.java index a28ae76b3..52a98d540 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CheckIdentity.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CheckIdentity.java @@ -28,7 +28,6 @@ import javax.servlet.http.HttpServletResponse; import org.w3c.dom.Node; import com.netscape.certsrv.apps.CMS; -import com.netscape.certsrv.authentication.IAuthToken; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.logging.ILogger; import com.netscape.cms.servlet.base.CMSServlet; @@ -66,13 +65,10 @@ public class CheckIdentity extends CMSServlet { * @param cmsReq the object holding the request and response information */ protected void process(CMSRequest cmsReq) throws EBaseException { - HttpServletRequest httpReq = cmsReq.getHttpReq(); HttpServletResponse httpResp = cmsReq.getHttpResp(); - IAuthToken authToken = null; - try { - authToken = authenticate(cmsReq); + authenticate(cmsReq); } catch (Exception e) { CMS.debug("CheckIdentity authentication failed"); log(ILogger.LL_FAILURE, diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetTokenInfo.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetTokenInfo.java index 4d11af8af..f97d3e5e1 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetTokenInfo.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/GetTokenInfo.java @@ -30,7 +30,6 @@ import org.w3c.dom.Node; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; -import com.netscape.certsrv.base.IArgBlock; import com.netscape.certsrv.base.IConfigStore; import com.netscape.cms.servlet.base.CMSServlet; import com.netscape.cms.servlet.base.UserInfo; @@ -70,12 +69,8 @@ public class GetTokenInfo extends CMSServlet { * @param cmsReq the object holding the request and response information */ protected void process(CMSRequest cmsReq) throws EBaseException { - HttpServletRequest httpReq = cmsReq.getHttpReq(); HttpServletResponse httpResp = cmsReq.getHttpResp(); - // Construct an ArgBlock - IArgBlock args = cmsReq.getHttpParams(); - XMLObject xmlObj = null; try { xmlObj = new XMLObject(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/key/ConfirmRecoverBySerial.java b/pki/base/common/src/com/netscape/cms/servlet/key/ConfirmRecoverBySerial.java index 15e73179e..59b01f26a 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/key/ConfirmRecoverBySerial.java +++ b/pki/base/common/src/com/netscape/cms/servlet/key/ConfirmRecoverBySerial.java @@ -28,7 +28,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.netscape.certsrv.apps.CMS; -import com.netscape.certsrv.authentication.IAuthToken; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IArgBlock; import com.netscape.certsrv.dbs.keydb.IKeyRecord; @@ -112,7 +111,7 @@ public class ConfirmRecoverBySerial extends CMSServlet { HttpServletRequest req = cmsReq.getHttpReq(); HttpServletResponse resp = cmsReq.getHttpResp(); - IAuthToken authToken = authenticate(cmsReq); + authenticate(cmsReq); CMSTemplate form = null; Locale[] locale = new Locale[1]; diff --git a/pki/base/common/src/com/netscape/cms/servlet/key/ExamineRecovery.java b/pki/base/common/src/com/netscape/cms/servlet/key/ExamineRecovery.java index bc23e635b..81ced5290 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/key/ExamineRecovery.java +++ b/pki/base/common/src/com/netscape/cms/servlet/key/ExamineRecovery.java @@ -217,7 +217,7 @@ public class ExamineRecovery extends CMSServlet { req.getRequestURI()); header.addStringValue("keySplitting", CMS.getConfigStore().getString("kra.keySplitting")); - Hashtable params = mService.getRecoveryParams( + Hashtable<String, Object> params = mService.getRecoveryParams( recoveryID); if (params == null) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/key/GetPk12.java b/pki/base/common/src/com/netscape/cms/servlet/key/GetPk12.java index f27e966d0..96fe7c85d 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/key/GetPk12.java +++ b/pki/base/common/src/com/netscape/cms/servlet/key/GetPk12.java @@ -154,7 +154,6 @@ public class GetPk12 extends CMSServlet { IArgBlock header = CMS.createArgBlock(); IArgBlock fixed = CMS.createArgBlock(); CMSTemplateParams argSet = new CMSTemplateParams(header, fixed); - int seq = -1; // get status and populate argSet try { @@ -162,7 +161,7 @@ public class GetPk12 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, diff --git a/pki/base/common/src/com/netscape/cms/servlet/key/GrantRecovery.java b/pki/base/common/src/com/netscape/cms/servlet/key/GrantRecovery.java index a7b256e83..9989fafad 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/key/GrantRecovery.java +++ b/pki/base/common/src/com/netscape/cms/servlet/key/GrantRecovery.java @@ -244,7 +244,7 @@ public class GrantRecovery extends CMSServlet { header.addStringValue(OUT_SERVICE_URL, req.getRequestURI()); - Hashtable h = mService.getRecoveryParams(recoveryID); + Hashtable<String, Object> h = mService.getRecoveryParams(recoveryID); if (h == null) { header.addStringValue(OUT_ERROR, diff --git a/pki/base/common/src/com/netscape/cms/servlet/key/KeyRecordParser.java b/pki/base/common/src/com/netscape/cms/servlet/key/KeyRecordParser.java index d6bc57fcf..aeee624c0 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/key/KeyRecordParser.java +++ b/pki/base/common/src/com/netscape/cms/servlet/key/KeyRecordParser.java @@ -17,7 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cms.servlet.key; -import java.math.BigInteger; import java.util.Date; import com.netscape.certsrv.apps.CMS; diff --git a/pki/base/common/src/com/netscape/cms/servlet/key/RecoverBySerial.java b/pki/base/common/src/com/netscape/cms/servlet/key/RecoverBySerial.java index 6bb013b1c..28ff30803 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/key/RecoverBySerial.java +++ b/pki/base/common/src/com/netscape/cms/servlet/key/RecoverBySerial.java @@ -175,12 +175,9 @@ public class RecoverBySerial extends CMSServlet { fixed.set(PORT, Integer.valueOf(port)); fixed.set(SCHEME, scheme); - int seq = -1; - SessionContext ctx = null; try { - String localAgents = req.getParameter("localAgents"); String initAsyncRecovery = req.getParameter("initAsyncRecovery"); // this information is needed within the server for @@ -367,7 +364,7 @@ public class RecoverBySerial extends CMSServlet { header.addStringValue(OUT_ERROR, "No recovery ID specified"); return null; } - Hashtable params = mService.createRecoveryParams(recoveryID); + Hashtable<String, Object> params = mService.createRecoveryParams(recoveryID); params.put("keyID", req.getParameter(IN_SERIALNO)); @@ -383,7 +380,7 @@ public class RecoverBySerial extends CMSServlet { waitThread.start(); return null; } else { - Vector v = new Vector(); + Vector<Credential> v = new Vector<Credential>(); for (int i = 0; i < mService.getNoOfRequiredAgents(); i++) { String uid = req.getParameter(IN_UID + i); @@ -424,7 +421,7 @@ public class RecoverBySerial extends CMSServlet { header.addStringValue(OUT_ERROR, "No recovery ID specified"); return null; } - Hashtable params = mService.createRecoveryParams(recoveryID); + Hashtable<String, Object> params = mService.createRecoveryParams(recoveryID); params.put("keyID", req.getParameter(IN_SERIALNO)); diff --git a/pki/base/common/src/com/netscape/cms/servlet/key/SrchKey.java b/pki/base/common/src/com/netscape/cms/servlet/key/SrchKey.java index b6693ee6b..bff14e9f2 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/key/SrchKey.java +++ b/pki/base/common/src/com/netscape/cms/servlet/key/SrchKey.java @@ -263,7 +263,7 @@ public class SrchKey extends CMSServlet { timeLimit = mTimeLimits; } CMS.debug("Start searching ... timelimit=" + timeLimit); - Enumeration e = mKeyDB.searchKeys(filter, + Enumeration<IKeyRecord> e = mKeyDB.searchKeys(filter, maxResults, timeLimit); int count = 0; @@ -272,8 +272,7 @@ public class SrchKey extends CMSServlet { null); } else { while (e.hasMoreElements()) { - IKeyRecord rec = (IKeyRecord) - e.nextElement(); + IKeyRecord rec = e.nextElement(); // rec is null when we specify maxResults // DS will return an err=4, which triggers // a LDAPException.SIZE_LIMIT_ExCEEDED diff --git a/pki/base/common/src/com/netscape/cms/servlet/key/SrchKeyForRecovery.java b/pki/base/common/src/com/netscape/cms/servlet/key/SrchKeyForRecovery.java index 828ef0e6c..95c777701 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/key/SrchKeyForRecovery.java +++ b/pki/base/common/src/com/netscape/cms/servlet/key/SrchKeyForRecovery.java @@ -284,7 +284,7 @@ public class SrchKeyForRecovery extends CMSServlet { timeLimit = mTimeLimits; } CMS.debug("Start searching ... timelimit=" + timeLimit); - Enumeration e = mKeyDB.searchKeys(filter, maxResults, timeLimit); + Enumeration<IKeyRecord> e = mKeyDB.searchKeys(filter, maxResults, timeLimit); int count = 0; if (e == null) { @@ -292,8 +292,7 @@ public class SrchKeyForRecovery extends CMSServlet { null); } else { while (e.hasMoreElements()) { - IKeyRecord rec = (IKeyRecord) - e.nextElement(); + IKeyRecord rec = e.nextElement(); // rec is null when we specify maxResults // DS will return an err=4, which triggers // a LDAPException.SIZE_LIMIT_ExCEEDED diff --git a/pki/base/common/src/com/netscape/cms/servlet/ocsp/GetOCSPInfo.java b/pki/base/common/src/com/netscape/cms/servlet/ocsp/GetOCSPInfo.java index 1aaf1d6e5..3dfc1d5f3 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/ocsp/GetOCSPInfo.java +++ b/pki/base/common/src/com/netscape/cms/servlet/ocsp/GetOCSPInfo.java @@ -106,9 +106,6 @@ public class GetOCSPInfo extends CMSServlet { return; } - // Construct an ArgBlock - IArgBlock args = cmsReq.getHttpParams(); - if (!(mAuthority instanceof IOCSPService)) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSGW_CA_FROM_RA_NOT_IMP")); cmsReq.setError(new ECMSGWException( diff --git a/pki/base/common/src/com/netscape/cms/servlet/ocsp/ListCAServlet.java b/pki/base/common/src/com/netscape/cms/servlet/ocsp/ListCAServlet.java index 2d9daff95..9ca7a8a18 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/ocsp/ListCAServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/ocsp/ListCAServlet.java @@ -128,14 +128,14 @@ public class ListCAServlet extends CMSServlet { CMSTemplateParams argSet = new CMSTemplateParams(header, fixed); IDefStore defStore = mOCSPAuthority.getDefaultStore(); - Enumeration<Object> recs = defStore.searchAllCRLIssuingPointRecord(100); + Enumeration<ICRLIssuingPointRecord> recs = defStore.searchAllCRLIssuingPointRecord(100); // show the current CRL number if present header.addStringValue("stateCount", Integer.toString(defStore.getStateCount())); while (recs.hasMoreElements()) { - ICRLIssuingPointRecord rec = (ICRLIssuingPointRecord) recs.nextElement(); + ICRLIssuingPointRecord rec = recs.nextElement(); IArgBlock rarg = CMS.createArgBlock(); String thisId = rec.getId(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/processors/CMCProcessor.java b/pki/base/common/src/com/netscape/cms/servlet/processors/CMCProcessor.java index 51655f973..53c13510d 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/processors/CMCProcessor.java +++ b/pki/base/common/src/com/netscape/cms/servlet/processors/CMCProcessor.java @@ -203,7 +203,7 @@ public class CMCProcessor extends PKIProcessor { // verify the signerInfo SET dais = cmcFullReq.getDigestAlgorithmIdentifiers(); int numDig = dais.size(); - Hashtable digs = new Hashtable(); + Hashtable<String, byte[]> digs = new Hashtable<String, byte[]>(); for (int i = 0; i < numDig; i++) { AlgorithmIdentifier dai = diff --git a/pki/base/common/src/com/netscape/cms/servlet/processors/CRMFProcessor.java b/pki/base/common/src/com/netscape/cms/servlet/processors/CRMFProcessor.java index 641017cc8..2d2f1430e 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/processors/CRMFProcessor.java +++ b/pki/base/common/src/com/netscape/cms/servlet/processors/CRMFProcessor.java @@ -177,7 +177,6 @@ public class CRMFProcessor extends PKIProcessor { verifyPOP(certReqMsg); CertRequest certReq = certReqMsg.getCertReq(); - INTEGER certReqId = certReq.getCertReqId(); CertTemplate certTemplate = certReq.getCertTemplate(); X509CertInfo certInfo = CMS.getDefaultX509CertInfo(); 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 d021ef387..2849e14f3 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 @@ -59,7 +59,6 @@ import com.netscape.certsrv.profile.IProfileSubsystem; import com.netscape.certsrv.request.INotify; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.RequestStatus; -import com.netscape.certsrv.template.ArgSet; import com.netscape.cms.servlet.common.AuthCredentials; import com.netscape.cms.servlet.common.CMCOutputTemplate; import com.netscape.cms.servlet.common.CMSRequest; @@ -231,7 +230,6 @@ public class ProfileSubmitCMCServlet extends ProfileServlet { HttpServletResponse response = cmsReq.getHttpResp(); Locale locale = getLocale(request); - ArgSet args = new ArgSet(); String cert_request_type = mServletConfig.getInitParameter("cert_request_type"); String outputFormat = mServletConfig.getInitParameter("outputFormat"); @@ -645,7 +643,6 @@ public class ProfileSubmitCMCServlet extends ProfileServlet { String auditRequesterID = ILogger.UNIDENTIFIED; String auditInfoCertValue = ILogger.SIGNED_AUDIT_EMPTY_VALUE; - int responseType = 0; try { /////////////////////////////////////////////// // submit request diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitServlet.java index 4a7d70cc0..1d4cab76b 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitServlet.java @@ -39,7 +39,6 @@ import org.w3c.dom.Node; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.authentication.IAuthToken; import com.netscape.certsrv.authority.IAuthority; -import com.netscape.certsrv.authorization.AuthzToken; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.MetaInfo; import com.netscape.certsrv.base.SessionContext; @@ -1071,7 +1070,7 @@ public class ProfileSubmitServlet extends ProfileServlet { if (acl != null && acl.length() > 0) { try { String resource = profileId + ".authz.acl"; - AuthzToken authzToken = authorize(mAclMethod, resource, authToken, acl); + authorize(mAclMethod, resource, authToken, acl); } catch (Exception e) { CMS.debug("ProfileSubmitServlet authorize: " + e.toString()); if (xmlOutput) { diff --git a/pki/base/common/src/com/netscape/cms/shares/OldJoinShares.java b/pki/base/common/src/com/netscape/cms/shares/OldJoinShares.java index 3fdcb0245..f01e1e1c3 100644 --- a/pki/base/common/src/com/netscape/cms/shares/OldJoinShares.java +++ b/pki/base/common/src/com/netscape/cms/shares/OldJoinShares.java @@ -37,17 +37,17 @@ public class OldJoinShares implements IJoinShares { } public void initialize(int threshold) throws Exception { - Class c = Class.forName("com.netscape.cmscore.shares.JoinShares"); - Class types[] = { int.class }; - Constructor con = c.getConstructor(types); + Class<?> c = Class.forName("com.netscape.cmscore.shares.JoinShares"); + Class<?> types[] = { int.class }; + Constructor<?> con = c.getConstructor(types); Object params[] = { Integer.valueOf(threshold) }; mOldImpl = con.newInstance(params); } public void addShare(int shareNum, byte[] share) { try { - Class types[] = { int.class, share.getClass() }; - Class c = mOldImpl.getClass(); + Class<?> types[] = { int.class, share.getClass() }; + Class<?> c = mOldImpl.getClass(); Method method = c.getMethod("addShare", types); Object params[] = { Integer.valueOf(shareNum), share }; method.invoke(mOldImpl, params); @@ -59,8 +59,8 @@ public class OldJoinShares implements IJoinShares { if (mOldImpl == null) return -1; try { - Class types[] = null; - Class c = mOldImpl.getClass(); + Class<?> types[] = null; + Class<?> c = mOldImpl.getClass(); Method method = c.getMethod("getShareCount", types); Object params[] = null; Integer result = (Integer) method.invoke(mOldImpl, params); @@ -74,8 +74,8 @@ public class OldJoinShares implements IJoinShares { if (mOldImpl == null) return null; try { - Class types[] = null; - Class c = mOldImpl.getClass(); + Class<?> types[] = null; + Class<?> c = mOldImpl.getClass(); Method method = c.getMethod("recoverSecret", types); Object params[] = null; return (byte[]) method.invoke(mOldImpl, params); diff --git a/pki/base/common/src/com/netscape/cms/shares/OldShare.java b/pki/base/common/src/com/netscape/cms/shares/OldShare.java index a867fcbff..4020e759e 100644 --- a/pki/base/common/src/com/netscape/cms/shares/OldShare.java +++ b/pki/base/common/src/com/netscape/cms/shares/OldShare.java @@ -37,10 +37,9 @@ public class OldShare implements IShare { public void initialize(byte[] secret, int threshold) throws Exception { try { - Class c = Class.forName("com.netscape.cmscore.shares.Share"); - Class types[] = { secret.getClass(), int.class }; - Constructor cs[] = c.getConstructors(); - Constructor con = c.getConstructor(types); + Class<?> c = Class.forName("com.netscape.cmscore.shares.Share"); + Class<?> types[] = { secret.getClass(), int.class }; + Constructor<?> con = c.getConstructor(types); Object params[] = { secret, Integer.valueOf(threshold) }; mOldImpl = con.newInstance(params); } catch (Exception e) { @@ -51,8 +50,8 @@ public class OldShare implements IShare { if (mOldImpl == null) return null; try { - Class types[] = { int.class }; - Class c = mOldImpl.getClass(); + Class<?> types[] = { int.class }; + Class<?> c = mOldImpl.getClass(); Method method = c.getMethod("createShare", types); Object params[] = { Integer.valueOf(sharenumber) }; return (byte[]) method.invoke(mOldImpl, params); 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()); diff --git a/pki/base/common/test/com/netscape/cmscore/dbs/CertRecordListTest.java b/pki/base/common/test/com/netscape/cmscore/dbs/CertRecordListTest.java index 699a924d0..d3177f62c 100644 --- a/pki/base/common/test/com/netscape/cmscore/dbs/CertRecordListTest.java +++ b/pki/base/common/test/com/netscape/cmscore/dbs/CertRecordListTest.java @@ -22,6 +22,7 @@ import junit.framework.TestSuite; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.IElementProcessor; +import com.netscape.certsrv.dbs.certdb.ICertRecord; import com.netscape.cmscore.test.CMSBaseTestCase; public class CertRecordListTest extends CMSBaseTestCase { @@ -41,7 +42,7 @@ public class CertRecordListTest extends CMSBaseTestCase { } public void testProcessCertRecordsUsesSize() throws EBaseException { - DBVirtualListStub dbList = new DBVirtualListStub(); + DBVirtualListStub<ICertRecord> dbList = new DBVirtualListStub<ICertRecord>(); dbList.size = 5; CertRecordList certList = new CertRecordList(dbList); @@ -57,12 +58,12 @@ public class CertRecordListTest extends CMSBaseTestCase { assertEquals(7, dbList.lastIndexGetElementAtCalledWith); } - public class DBVirtualListStub extends DBVirtualListDefaultStub { + public class DBVirtualListStub<T> extends DBVirtualListDefaultStub<T> { public int size = 0; public int getElementAtCallCount = 0; public int lastIndexGetElementAtCalledWith = 0; - public Object getElementAt(int index) { + public T getElementAt(int index) { getElementAtCallCount++; lastIndexGetElementAtCalledWith = index; diff --git a/pki/base/common/test/com/netscape/cmscore/dbs/DBSSessionDefaultStub.java b/pki/base/common/test/com/netscape/cmscore/dbs/DBSSessionDefaultStub.java index 9ce03b55e..c00be1f45 100644 --- a/pki/base/common/test/com/netscape/cmscore/dbs/DBSSessionDefaultStub.java +++ b/pki/base/common/test/com/netscape/cmscore/dbs/DBSSessionDefaultStub.java @@ -56,7 +56,7 @@ public class DBSSessionDefaultStub implements IDBSSession { return null; } - public IDBVirtualList createVirtualList(String base, String filter, String attrs[]) throws EBaseException { + public <T> IDBVirtualList<T> createVirtualList(String base, String filter, String attrs[]) throws EBaseException { return null; } @@ -64,12 +64,12 @@ public class DBSSessionDefaultStub implements IDBSSession { return null; } - public IDBVirtualList createVirtualList(String base, String filter, String attrs[], String sortKey, int pageSize) + public <T> IDBVirtualList<T> createVirtualList(String base, String filter, String attrs[], String sortKey, int pageSize) throws EBaseException { return null; } - public IDBVirtualList createVirtualList(String base, String filter, String attrs[], String startFrom, + public <T> IDBVirtualList<T> createVirtualList(String base, String filter, String attrs[], String startFrom, String sortKey, int pageSize) throws EBaseException { return null; } diff --git a/pki/base/common/test/com/netscape/cmscore/dbs/DBVirtualListDefaultStub.java b/pki/base/common/test/com/netscape/cmscore/dbs/DBVirtualListDefaultStub.java index a750ad504..d674bd6a6 100644 --- a/pki/base/common/test/com/netscape/cmscore/dbs/DBVirtualListDefaultStub.java +++ b/pki/base/common/test/com/netscape/cmscore/dbs/DBVirtualListDefaultStub.java @@ -29,7 +29,7 @@ import com.netscape.certsrv.dbs.IElementProcessor; * * Do not put any behaviour in this class. */ -public class DBVirtualListDefaultStub implements IDBVirtualList { +public class DBVirtualListDefaultStub<T> implements IDBVirtualList<T> { public void setPageSize(int size) { } @@ -64,11 +64,11 @@ public class DBVirtualListDefaultStub implements IDBVirtualList { return false; } - public Object getElementAt(int index) { + public T getElementAt(int index) { return null; } - public Object getJumpToElementAt(int i) { + public T getJumpToElementAt(int i) { return null; } diff --git a/pki/base/java-tools/src/com/netscape/cmstools/CMCResponse.java b/pki/base/java-tools/src/com/netscape/cmstools/CMCResponse.java index e2b1a3633..21e3b4187 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/CMCResponse.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/CMCResponse.java @@ -106,8 +106,6 @@ public class CMCResponse { int numControls = controlSequence.size(); System.out.println("Number of controls is " + numControls); - INTEGER bodyPartId = null; - String error = ""; for (int i = 0; i < numControls; i++) { TaggedAttribute taggedAttr = (TaggedAttribute) controlSequence.elementAt(i); 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 470e06cf9..e4d8106f7 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/PasswordCache.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/PasswordCache.java @@ -835,7 +835,6 @@ class PWsdrCache { * list passwds in pwcache. */ public boolean pprint() { - String bufs = null; String dcrypts = null; try { diff --git a/pki/base/java-tools/src/com/netscape/cmstools/TestCRLSigning.java b/pki/base/java-tools/src/com/netscape/cmstools/TestCRLSigning.java index 10956748d..369010abf 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/TestCRLSigning.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/TestCRLSigning.java @@ -23,6 +23,7 @@ import java.util.Date; import java.util.Hashtable; import netscape.security.x509.RevokedCertImpl; +import netscape.security.x509.RevokedCertificate; import netscape.security.x509.X500Name; import netscape.security.x509.X509CRLImpl; @@ -76,10 +77,10 @@ public class TestCRLSigning { // generate revoked certificates long startPutting = System.currentTimeMillis(); Date curDate = new Date(); - Hashtable badCerts = new Hashtable(); + Hashtable<BigInteger, RevokedCertificate> badCerts = new Hashtable<BigInteger, RevokedCertificate>(); int n = Integer.parseInt(num); for (int i = 0; i < n; i++) { - badCerts.put(Integer.toString(i), + badCerts.put(new BigInteger(Integer.toString(i)), new RevokedCertImpl(new BigInteger(Integer.toString(i)), curDate)); } long endPutting = System.currentTimeMillis(); diff --git a/pki/base/kra/src/com/netscape/kra/EnrollmentService.java b/pki/base/kra/src/com/netscape/kra/EnrollmentService.java index c2705e1e4..badeaed23 100644 --- a/pki/base/kra/src/com/netscape/kra/EnrollmentService.java +++ b/pki/base/kra/src/com/netscape/kra/EnrollmentService.java @@ -508,6 +508,8 @@ public class EnrollmentService implements IService { privateKeyIn.getSequence(0); DerValue privateKeyDer = new DerValue(privateKeyIn.getOctetString()); DerInputStream privateKeyDerIn = privateKeyDer.data; + + @SuppressWarnings("unused") BigInt privateKeyVersion = privateKeyDerIn.getInteger(); BigInt privateKeyModulus = privateKeyDerIn.getInteger(); BigInt privateKeyExponent = privateKeyDerIn.getInteger(); @@ -544,7 +546,7 @@ public class EnrollmentService implements IService { */ public static PKIArchiveOptionsContainer[] getPKIArchiveOptions(String crmfBlob) throws EBaseException { - Vector<Object> options = new Vector<Object>(); + Vector<PKIArchiveOptionsContainer> options = new Vector<PKIArchiveOptionsContainer>(); if (CMS.debugOn()) CMS.debug("EnrollmentService::getPKIArchiveOptions> crmfBlob=" + crmfBlob); diff --git a/pki/base/kra/src/com/netscape/kra/KRAService.java b/pki/base/kra/src/com/netscape/kra/KRAService.java index 1a351e061..4858e286a 100644 --- a/pki/base/kra/src/com/netscape/kra/KRAService.java +++ b/pki/base/kra/src/com/netscape/kra/KRAService.java @@ -52,7 +52,7 @@ public class KRAService implements IService { // private variables private IKeyRecoveryAuthority mKRA = null; - private Hashtable<String,IService> mServices = new Hashtable<String,IService>(); + private Hashtable<String, IService> mServices = new Hashtable<String, IService>(); /** * Constructs KRA service. @@ -80,8 +80,7 @@ public class KRAService implements IService { r.getRequestId().toString()); mKRA.log(ILogger.LL_INFO, "KRA services request " + r.getRequestId().toString()); - IService s = (IService) mServices.get( - r.getRequestType()); + IService s = mServices.get(r.getRequestType()); if (s == null) { r.setExtData(IRequest.RESULT, IRequest.RES_ERROR); diff --git a/pki/base/kra/src/com/netscape/kra/RecoveryService.java b/pki/base/kra/src/com/netscape/kra/RecoveryService.java index 8958695c1..89f8f042a 100644 --- a/pki/base/kra/src/com/netscape/kra/RecoveryService.java +++ b/pki/base/kra/src/com/netscape/kra/RecoveryService.java @@ -168,7 +168,7 @@ public class RecoveryService implements IService { // byte publicKey[] = (byte[])request.get(ATTR_PUBLIC_KEY_DATA); // X500Name owner = (X500Name)request.get(ATTR_OWNER_NAME); - Hashtable params = mKRA.getVolatileRequest( + Hashtable<String, Object> params = mKRA.getVolatileRequest( request.getRequestId()); if (params == null) { @@ -345,6 +345,8 @@ public class RecoveryService implements IService { privateKeyIn.getSequence(0); DerValue privateKeyDer = new DerValue(privateKeyIn.getOctetString()); DerInputStream privateKeyDerIn = privateKeyDer.data; + + @SuppressWarnings("unused") BigInt privateKeyVersion = privateKeyDerIn.getInteger(); BigInt privateKeyModulus = privateKeyDerIn.getInteger(); BigInt privateKeyExponent = privateKeyDerIn.getInteger(); @@ -372,7 +374,7 @@ public class RecoveryService implements IService { * Recovers key. (using unwrapping/wrapping on token) * - used when allowEncDecrypt_recovery is false */ - public synchronized PrivateKey recoverKey(Hashtable request, KeyRecord keyRecord, boolean isRSA) + public synchronized PrivateKey recoverKey(Hashtable<String, Object> request, KeyRecord keyRecord, boolean isRSA) throws EBaseException { if (!isRSA) { @@ -437,7 +439,7 @@ public class RecoveryService implements IService { * @param priKey private key handle * @exception EBaseException failed to create P12 file */ - public void createPFX(IRequest request, Hashtable params, + public void createPFX(IRequest request, Hashtable<String, Object> params, PrivateKey priKey, CryptoToken ct) throws EBaseException { CMS.debug("RecoverService: createPFX() allowEncDecrypt_recovery=false"); try { @@ -531,7 +533,7 @@ public class RecoveryService implements IService { * Recovers key. * - used when allowEncDecrypt_recovery is true */ - public synchronized byte[] recoverKey(Hashtable request, KeyRecord keyRecord) + public synchronized byte[] recoverKey(Hashtable<String, Object> request, KeyRecord keyRecord) throws EBaseException { if (CMS.getConfigStore().getBoolean("kra.keySplitting")) { Credential creds[] = (Credential[]) @@ -562,7 +564,7 @@ public class RecoveryService implements IService { * @param priData decrypted private key (PrivateKeyInfo) * @exception EBaseException failed to create P12 file */ - public void createPFX(IRequest request, Hashtable params, + public void createPFX(IRequest request, Hashtable<String, Object> params, byte priData[]) throws EBaseException { CMS.debug("RecoverService: createPFX() allowEncDecrypt_recovery=true"); try { diff --git a/pki/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java b/pki/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java index 0b84926d1..3a860f447 100644 --- a/pki/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java +++ b/pki/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java @@ -225,7 +225,7 @@ public class TokenKeyRecoveryService implements IService { (String) sContext.get(SessionContext.USER_ID); } - Hashtable params = mKRA.getVolatileRequest( + Hashtable<String, Object> params = mKRA.getVolatileRequest( request.getRequestId()); if (params == null) { @@ -579,7 +579,7 @@ public class TokenKeyRecoveryService implements IService { /** * Recovers key. */ - public synchronized byte[] recoverKey(Hashtable request, KeyRecord keyRecord) + public synchronized byte[] recoverKey(Hashtable<String, Object> request, KeyRecord keyRecord) throws EBaseException { /* Credential creds[] = (Credential[]) diff --git a/pki/base/ocsp/src/com/netscape/ocsp/OCSPAuthority.java b/pki/base/ocsp/src/com/netscape/ocsp/OCSPAuthority.java index 91763ed83..f009bd56f 100644 --- a/pki/base/ocsp/src/com/netscape/ocsp/OCSPAuthority.java +++ b/pki/base/ocsp/src/com/netscape/ocsp/OCSPAuthority.java @@ -81,13 +81,12 @@ public class OCSPAuthority implements IOCSPAuthority, IOCSPService, ISubsystem, public final static OBJECT_IDENTIFIER OCSP_NONCE = new OBJECT_IDENTIFIER("1.3.6.1.5.5.7.48.1.2"); - private Hashtable mStores = new Hashtable(); + private Hashtable<String, IOCSPStore> mStores = new Hashtable<String, IOCSPStore>(); private String mId = "ocsp"; private IConfigStore mConfig = null; private SigningUnit mSigningUnit; private CertificateChain mCertChain = null; private X509CertImpl mCert = null; - private String[] mSigningAlgorithms = null; private X500Name mName = null; private String mNickname = null; private String[] mOCSPSigningAlgorithms = null; @@ -172,7 +171,7 @@ public class OCSPAuthority implements IOCSPAuthority, IOCSPService, ISubsystem, * Retrieves the specificed OCSP store. */ public IOCSPStore getOCSPStore(String id) { - return (IOCSPStore) mStores.get(id); + return mStores.get(id); } public IConfigStore getOCSPStoreConfig(String id) { @@ -452,7 +451,6 @@ public class OCSPAuthority implements IOCSPAuthority, IOCSPService, ISubsystem, DerOutputStream tmpChain = new DerOutputStream(); DerOutputStream tmp1 = new DerOutputStream(); - DerOutputStream outChain = new DerOutputStream(); java.security.cert.X509Certificate chains[] = mCertChain.getChain(); diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureDRM.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureDRM.java index 3dd708a3a..caf393ad9 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureDRM.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureDRM.java @@ -225,7 +225,6 @@ public class ConfigureDRM { } public boolean TokenChoicePanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -273,7 +272,6 @@ public class ConfigureDRM { } public boolean DomainPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -299,14 +297,8 @@ public class ConfigureDRM { } public boolean DisplayChainPanel() { - boolean st = false; - HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); - String query_string = null; - - query_string = "p=4" + "&op=next" + "&xml=true"; - hr = hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); + String query_string = "p=4" + "&op=next" + "&xml=true"; + hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); return true; @@ -314,10 +306,7 @@ public class ConfigureDRM { public boolean SecurityDomainLoginPanel() { try { - boolean st = false; HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); String kra_url = "https://" + cs_hostname + ":" + cs_port + "/kra/admin/console/config/wizard" + @@ -374,7 +363,6 @@ public class ConfigureDRM { } public boolean SubsystemPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -424,7 +412,6 @@ public class ConfigureDRM { } public boolean LdapConnectionPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -452,7 +439,6 @@ public class ConfigureDRM { } public boolean KeyPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -540,7 +526,6 @@ public class ConfigureDRM { } public boolean CertSubjectPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -611,14 +596,9 @@ public class ConfigureDRM { } public boolean CertificatePanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList<String> req_list = null; - ArrayList<String> cert_list = null; - ArrayList<String> dn_list = null; - ArrayList<String> pp_list = null; String query_string = "p=10" + "&op=next" + "&xml=true" + "&subsystem=" + @@ -648,7 +628,6 @@ public class ConfigureDRM { } public boolean BackupPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -669,7 +648,6 @@ public class ConfigureDRM { } public boolean SavePKCS12Panel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -692,7 +670,7 @@ public class ConfigureDRM { String line = null; while ((line = br.readLine()) != null) System.out.println("Error: " + line); - int exitVal = proc.waitFor(); + proc.waitFor(); // verify p12 file @@ -729,7 +707,6 @@ public class ConfigureDRM { } public boolean AdminCertReqPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -788,8 +765,6 @@ public class ConfigureDRM { public boolean AdminCertImportPanel() { boolean st = false; HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); String query_string = "serialNumber=" + admin_serial_number + "&importCert=" + "true"; @@ -826,7 +801,6 @@ public class ConfigureDRM { } public boolean UpdateDomainPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureOCSP.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureOCSP.java index 7e481c791..bf599ed4c 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureOCSP.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureOCSP.java @@ -207,7 +207,6 @@ public class ConfigureOCSP { } public boolean TokenChoicePanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -257,7 +256,6 @@ public class ConfigureOCSP { } public boolean DomainPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -283,14 +281,10 @@ public class ConfigureOCSP { } public boolean DisplayChainPanel() { - boolean st = false; - HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); String query_string = null; query_string = "p=4" + "&op=next" + "&xml=true"; - hr = hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); + hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); // parse xml // bais = new ByteArrayInputStream(hr.getHTML().getBytes()); // px.parse(bais); @@ -301,10 +295,7 @@ public class ConfigureOCSP { } public boolean SecurityDomainLoginPanel() { - boolean st = false; HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); String ocsp_url = "https://" + cs_hostname + ":" + cs_port + "/ocsp/admin/console/config/wizard" + @@ -349,7 +340,6 @@ public class ConfigureOCSP { } public boolean SubsystemPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -369,7 +359,6 @@ public class ConfigureOCSP { } public boolean LdapConnectionPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -397,7 +386,6 @@ public class ConfigureOCSP { } public boolean KeyPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -460,7 +448,6 @@ public class ConfigureOCSP { } public boolean CertSubjectPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -518,14 +505,9 @@ public class ConfigureOCSP { } public boolean CertificatePanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList<String> req_list = null; - ArrayList<String> cert_list = null; - ArrayList<String> dn_list = null; - ArrayList<String> pp_list = null; String query_string = "p=10" + "&op=next" + "&xml=true" + "&subsystem=" + @@ -556,7 +538,6 @@ public class ConfigureOCSP { } public boolean BackupPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -577,10 +558,7 @@ public class ConfigureOCSP { } public boolean SavePKCS12Panel() { - boolean st = false; HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); String query_string = ""; @@ -601,7 +579,7 @@ public class ConfigureOCSP { String line = null; while ((line = br.readLine()) != null) System.out.println("Error: " + line); - int exitVal = proc.waitFor(); + proc.waitFor(); // verify p12 file @@ -628,7 +606,6 @@ public class ConfigureOCSP { } public boolean AdminCertReqPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -690,8 +667,6 @@ public class ConfigureOCSP { public boolean AdminCertImportPanel() { boolean st = false; HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); String query_string = "serialNumber=" + admin_serial_number + "&importCert=" + "true" + @@ -729,7 +704,6 @@ public class ConfigureOCSP { } public boolean UpdateDomainPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); diff --git a/pki/base/silent/src/com/netscape/pkisilent/ConfigureRA.java b/pki/base/silent/src/com/netscape/pkisilent/ConfigureRA.java index a9345cc5f..d8a6c7feb 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/ConfigureRA.java +++ b/pki/base/silent/src/com/netscape/pkisilent/ConfigureRA.java @@ -20,7 +20,6 @@ package com.netscape.pkisilent; import java.io.ByteArrayInputStream; import java.net.URLEncoder; -import java.util.ArrayList; import com.netscape.osutil.OSUtil; import com.netscape.pkisilent.argparser.ArgParser; @@ -160,7 +159,6 @@ public class ConfigureRA { } public boolean DomainPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -186,24 +184,15 @@ public class ConfigureRA { } public boolean DisplayChainPanel() { - boolean st = false; - HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); - String query_string = null; - - query_string = "p=2" + "&op=next" + "&xml=true"; - hr = hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); + String query_string = "p=2" + "&op=next" + "&xml=true"; + hc.sslConnect(cs_hostname, cs_port, wizard_uri, query_string); return true; } public boolean SecurityDomainLoginPanel() { - boolean st = false; HTTPResponse hr = null; - ByteArrayInputStream bais = null; - ParseXML px = new ParseXML(); String ra_url = "https://" + cs_hostname + ":" + cs_port + "/ra/admin/console/config/wizard" + @@ -247,7 +236,6 @@ public class ConfigureRA { } public boolean SubsystemPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -285,7 +273,6 @@ public class ConfigureRA { } public boolean DBPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -305,7 +292,6 @@ public class ConfigureRA { } public boolean TokenChoicePanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -363,7 +349,6 @@ public class ConfigureRA { } public boolean KeyPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -392,13 +377,9 @@ public class ConfigureRA { } public boolean CertSubjectPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); - ArrayList<String> req_list = null; - ArrayList<String> cert_list = null; - ArrayList<String> dn_list = null; String ca_url = "https://" + ca_hostname + ":" + ca_ssl_port; @@ -426,7 +407,6 @@ public class ConfigureRA { } public boolean CertificatePanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); @@ -450,7 +430,6 @@ public class ConfigureRA { } public boolean AdminCertReqPanel() { - boolean st = false; HTTPResponse hr = null; ByteArrayInputStream bais = null; ParseXML px = new ParseXML(); diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java b/pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java index 1c308e2c2..d619afcc2 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/ComCrypto.java @@ -248,7 +248,7 @@ public class ComCrypto { System.out.println("Manager object is null"); } - X509Certificate cert = manager.importCertPackage(tmp.getBytes(), cn); + manager.importCertPackage(tmp.getBytes(), cn); return true; @@ -277,7 +277,7 @@ public class ComCrypto { System.out.println("Manager object is null"); } - X509Certificate cert = manager.importCACertPackage(tmp.getBytes()); + manager.importCACertPackage(tmp.getBytes()); return true; diff --git a/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java b/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java index 38b405673..c2ac547e6 100644 --- a/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java +++ b/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java @@ -1035,7 +1035,6 @@ public class CryptoUtil { */ public static void deletePrivateKey(PrivateKey prikey) throws CryptoManager.NotInitializedException, TokenException { - CryptoManager cm = CryptoManager.getInstance(); try { CryptoToken token = prikey.getOwningToken(); diff --git a/pki/base/util/src/com/netscape/cmsutil/http/JssSSLSocketFactory.java b/pki/base/util/src/com/netscape/cmsutil/http/JssSSLSocketFactory.java index 791549812..d0bef4b2a 100644 --- a/pki/base/util/src/com/netscape/cmsutil/http/JssSSLSocketFactory.java +++ b/pki/base/util/src/com/netscape/cmsutil/http/JssSSLSocketFactory.java @@ -132,7 +132,7 @@ public class JssSSLSocketFactory implements ISocketFactory { // report error if the nickName is invalid. // So we check this ourself using // findCertByNickname - X509Certificate cert = CryptoManager.getInstance().findCertByNickname(mClientAuthCertNickname); + CryptoManager.getInstance().findCertByNickname(mClientAuthCertNickname); s.setClientCertNickname(mClientAuthCertNickname); } diff --git a/pki/base/util/src/com/netscape/cmsutil/password/IPasswordReader.java b/pki/base/util/src/com/netscape/cmsutil/password/IPasswordReader.java index 357ae0a6c..759e9e777 100644 --- a/pki/base/util/src/com/netscape/cmsutil/password/IPasswordReader.java +++ b/pki/base/util/src/com/netscape/cmsutil/password/IPasswordReader.java @@ -25,5 +25,5 @@ public interface IPasswordReader { public String getPassword(String tag); - public Enumeration getTags(); + public Enumeration<String> getTags(); } diff --git a/pki/base/util/src/com/netscape/cmsutil/password/IPasswordStore.java b/pki/base/util/src/com/netscape/cmsutil/password/IPasswordStore.java index f2e9293d3..49b2610fa 100644 --- a/pki/base/util/src/com/netscape/cmsutil/password/IPasswordStore.java +++ b/pki/base/util/src/com/netscape/cmsutil/password/IPasswordStore.java @@ -25,7 +25,7 @@ public interface IPasswordStore { public String getPassword(String tag); - public Enumeration getTags(); + public Enumeration<String> getTags(); public Object putPassword(String tag, String password); diff --git a/pki/base/util/src/com/netscape/cmsutil/password/PlainPasswordFile.java b/pki/base/util/src/com/netscape/cmsutil/password/PlainPasswordFile.java index 91a45ca3b..eb43607f0 100644 --- a/pki/base/util/src/com/netscape/cmsutil/password/PlainPasswordFile.java +++ b/pki/base/util/src/com/netscape/cmsutil/password/PlainPasswordFile.java @@ -22,6 +22,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.Enumeration; import java.util.Properties; +import java.util.Vector; public class PlainPasswordFile implements IPasswordStore { private String mPwdPath = ""; @@ -47,8 +48,13 @@ public class PlainPasswordFile implements IPasswordStore { } // return an array of String-based tag - public Enumeration<?> getTags() { - return mPwdStore.propertyNames(); + public Enumeration<String> getTags() { + Enumeration<?> e = mPwdStore.propertyNames(); + Vector<String> v = new Vector<String>(); + while (e.hasMoreElements()) { + v.add((String) e.nextElement()); + } + return v.elements(); } public Object putPassword(String tag, String password) { diff --git a/pki/base/util/src/com/netscape/cmsutil/password/PlainPasswordReader.java b/pki/base/util/src/com/netscape/cmsutil/password/PlainPasswordReader.java index 10f33350c..68724a9f6 100644 --- a/pki/base/util/src/com/netscape/cmsutil/password/PlainPasswordReader.java +++ b/pki/base/util/src/com/netscape/cmsutil/password/PlainPasswordReader.java @@ -21,6 +21,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.util.Enumeration; import java.util.Properties; +import java.util.Vector; public class PlainPasswordReader implements IPasswordReader { private String mPwdPath = ""; @@ -46,7 +47,12 @@ public class PlainPasswordReader implements IPasswordReader { } // return an array of String-based tag - public Enumeration<?> getTags() { - return mPwdStore.propertyNames(); + public Enumeration<String> getTags() { + Enumeration<?> e = mPwdStore.propertyNames(); + Vector<String> v = new Vector<String>(); + while (e.hasMoreElements()) { + v.add((String) e.nextElement()); + } + return v.elements(); } } diff --git a/pki/base/util/src/com/netscape/cmsutil/util/Utils.java b/pki/base/util/src/com/netscape/cmsutil/util/Utils.java index 6f4ba4976..07916fb6a 100644 --- a/pki/base/util/src/com/netscape/cmsutil/util/Utils.java +++ b/pki/base/util/src/com/netscape/cmsutil/util/Utils.java @@ -145,7 +145,7 @@ public class Utils { } public static void checkHost(String hostname) throws UnknownHostException { - InetAddress addr = InetAddress.getByName(hostname); + InetAddress.getByName(hostname); } public static void copy(String orig, String dest) { diff --git a/pki/base/util/src/netscape/security/pkcs/PKCS7.java b/pki/base/util/src/netscape/security/pkcs/PKCS7.java index b28c570c3..4de75a4e1 100644 --- a/pki/base/util/src/netscape/security/pkcs/PKCS7.java +++ b/pki/base/util/src/netscape/security/pkcs/PKCS7.java @@ -272,9 +272,6 @@ public class PKCS7 { // contentInfo contentInfo.encode(signedData); - // certificates - DerOutputStream certs = new DerOutputStream(); - // cast to X509CertImpl[] since X509CertImpl implements DerEncoder X509CertImpl implCerts[] = new X509CertImpl[certificates.length]; try { diff --git a/pki/base/util/src/netscape/security/pkcs/PKCS8Key.java b/pki/base/util/src/netscape/security/pkcs/PKCS8Key.java index b3ec07906..6fc89610a 100644 --- a/pki/base/util/src/netscape/security/pkcs/PKCS8Key.java +++ b/pki/base/util/src/netscape/security/pkcs/PKCS8Key.java @@ -184,7 +184,7 @@ public class PKCS8Key implements PrivateKey { throw new InstantiationException(); } - Class keyClass = Class.forName(classname); + Class<?> keyClass = Class.forName(classname); Object inst; PKCS8Key result; diff --git a/pki/base/util/src/netscape/security/pkcs/PKCS9Attributes.java b/pki/base/util/src/netscape/security/pkcs/PKCS9Attributes.java index 6f7ce6abb..485cdded1 100644 --- a/pki/base/util/src/netscape/security/pkcs/PKCS9Attributes.java +++ b/pki/base/util/src/netscape/security/pkcs/PKCS9Attributes.java @@ -38,12 +38,12 @@ public class PKCS9Attributes { /** * Attributes in this set indexed by OID. */ - private final Hashtable attributes = new Hashtable(3); + private final Hashtable<ObjectIdentifier, PKCS9Attribute> attributes = new Hashtable<ObjectIdentifier, PKCS9Attribute>(3); /** * The keys of this hashtable are the OIDs of permitted attributes. */ - private final Hashtable permittedAttributes; + private final Hashtable<ObjectIdentifier, ObjectIdentifier> permittedAttributes; /** * The DER encoding of this attribute set. The tag byte must be @@ -73,7 +73,7 @@ public class PKCS9Attributes { DerInputStream in) throws IOException { if (permittedAttributes != null) { this.permittedAttributes = - new Hashtable(permittedAttributes.length); + new Hashtable<ObjectIdentifier, ObjectIdentifier>(permittedAttributes.length); for (int i = 0; i < permittedAttributes.length; i++) this.permittedAttributes.put(permittedAttributes[i], @@ -157,7 +157,6 @@ public class PKCS9Attributes { PKCS9Attribute attrib; ObjectIdentifier oid; - int index; for (int i = 0; i < derVals.length; i++) { attrib = new PKCS9Attribute(derVals[i]); @@ -213,14 +212,14 @@ public class PKCS9Attributes { * Get an attribute from this set. */ public PKCS9Attribute getAttribute(ObjectIdentifier oid) { - return (PKCS9Attribute) attributes.get(oid); + return attributes.get(oid); } /** * Get an attribute from this set. */ public PKCS9Attribute getAttribute(String name) { - return (PKCS9Attribute) attributes.get(PKCS9Attribute.getOID(name)); + return attributes.get(PKCS9Attribute.getOID(name)); } /** @@ -228,7 +227,6 @@ public class PKCS9Attributes { */ public PKCS9Attribute[] getAttributes() { PKCS9Attribute[] attribs = new PKCS9Attribute[attributes.size()]; - ObjectIdentifier oid; int j = 0; for (int i = 1; i < PKCS9Attribute.PKCS9_OIDS.length && @@ -275,7 +273,6 @@ public class PKCS9Attributes { StringBuffer buf = new StringBuffer(200); buf.append("PKCS9 Attributes: [\n\t"); - ObjectIdentifier oid; PKCS9Attribute value; boolean first = true; diff --git a/pki/base/util/src/netscape/security/provider/CMS.java b/pki/base/util/src/netscape/security/provider/CMS.java index fffa00dea..4a4f150ab 100644 --- a/pki/base/util/src/netscape/security/provider/CMS.java +++ b/pki/base/util/src/netscape/security/provider/CMS.java @@ -38,7 +38,7 @@ public final class CMS extends Provider { /* We are the SUN provider */ super("CMS", 1.0, INFO); - AccessController.doPrivileged(new java.security.PrivilegedAction() { + AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() { public Object run() { /* * Certificates diff --git a/pki/base/util/src/netscape/security/provider/DSAKeyFactory.java b/pki/base/util/src/netscape/security/provider/DSAKeyFactory.java index 1d77a7283..41f0081f2 100755 --- a/pki/base/util/src/netscape/security/provider/DSAKeyFactory.java +++ b/pki/base/util/src/netscape/security/provider/DSAKeyFactory.java @@ -122,7 +122,8 @@ public class DSAKeyFactory extends KeyFactorySpi { * inappropriate for the given key, or the given key cannot be processed * (e.g., the given key has an unrecognized algorithm or format). */ - protected KeySpec engineGetKeySpec(Key key, Class keySpec) + @SuppressWarnings("unchecked") + protected <T extends KeySpec> T engineGetKeySpec(Key key, Class<T> keySpec) throws InvalidKeySpecException { DSAParams params; @@ -132,21 +133,21 @@ public class DSAKeyFactory extends KeyFactorySpi { if (key instanceof java.security.interfaces.DSAPublicKey) { // Determine valid key specs - Class dsaPubKeySpec = Class.forName + Class<?> dsaPubKeySpec = Class.forName ("java.security.spec.DSAPublicKeySpec"); - Class x509KeySpec = Class.forName + Class<?> x509KeySpec = Class.forName ("java.security.spec.X509EncodedKeySpec"); if (dsaPubKeySpec.isAssignableFrom(keySpec)) { java.security.interfaces.DSAPublicKey dsaPubKey = (java.security.interfaces.DSAPublicKey) key; params = dsaPubKey.getParams(); - return new DSAPublicKeySpec(dsaPubKey.getY(), + return (T) new DSAPublicKeySpec(dsaPubKey.getY(), params.getP(), params.getQ(), params.getG()); } else if (x509KeySpec.isAssignableFrom(keySpec)) { - return new X509EncodedKeySpec(key.getEncoded()); + return (T) new X509EncodedKeySpec(key.getEncoded()); } else { throw new InvalidKeySpecException("Inappropriate key specification"); @@ -155,21 +156,21 @@ public class DSAKeyFactory extends KeyFactorySpi { } else if (key instanceof java.security.interfaces.DSAPrivateKey) { // Determine valid key specs - Class dsaPrivKeySpec = Class.forName + Class<?> dsaPrivKeySpec = Class.forName ("java.security.spec.DSAPrivateKeySpec"); - Class pkcs8KeySpec = Class.forName + Class<?> pkcs8KeySpec = Class.forName ("java.security.spec.PKCS8EncodedKeySpec"); if (dsaPrivKeySpec.isAssignableFrom(keySpec)) { java.security.interfaces.DSAPrivateKey dsaPrivKey = (java.security.interfaces.DSAPrivateKey) key; params = dsaPrivKey.getParams(); - return new DSAPrivateKeySpec(dsaPrivKey.getX(), + return (T) new DSAPrivateKeySpec(dsaPrivKey.getX(), params.getP(), params.getQ(), params.getG()); } else if (pkcs8KeySpec.isAssignableFrom(keySpec)) { - return new PKCS8EncodedKeySpec(key.getEncoded()); + return (T) new PKCS8EncodedKeySpec(key.getEncoded()); } else { throw new InvalidKeySpecException("Inappropriate key specification"); @@ -205,8 +206,7 @@ public class DSAKeyFactory extends KeyFactorySpi { return key; } // Convert key to spec - DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec) engineGetKeySpec - (key, DSAPublicKeySpec.class); + DSAPublicKeySpec dsaPubKeySpec = engineGetKeySpec(key, DSAPublicKeySpec.class); // Create key from spec, and return it return engineGeneratePublic(dsaPubKeySpec); @@ -216,8 +216,7 @@ public class DSAKeyFactory extends KeyFactorySpi { return key; } // Convert key to spec - DSAPrivateKeySpec dsaPrivKeySpec = (DSAPrivateKeySpec) engineGetKeySpec - (key, DSAPrivateKeySpec.class); + DSAPrivateKeySpec dsaPrivKeySpec = engineGetKeySpec(key, DSAPrivateKeySpec.class); // Create key from spec, and return it return engineGeneratePrivate(dsaPrivKeySpec); diff --git a/pki/base/util/src/netscape/security/provider/DSAParameters.java b/pki/base/util/src/netscape/security/provider/DSAParameters.java index cc3012f75..e2a5dd128 100755 --- a/pki/base/util/src/netscape/security/provider/DSAParameters.java +++ b/pki/base/util/src/netscape/security/provider/DSAParameters.java @@ -86,13 +86,14 @@ public class DSAParameters extends AlgorithmParametersSpi { engineInit(params); } - protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec) + @SuppressWarnings("unchecked") + protected <T extends AlgorithmParameterSpec> T engineGetParameterSpec(Class<T> paramSpec) throws InvalidParameterSpecException { try { - Class dsaParamSpec = Class.forName + Class<?> dsaParamSpec = Class.forName ("java.security.spec.DSAParameterSpec"); if (dsaParamSpec.isAssignableFrom(paramSpec)) { - return new DSAParameterSpec(this.p, this.q, this.g); + return (T) new DSAParameterSpec(this.p, this.q, this.g); } else { throw new InvalidParameterSpecException("Inappropriate parameter Specification"); } diff --git a/pki/base/util/src/netscape/security/util/ASN1CharStrConvMap.java b/pki/base/util/src/netscape/security/util/ASN1CharStrConvMap.java index 972c57846..c9c364f4f 100644 --- a/pki/base/util/src/netscape/security/util/ASN1CharStrConvMap.java +++ b/pki/base/util/src/netscape/security/util/ASN1CharStrConvMap.java @@ -20,7 +20,6 @@ package netscape.security.util; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetEncoder; -import java.nio.charset.CodingErrorAction; import java.util.HashMap; import java.util.Iterator; import java.util.Map; diff --git a/pki/base/util/src/netscape/security/util/ByteArrayLexOrder.java b/pki/base/util/src/netscape/security/util/ByteArrayLexOrder.java index ded4522d9..2ee2f740e 100644 --- a/pki/base/util/src/netscape/security/util/ByteArrayLexOrder.java +++ b/pki/base/util/src/netscape/security/util/ByteArrayLexOrder.java @@ -25,7 +25,7 @@ import java.util.Comparator; * @version 1.4 97/12/10 * @author D. N. Hoover */ -public class ByteArrayLexOrder implements Comparator { +public class ByteArrayLexOrder implements Comparator<byte[]> { /** * Perform lexicographical comparison of two byte arrays, @@ -41,10 +41,7 @@ public class ByteArrayLexOrder implements Comparator { * * @exception <code>ClassCastException</code> if either argument is not a byte array. */ - public final int compare(Object obj1, Object obj2) { - - byte[] bytes1 = (byte[]) obj1; - byte[] bytes2 = (byte[]) obj2; + public final int compare(byte[] bytes1, byte[] bytes2) { int diff; for (int i = 0; i < bytes1.length && i < bytes2.length; i++) { diff --git a/pki/base/util/src/netscape/security/util/ByteArrayTagOrder.java b/pki/base/util/src/netscape/security/util/ByteArrayTagOrder.java index 1367ee043..e57a3b5f1 100644 --- a/pki/base/util/src/netscape/security/util/ByteArrayTagOrder.java +++ b/pki/base/util/src/netscape/security/util/ByteArrayTagOrder.java @@ -19,7 +19,7 @@ package netscape.security.util; import java.util.Comparator; -public class ByteArrayTagOrder implements Comparator { +public class ByteArrayTagOrder implements Comparator<byte[]> { /** * Compare two byte arrays, by the order of their tags, @@ -34,10 +34,7 @@ public class ByteArrayTagOrder implements Comparator { * @exception <code>ClassCastException</code> if either argument is not a byte array. */ - public final int compare(Object obj1, Object obj2) { - - byte[] bytes1 = (byte[]) obj1; - byte[] bytes2 = (byte[]) obj2; + public final int compare(byte[] bytes1, byte[] bytes2) { // tag order is same as byte order ignoring any difference in // the constructivity bit (0x02) diff --git a/pki/base/util/src/netscape/security/util/DerOutputStream.java b/pki/base/util/src/netscape/security/util/DerOutputStream.java index 44a4df8f0..62290d604 100644 --- a/pki/base/util/src/netscape/security/util/DerOutputStream.java +++ b/pki/base/util/src/netscape/security/util/DerOutputStream.java @@ -460,7 +460,7 @@ public class DerOutputStream * @param order the order to use when sorting encodings of components. */ private void putOrderedSet(byte tag, DerEncoder[] set, - Comparator order) throws IOException { + Comparator<byte[]> order) throws IOException { DerOutputStream[] streams = new DerOutputStream[set.length]; for (int i = 0; i < set.length; i++) { diff --git a/pki/base/util/src/netscape/security/util/ObjectIdentifier.java b/pki/base/util/src/netscape/security/util/ObjectIdentifier.java index 8dd547760..6ff02d1b0 100644 --- a/pki/base/util/src/netscape/security/util/ObjectIdentifier.java +++ b/pki/base/util/src/netscape/security/util/ObjectIdentifier.java @@ -19,6 +19,7 @@ package netscape.security.util; import java.io.IOException; import java.io.Serializable; +import java.util.Hashtable; import java.util.StringTokenizer; /** @@ -376,7 +377,7 @@ final public class ObjectIdentifier implements Serializable { * This function never returns null. IOException is raised * in error conditions. */ - public static java.util.Hashtable mOIDs = new java.util.Hashtable(); + public static Hashtable<String, ObjectIdentifier> mOIDs = new Hashtable<String, ObjectIdentifier>(); public static ObjectIdentifier getObjectIdentifier(String oid) throws IOException { @@ -387,7 +388,7 @@ final public class ObjectIdentifier implements Serializable { oid = oid.trim(); - ObjectIdentifier thisOID = (ObjectIdentifier) mOIDs.get(oid); + ObjectIdentifier thisOID = mOIDs.get(oid); if (thisOID != null) return thisOID; diff --git a/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java b/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java index 320bbf3df..c749ae04e 100644 --- a/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java +++ b/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java @@ -29,7 +29,6 @@ import java.util.Vector; import netscape.security.util.BitArray; import netscape.security.util.DerOutputStream; -import netscape.security.x509.FreshestCRLExtension.Reason; import org.mozilla.jss.asn1.ASN1Util; import org.mozilla.jss.asn1.InvalidBERException; diff --git a/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java b/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java index fd6e15bfb..52ff67017 100644 --- a/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java +++ b/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java @@ -134,8 +134,6 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter { throws IOException { StringReader rdn_reader = new StringReader(rdn); PushbackReader in = new PushbackReader(rdn_reader, 5); - Vector<AVA> avaVector = new Vector<AVA>(); - AVA[] assertion; return parseRDN(in, null); } @@ -649,7 +647,7 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter { * production as practical. */ StringBuffer retval = new StringBuffer(30); - int i, j; + int i; String temp = null; AVAValueConverter valueConverter; diff --git a/pki/base/util/src/netscape/security/x509/RDN.java b/pki/base/util/src/netscape/security/x509/RDN.java index 79e494638..c5e8765a0 100644 --- a/pki/base/util/src/netscape/security/x509/RDN.java +++ b/pki/base/util/src/netscape/security/x509/RDN.java @@ -193,7 +193,6 @@ public class RDN { } public AVA nextElement() { - AVA ava = null; if (index >= assertion.length) return null; return assertion[index++]; diff --git a/pki/base/util/src/netscape/security/x509/X509Cert.java b/pki/base/util/src/netscape/security/x509/X509Cert.java index b524f779b..9ab7ba754 100644 --- a/pki/base/util/src/netscape/security/x509/X509Cert.java +++ b/pki/base/util/src/netscape/security/x509/X509Cert.java @@ -444,7 +444,6 @@ public class X509Cert implements Certificate, Serializable { */ public Signature getVerifier(String algorithm) throws NoSuchAlgorithmException, InvalidKeyException { - String algName; Signature sig; sig = Signature.getInstance(algorithm); |