diff options
217 files changed, 1657 insertions, 1389 deletions
diff --git a/pki/base/ca/src/com/netscape/ca/CAService.java b/pki/base/ca/src/com/netscape/ca/CAService.java index d6f02a059..d086ee551 100644 --- a/pki/base/ca/src/com/netscape/ca/CAService.java +++ b/pki/base/ca/src/com/netscape/ca/CAService.java @@ -45,6 +45,7 @@ import netscape.security.x509.CertificateIssuerName; import netscape.security.x509.CertificateSerialNumber; import netscape.security.x509.CertificateSubjectName; import netscape.security.x509.CertificateValidity; +import netscape.security.x509.Extension; import netscape.security.x509.LdapV3DNStrConverter; import netscape.security.x509.PKIXExtensions; import netscape.security.x509.RevocationReason; @@ -104,11 +105,11 @@ public class CAService implements ICAService, IService { protected static IConnector mCLAConnector = null; private ICertificateAuthority mCA = null; - private Hashtable mServants = new Hashtable(); + private Hashtable<String, IServant> mServants = new Hashtable<String, IServant>(); private IConnector mKRAConnector = null; private IConfigStore mConfig = null; private boolean mArchivalRequired = true; - private Hashtable mCRLIssuingPoints = new Hashtable(); + private Hashtable<String, ICRLIssuingPoint> mCRLIssuingPoints = new Hashtable<String, ICRLIssuingPoint>(); private ILogger mSignedAuditLogger = CMS.getSignedAuditLogger(); private final static String LOGGING_SIGNED_AUDIT_PRIVATE_KEY_ARCHIVE_REQUEST = @@ -289,7 +290,8 @@ public class CAService implements ICAService, IService { if (timeout == 0) connector = new HttpConnector((IAuthority) mCA, nickname, remauthority, resendInterval, config); else - connector = new HttpConnector((IAuthority) mCA, nickname, remauthority, resendInterval, config, timeout); + connector = + new HttpConnector((IAuthority) mCA, nickname, remauthority, resendInterval, config, timeout); // Change end // log(ILogger.LL_INFO, "remote authority "+ @@ -370,8 +372,8 @@ public class CAService implements ICAService, IService { // short cut profile-based request if (isProfileRequest(request)) { try { - CMS.debug("CAServic: x0 requestStatus=" + request.getRequestStatus().toString() + " instance=" - + request); + CMS.debug("CAServic: x0 requestStatus=" + + request.getRequestStatus().toString() + " instance=" + request); serviceProfileRequest(request); request.setExtData(IRequest.RESULT, IRequest.RES_SUCCESS); CMS.debug("CAServic: x1 requestStatus=" + request.getRequestStatus().toString()); @@ -530,7 +532,7 @@ public class CAService implements ICAService, IService { /** * get CRL Issuing Point */ - public Hashtable getCRLIssuingPoints() { + public Hashtable<String, ICRLIssuingPoint> getCRLIssuingPoints() { return mCRLIssuingPoints; } @@ -683,7 +685,7 @@ public class CAService implements ICAService, IService { exts = (CertificateExtensions) certi.get(X509CertInfo.EXTENSIONS); if (exts != null) { - Enumeration e = exts.getElements(); + Enumeration<Extension> e = exts.getAttributes(); while (e.hasMoreElements()) { netscape.security.x509.Extension ext = (netscape.security.x509.Extension) e.nextElement(); @@ -918,7 +920,7 @@ public class CAService implements ICAService, IService { } else { if (Debug.ON) { System.out.println("Old meta info"); - Enumeration n = oldMeta.getElements(); + Enumeration<String> n = oldMeta.getElements(); while (n.hasMoreElements()) { String name = (String) n.nextElement(); @@ -945,7 +947,7 @@ public class CAService implements ICAService, IService { mCA.getCertificateRepository().readCertificateRecord(oldSerialNo); MetaInfo meta = check.getMetaInfo(); - Enumeration n = oldMeta.getElements(); + Enumeration<String> n = oldMeta.getElements(); while (n.hasMoreElements()) { String name = (String) n.nextElement(); @@ -1012,7 +1014,7 @@ public class CAService implements ICAService, IService { mCA.log(ILogger.LL_INFO, CMS.getLogMessage("CMSCORE_CA_CERT_REVOKED", serialno.toString(16))); // inform all CRLIssuingPoints about revoked certificate - Enumeration eIPs = mCRLIssuingPoints.elements(); + Enumeration<ICRLIssuingPoint> eIPs = mCRLIssuingPoints.elements(); while (eIPs.hasMoreElements()) { ICRLIssuingPoint ip = (ICRLIssuingPoint) eIPs.nextElement(); @@ -1100,7 +1102,7 @@ public class CAService implements ICAService, IService { certRec.getRevokedOn(), certRec.getRevokedBy()); mCA.log(ILogger.LL_INFO, CMS.getLogMessage("CMSCORE_CA_CERT_UNREVOKED", serialNo.toString(16))); // inform all CRLIssuingPoints about unrevoked certificate - Enumeration eIPs = mCRLIssuingPoints.elements(); + Enumeration<ICRLIssuingPoint> eIPs = mCRLIssuingPoints.elements(); while (eIPs.hasMoreElements()) { ICRLIssuingPoint ip = (ICRLIssuingPoint) eIPs.nextElement(); @@ -1620,15 +1622,15 @@ class serviceCheckChallenge implements IServant { String filter = "(&(x509cert.subject=" + subjectName + ")(certStatus=VALID))"; ICertRecordList list = certDB.findCertRecordsInList(filter, null, 10); int size = list.getSize(); - Enumeration en = list.getCertRecords(0, size - 1); + Enumeration<ICertRecord> en = list.getCertRecords(0, size - 1); if (!en.hasMoreElements()) { bigIntArray = new BigInteger[0]; } else { - Vector idv = new Vector(); + Vector<BigInteger> idv = new Vector<BigInteger>(); while (en.hasMoreElements()) { - CertRecord record = (CertRecord) en.nextElement(); + ICertRecord record = en.nextElement(); boolean samepwd = compareChallengePassword(record, pwd); if (samepwd) { @@ -1650,7 +1652,7 @@ class serviceCheckChallenge implements IServant { return true; } - private boolean compareChallengePassword(CertRecord record, String pwd) + private boolean compareChallengePassword(ICertRecord record, String pwd) throws EBaseException { MetaInfo metaInfo = (MetaInfo) record.get(CertRecord.ATTR_META_INFO); @@ -1931,7 +1933,7 @@ class serviceGetRevocationInfo implements IServant { public boolean service(IRequest request) throws EBaseException { - Enumeration enum1 = request.getExtDataKeys(); + Enumeration<String> enum1 = request.getExtDataKeys(); while (enum1.hasMoreElements()) { String name = (String) enum1.nextElement(); @@ -1971,7 +1973,7 @@ class serviceGetCertificates implements IServant { public boolean service(IRequest request) throws EBaseException { - Enumeration enum1 = request.getExtDataKeys(); + Enumeration<String> enum1 = request.getExtDataKeys(); while (enum1.hasMoreElements()) { String name = (String) enum1.nextElement(); @@ -2040,8 +2042,8 @@ class serviceCert4Crl implements IServant { // mService.revokeCert(crlentries[i]); recordedCerts[i] = revokedCertRecs[i]; // inform all CRLIssuingPoints about revoked certificate - Hashtable hips = mService.getCRLIssuingPoints(); - Enumeration eIPs = hips.elements(); + Hashtable<String, ICRLIssuingPoint> hips = mService.getCRLIssuingPoints(); + Enumeration<ICRLIssuingPoint> eIPs = hips.elements(); while (eIPs.hasMoreElements()) { ICRLIssuingPoint ip = (ICRLIssuingPoint) eIPs.nextElement(); @@ -2102,8 +2104,8 @@ class serviceUnCert4Crl implements IServant { try { mCA.getCertificateRepository().deleteCertificateRecord(oldSerialNo[i]); // inform all CRLIssuingPoints about unrevoked certificate - Hashtable hips = mService.getCRLIssuingPoints(); - Enumeration eIPs = hips.elements(); + Hashtable<String, ICRLIssuingPoint> hips = mService.getCRLIssuingPoints(); + Enumeration<ICRLIssuingPoint> eIPs = hips.elements(); while (eIPs.hasMoreElements()) { ICRLIssuingPoint ip = (ICRLIssuingPoint) eIPs.nextElement(); diff --git a/pki/base/ca/src/com/netscape/ca/CMSCRLExtensions.java b/pki/base/ca/src/com/netscape/ca/CMSCRLExtensions.java index d9e14884a..0d98b9631 100644 --- a/pki/base/ca/src/com/netscape/ca/CMSCRLExtensions.java +++ b/pki/base/ca/src/com/netscape/ca/CMSCRLExtensions.java @@ -623,8 +623,8 @@ public class CMSCRLExtensions implements ICMSCRLExtensions { CMSCRLExtensions cmsCRLExtensions = (CMSCRLExtensions) ip.getCRLExtensions(); if (cmsCRLExtensions != null) { - issuingDistPointExtEnabled = cmsCRLExtensions - .isCRLExtensionEnabled(IssuingDistributionPointExtension.NAME); + issuingDistPointExtEnabled = + cmsCRLExtensions.isCRLExtensionEnabled(IssuingDistributionPointExtension.NAME); } CMS.debug("issuingDistPointExtEnabled = " + issuingDistPointExtEnabled); diff --git a/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java b/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java index 96f1468f1..46ddb544d 100644 --- a/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java +++ b/pki/base/ca/src/com/netscape/ca/CRLIssuingPoint.java @@ -736,9 +736,9 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { mCMSCRLExtensions = new CMSCRLExtensions(this, config); - mExtendedNextUpdate = ((mUpdateSchema > 1 || (mEnableDailyUpdates && mExtendedTimeList)) && isDeltaCRLEnabled()) ? - config.getBoolean(Constants.PR_EXTENDED_NEXT_UPDATE, true) - : + mExtendedNextUpdate = + ((mUpdateSchema > 1 || (mEnableDailyUpdates && mExtendedTimeList)) && isDeltaCRLEnabled()) ? + config.getBoolean(Constants.PR_EXTENDED_NEXT_UPDATE, true) : false; // Get serial number ranges if any. @@ -1166,7 +1166,9 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { IConfigStore crlSubStore = crlsSubStore.getSubStore(mId); IConfigStore crlExtsSubStore = crlSubStore.getSubStore(ICertificateAuthority.PROP_CRLEXT_SUBSTORE); - crlExtsSubStore = crlExtsSubStore.getSubStore(IssuingDistributionPointExtension.NAME); + crlExtsSubStore = + crlExtsSubStore + .getSubStore(IssuingDistributionPointExtension.NAME); if (crlExtsSubStore != null) { String val = ""; @@ -1599,8 +1601,8 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { } } if (t - mMinUpdateInterval > last) { - if (mExtendedNextUpdate && (!fromLastUpdate) && (!(mEnableDailyUpdates && mExtendedTimeList)) - && (!delta) && + if (mExtendedNextUpdate + && (!fromLastUpdate) && (!(mEnableDailyUpdates && mExtendedTimeList)) && (!delta) && isDeltaEnabled && mUpdateSchema > 1) { i += mUpdateSchema - ((i + m) % mUpdateSchema); } @@ -1686,8 +1688,8 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { next = nextUpdate; } - CMS.debug("findNextUpdate: " + ((new Date(next)).toString()) - + ((fromLastUpdate) ? " delay: " + (next - now) : "")); + CMS.debug("findNextUpdate: " + + ((new Date(next)).toString()) + ((fromLastUpdate) ? " delay: " + (next - now) : "")); return (fromLastUpdate) ? next - now : next; } @@ -2231,7 +2233,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { public boolean isDeltaCRLEnabled() { return (mAllowExtensions && mEnableCRLCache && mCMSCRLExtensions.isCRLExtensionEnabled(DeltaCRLIndicatorExtension.NAME) && - mCMSCRLExtensions.isCRLExtensionEnabled(CRLNumberExtension.NAME) && + mCMSCRLExtensions.isCRLExtensionEnabled(CRLNumberExtension.NAME) && mCMSCRLExtensions.isCRLExtensionEnabled(CRLReasonExtension.NAME)); } @@ -2339,8 +2341,8 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { Boolean.toString(isCRLCacheEnabled()), Boolean.toString(mEnableCacheRecovery), Boolean.toString(mCRLCacheIsCleared), - "" + mCRLCerts.size() + "," + mRevokedCerts.size() + "," + mUnrevokedCerts.size() + "," - + mExpiredCerts.size() + "" + mCRLCerts.size() + "," + mRevokedCerts.size() + "," + mUnrevokedCerts.size() + + "," + mExpiredCerts.size() + "" } ); mUpdatingCRL = CRL_UPDATE_STARTED; @@ -2395,14 +2397,14 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { mSplits[0] -= System.currentTimeMillis(); @SuppressWarnings("unchecked") - Hashtable<BigInteger, RevokedCertificate> clonedRevokedCerts = (Hashtable<BigInteger, RevokedCertificate>) mRevokedCerts - .clone(); + Hashtable<BigInteger, RevokedCertificate> clonedRevokedCerts = + (Hashtable<BigInteger, RevokedCertificate>) mRevokedCerts.clone(); @SuppressWarnings("unchecked") - Hashtable<BigInteger, RevokedCertificate> clonedUnrevokedCerts = (Hashtable<BigInteger, RevokedCertificate>) mUnrevokedCerts - .clone(); + Hashtable<BigInteger, RevokedCertificate> clonedUnrevokedCerts = + (Hashtable<BigInteger, RevokedCertificate>) mUnrevokedCerts.clone(); @SuppressWarnings("unchecked") - Hashtable<BigInteger, RevokedCertificate> clonedExpiredCerts = (Hashtable<BigInteger, RevokedCertificate>) mExpiredCerts - .clone(); + Hashtable<BigInteger, RevokedCertificate> clonedExpiredCerts = + (Hashtable<BigInteger, RevokedCertificate>) mExpiredCerts.clone(); mSplits[0] += System.currentTimeMillis(); @@ -2441,8 +2443,8 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { if (isDeltaCRLEnabled()) { mSplits[1] -= System.currentTimeMillis(); @SuppressWarnings("unchecked") - Hashtable<BigInteger, RevokedCertificate> deltaCRLCerts = (Hashtable<BigInteger, RevokedCertificate>) clonedRevokedCerts - .clone(); + Hashtable<BigInteger, RevokedCertificate> deltaCRLCerts = + (Hashtable<BigInteger, RevokedCertificate>) clonedRevokedCerts.clone(); deltaCRLCerts.putAll(clonedUnrevokedCerts); if (mIncludeExpiredCertsOneExtraTime) { @@ -2716,8 +2718,10 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { splitTimes += ","; splitTimes += Long.toString(mSplits[i]); } - splitTimes += "," + Long.toString(deltaTime) + "," + Long.toString(crlTime) + "," - + Long.toString(totalTime) + ")"; + splitTimes += + "," + + Long.toString(deltaTime) + "," + Long.toString(crlTime) + "," + + Long.toString(totalTime) + ")"; mLogger.log(ILogger.EV_AUDIT, ILogger.S_OTHER, AuditFormat.LEVEL, CMS.getLogMessage("CMSCORE_CA_CA_CRL_UPDATED"), @@ -2817,7 +2821,6 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable { * Suppress the warnings generated by adding to the session context * */ - @SuppressWarnings("unchecked") protected void publishCRL(X509CRLImpl x509crl, boolean isDeltaCRL) throws EBaseException { SessionContext sc = SessionContext.getContext(); @@ -3014,7 +3017,8 @@ class CertRecProcessor implements IElementProcessor { return result; } boolean isIssuingDistPointExtEnabled = false; - isIssuingDistPointExtEnabled = exts.isCRLExtensionEnabled(IssuingDistributionPointExtension.NAME); + isIssuingDistPointExtEnabled = + exts.isCRLExtensionEnabled(IssuingDistributionPointExtension.NAME); if (isIssuingDistPointExtEnabled == false) { mIssuingDistPointEnabled = false; return false; diff --git a/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java b/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java index 0ae915d2f..dab9c069d 100644 --- a/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java +++ b/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java @@ -1561,12 +1561,13 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori if (nc != null && nc.size() > 0) { // Initialize Certificate Issued notification listener - String certificateIssuedListenerClassName = nc.getString("certificateIssuedListenerClassName", - "com.netscape.cms.listeners.CertificateIssuedListener"); + String certificateIssuedListenerClassName = + nc.getString("certificateIssuedListenerClassName", + "com.netscape.cms.listeners.CertificateIssuedListener"); try { - mCertIssuedListener = (IRequestListener) Class.forName(certificateIssuedListenerClassName) - .newInstance(); + mCertIssuedListener = + (IRequestListener) Class.forName(certificateIssuedListenerClassName).newInstance(); mCertIssuedListener.init(this, nc); } catch (Exception e1) { log(ILogger.LL_FAILURE, @@ -1575,12 +1576,13 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori // Initialize Revoke Request notification listener - String certificateRevokedListenerClassName = nc.getString("certificateIssuedListenerClassName", - "com.netscape.cms.listeners.CertificateRevokedListener"); + String certificateRevokedListenerClassName = + nc.getString("certificateIssuedListenerClassName", + "com.netscape.cms.listeners.CertificateRevokedListener"); try { - mCertRevokedListener = (IRequestListener) Class.forName(certificateRevokedListenerClassName) - .newInstance(); + mCertRevokedListener = + (IRequestListener) Class.forName(certificateRevokedListenerClassName).newInstance(); mCertRevokedListener.init(this, nc); } catch (Exception e1) { log(ILogger.LL_FAILURE, @@ -1590,8 +1592,9 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori // Initialize Request In Queue notification listener IConfigStore rq = nc.getSubStore(PROP_REQ_IN_Q_SUBSTORE); - String requestInQListenerClassName = nc.getString("certificateIssuedListenerClassName", - "com.netscape.cms.listeners.RequestInQListener"); + String requestInQListenerClassName = + nc.getString("certificateIssuedListenerClassName", + "com.netscape.cms.listeners.RequestInQListener"); try { mReqInQListener = (IRequestListener) Class.forName(requestInQListenerClassName).newInstance(); @@ -1701,6 +1704,7 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori "initializing crl issue point " + issuePointId); IConfigStore issuePointConfig = null; String issuePointClassName = null; + @SuppressWarnings("unchecked") Class<CRLIssuingPoint> issuePointClass = null; CRLIssuingPoint issuePoint = null; diff --git a/pki/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java b/pki/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java index 9450558c1..3a7bac977 100644 --- a/pki/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java +++ b/pki/base/common/src/com/netscape/certsrv/base/MetaAttributeDef.java @@ -34,7 +34,8 @@ public class MetaAttributeDef { private ObjectIdentifier mOid; private Class<?> mValueClass; private static Hashtable<String, MetaAttributeDef> mNameToAttrDef = new Hashtable<String, MetaAttributeDef>(); - private static Hashtable<ObjectIdentifier, MetaAttributeDef> mOidToAttrDef = new Hashtable<ObjectIdentifier, MetaAttributeDef>(); + private static Hashtable<ObjectIdentifier, MetaAttributeDef> mOidToAttrDef = + new Hashtable<ObjectIdentifier, MetaAttributeDef>(); private MetaAttributeDef() { } 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 d971a7128..7123de303 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 searchAllCRLIssuingPointRecord( + public Enumeration<Object> searchAllCRLIssuingPointRecord( int maxSize) throws EBaseException; diff --git a/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameUtil.java b/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameUtil.java index 26bd8aeb7..102b25ccd 100644 --- a/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameUtil.java +++ b/pki/base/common/src/com/netscape/certsrv/policy/IGeneralNameUtil.java @@ -54,7 +54,8 @@ public interface IGeneralNameUtil { /** * Default extended plugin info. */ - public static String NUM_GENERALNAMES_INFO = "number;The total number of alternative names or identities permitted in the extension."; + public static String NUM_GENERALNAMES_INFO = + "number;The total number of alternative names or identities permitted in the extension."; public static String GENNAME_CHOICE_INFO = "choice(" + IGeneralNameUtil.GENNAME_CHOICE_RFC822NAME + "," + diff --git a/pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java b/pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java index 124ca5590..a50996f2b 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java +++ b/pki/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java @@ -245,8 +245,8 @@ public class ARequestNotifier implements IRequestNotifier { } if (mRequests.size() < mMaxRequests) { mRequests.addElement(r.getRequestId().toString()); - CMS.debug("getRequest added " + r.getRequestType() + " request " + r.getRequestId().toString() - + + CMS.debug("getRequest added " + + r.getRequestType() + " request " + r.getRequestId().toString() + " to mRequests: " + mRequests.size() + " (" + mMaxRequests + ")"); } else { break; diff --git a/pki/base/common/src/com/netscape/certsrv/request/IRequest.java b/pki/base/common/src/com/netscape/certsrv/request/IRequest.java index 8bd304858..19b830898 100644 --- a/pki/base/common/src/com/netscape/certsrv/request/IRequest.java +++ b/pki/base/common/src/com/netscape/certsrv/request/IRequest.java @@ -355,7 +355,7 @@ public interface IRequest { * the Hashtable contains an illegal key. * @return false if the key or hashtable keys are invalid */ - public boolean setExtData(String key, Hashtable value); + public boolean setExtData(String key, Hashtable<String, String> value); /** * Checks whether the key is storing a simple String value, or a complex @@ -391,14 +391,14 @@ public interface IRequest { * @return The hashtable value associated with the key. null if not found * or if the key is associated with a string-value. */ - public Hashtable getExtDataInHashtable(String key); + public Hashtable<String, String> getExtDataInHashtable(String key); /** * Returns all the keys stored in ExtData * * @return Enumeration of all the keys. */ - public Enumeration getExtDataKeys(); + public Enumeration<String> getExtDataKeys(); /** * Stores an array of Strings in ExtData. @@ -652,7 +652,7 @@ public interface IRequest { * @param data A vector of Strings to store * @return False on key error or invalid data. */ - public boolean setExtData(String key, Vector data); + public boolean setExtData(String key, Vector<?> data); /** * Returns a vector of strings for the key. diff --git a/pki/base/common/src/com/netscape/certsrv/util/HttpInput.java b/pki/base/common/src/com/netscape/certsrv/util/HttpInput.java index 51fefda57..fba601b6c 100644 --- a/pki/base/common/src/com/netscape/certsrv/util/HttpInput.java +++ b/pki/base/common/src/com/netscape/certsrv/util/HttpInput.java @@ -147,8 +147,8 @@ public class HttpInput { i.equals("2048") || i.equals("4096")) { return i; } - throw new IOException("Invalid key length '" + i - + "'. Currently supported key lengths are 256, 512, 1024, 2048, 4096."); + throw new IOException("Invalid key length '" + + i + "'. Currently supported key lengths are 256, 512, 1024, 2048, 4096."); } public static String getKeySize(HttpServletRequest request, String name, String keyType) @@ -159,8 +159,8 @@ public class HttpInput { i.equals("2048") || i.equals("4096")) { return i; } else { - throw new IOException("Invalid key length '" + i - + "'. Currently supported RSA key lengths are 256, 512, 1024, 2048, 4096."); + throw new IOException("Invalid key length '" + + i + "'. Currently supported RSA key lengths are 256, 512, 1024, 2048, 4096."); } } if (keyType.equals("ecc")) { @@ -264,8 +264,8 @@ public class HttpInput { Pattern p = Pattern.compile("[A-Za-z0-9]+[A-Za-z0-9 -]*"); Matcher m = p.matcher(v); if (!m.matches()) { - throw new IOException("Invalid characters found in Security Domain Name " + v - + ". Valid characters are A-Z, a-z, 0-9, dash and space"); + throw new IOException("Invalid characters found in Security Domain Name " + + v + ". Valid characters are A-Z, a-z, 0-9, dash and space"); } return v; } diff --git a/pki/base/common/src/com/netscape/cms/authentication/DirBasedAuthentication.java b/pki/base/common/src/com/netscape/cms/authentication/DirBasedAuthentication.java index 3120b9e23..da8d5bd51 100644 --- a/pki/base/common/src/com/netscape/cms/authentication/DirBasedAuthentication.java +++ b/pki/base/common/src/com/netscape/cms/authentication/DirBasedAuthentication.java @@ -120,10 +120,10 @@ public abstract class DirBasedAuthentication "E=$attr.mail, CN=$attr.cn, O=$dn.o, C=$dn.c"; /* Vector of extendedPluginInfo strings */ - protected static Vector mExtendedPluginInfo = null; + protected static Vector<String> mExtendedPluginInfo = null; static { - mExtendedPluginInfo = new Vector(); + mExtendedPluginInfo = new Vector<String>(); mExtendedPluginInfo.add(PROP_DNPATTERN + ";string;Template for cert" + " Subject Name. ($dn.xxx - get value from user's LDAP " + "DN. $attr.yyy - get value from LDAP attributes in " + @@ -570,8 +570,9 @@ public abstract class DirBasedAuthentication if (values == null) return; - Vector v = new Vector(); - Enumeration e = values.getStringValues(); + Vector<String> v = new Vector<String>(); + @SuppressWarnings("unchecked") + Enumeration<String> e = values.getStringValues(); while (e.hasMoreElements()) { v.addElement(e.nextElement()); @@ -591,8 +592,9 @@ public abstract class DirBasedAuthentication if (values == null) return; - Vector v = new Vector(); - Enumeration e = values.getByteValues(); + Vector<byte[]> v = new Vector<byte[]>(); + @SuppressWarnings("unchecked") + Enumeration<byte[]> e = values.getByteValues(); while (e.hasMoreElements()) { v.addElement(e.nextElement()); diff --git a/pki/base/common/src/com/netscape/cms/authentication/FlatFileAuth.java b/pki/base/common/src/com/netscape/cms/authentication/FlatFileAuth.java index 028cea376..37e076d4a 100644 --- a/pki/base/common/src/com/netscape/cms/authentication/FlatFileAuth.java +++ b/pki/base/common/src/com/netscape/cms/authentication/FlatFileAuth.java @@ -210,8 +210,8 @@ public class FlatFileAuth CMS.debug("FlatFileAuth: " + CMS.getLogMessage("CMS_AUTH_READ_ENTRIES", mFilename)); // printAllEntries(); } catch (IOException e) { - throw new EBaseException(mName + " authentication: Could not open file " + mFilename + " (" - + e.getMessage() + ")"); + throw new EBaseException(mName + + " authentication: Could not open file " + mFilename + " (" + e.getMessage() + ")"); } catch (java.lang.StringIndexOutOfBoundsException ee) { CMS.debug("FlatFileAuth: " + CMS.getLogMessage("OPERATION_ERROR", ee.toString())); } diff --git a/pki/base/common/src/com/netscape/cms/authentication/SSLclientCertAuthentication.java b/pki/base/common/src/com/netscape/cms/authentication/SSLclientCertAuthentication.java index 8a2a43ab4..35c23bd0f 100644 --- a/pki/base/common/src/com/netscape/cms/authentication/SSLclientCertAuthentication.java +++ b/pki/base/common/src/com/netscape/cms/authentication/SSLclientCertAuthentication.java @@ -332,7 +332,7 @@ public class SSLclientCertAuthentication implements IAuthManager, /** * Retrieves a list of names of the value parameter. */ - public Enumeration getValueNames() { + public Enumeration<String> getValueNames() { return null; } diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSAuthorityKeyIdentifierExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSAuthorityKeyIdentifierExtension.java index 96d73d4c4..26c8c1d0e 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSAuthorityKeyIdentifierExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSAuthorityKeyIdentifierExtension.java @@ -121,9 +121,10 @@ public class CMSAuthorityKeyIdentifierExtension gNames.addElement(((ICertificateAuthority) crlIssuingPoint.getCertificateAuthority()).getX500Name()); - authKeyIdExt = new AuthorityKeyIdentifierExtension(critical, null, gNames, - new SerialNumber(((ICertificateAuthority) crlIssuingPoint.getCertificateAuthority()) - .getCACert().getSerialNumber())); + authKeyIdExt = + new AuthorityKeyIdentifierExtension(critical, null, gNames, + new SerialNumber(((ICertificateAuthority) crlIssuingPoint.getCertificateAuthority()) + .getCACert().getSerialNumber())); } } catch (IOException e) { diff --git a/pki/base/common/src/com/netscape/cms/jobs/PublishCertsJob.java b/pki/base/common/src/com/netscape/cms/jobs/PublishCertsJob.java index 48f20f611..29c5f21a5 100644 --- a/pki/base/common/src/com/netscape/cms/jobs/PublishCertsJob.java +++ b/pki/base/common/src/com/netscape/cms/jobs/PublishCertsJob.java @@ -182,8 +182,8 @@ public class PublishCertsJob extends AJobBase // form filter String filter = // might need to use "metaInfo" - "(!(certMetainfo=" + ICertRecord.META_LDAPPUBLISH + - ":true))"; + "(!(certMetainfo=" + ICertRecord.META_LDAPPUBLISH + + ":true))"; Enumeration unpublishedCerts = 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 3c2e14b22..db61382c5 100644 --- a/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java +++ b/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java @@ -101,12 +101,12 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { private final static String PROP_INCLUDE_NEXT_UPDATE = "includeNextUpdate"; - protected Hashtable mReqCounts = new Hashtable(); + protected Hashtable<String, Long> mReqCounts = new Hashtable<String, Long>(); protected boolean mNotFoundGood = true; protected boolean mUseCache = true; protected boolean mByName = true; protected boolean mIncludeNextUpdate = false; - protected Hashtable mCacheCRLIssuingPoints = new Hashtable(); + protected Hashtable<String, CRLIPContainer> mCacheCRLIssuingPoints = new Hashtable<String, CRLIPContainer>(); private IOCSPAuthority mOCSPAuthority = null; private IConfigStore mConfig = null; private String mId = null; @@ -122,13 +122,13 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { } public String[] getExtendedPluginInfo(Locale locale) { - Vector v = new Vector(); + Vector<String> v = new Vector<String>(); - v.addElement(PROP_NOT_FOUND_GOOD + ";boolean; " - + CMS.getUserMessage(locale, "CMS_OCSP_DEFSTORE_PROP_NOT_FOUND_GOOD")); + v.addElement(PROP_NOT_FOUND_GOOD + + ";boolean; " + CMS.getUserMessage(locale, "CMS_OCSP_DEFSTORE_PROP_NOT_FOUND_GOOD")); v.addElement(PROP_BY_NAME + ";boolean; " + CMS.getUserMessage(locale, "CMS_OCSP_DEFSTORE_PROP_BY_NAME")); - v.addElement(PROP_INCLUDE_NEXT_UPDATE + ";boolean; " - + CMS.getUserMessage(locale, "CMS_OCSP_DEFSTORE_PROP_INCLUDE_NEXT_UPDATE")); + v.addElement(PROP_INCLUDE_NEXT_UPDATE + + ";boolean; " + CMS.getUserMessage(locale, "CMS_OCSP_DEFSTORE_PROP_INCLUDE_NEXT_UPDATE")); v.addElement(IExtendedPluginInfo.HELP_TEXT + "; " + CMS.getUserMessage(locale, "CMS_OCSP_DEFSTORE_DESC")); v.addElement(IExtendedPluginInfo.HELP_TOKEN + ";configuration-ocspstores-defstore"); return com.netscape.cmsutil.util.Utils.getStringArrayFromVector(v); @@ -226,7 +226,7 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { * new one is totally committed. */ public void deleteOldCRLs() throws EBaseException { - Enumeration recs = searchCRLIssuingPointRecord( + Enumeration<Object> recs = searchCRLIssuingPointRecord( "objectclass=" + CMS.getCRLIssuingPointRecordName(), 100); @@ -234,9 +234,7 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { ICRLIssuingPointRecord theRec = null; while (recs.hasMoreElements()) { - ICRLIssuingPointRecord rec = (ICRLIssuingPointRecord) - recs.nextElement(); - + ICRLIssuingPointRecord rec = (ICRLIssuingPointRecord) recs.nextElement(); deleteOldCRLsInCA(rec.getId()); } } @@ -254,15 +252,14 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { return; // nothing to do String thisUpdate = Long.toString( cp.getThisUpdate().getTime()); - Enumeration e = searchRepository( + Enumeration<Object> e = searchRepository( caName, "(!" + IRepositoryRecord.ATTR_SERIALNO + "=" + thisUpdate + ")"); while (e != null && e.hasMoreElements()) { - IRepositoryRecord r = (IRepositoryRecord) - e.nextElement(); - Enumeration recs = + IRepositoryRecord r = (IRepositoryRecord) e.nextElement(); + Enumeration<Object> recs = searchCertRecord(caName, r.getSerialNumber().toString(), ICertRecord.ATTR_ID + "=*"); @@ -339,7 +336,7 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { // (3) look into database to check the // certificate's status - Vector singleResponses = new Vector(); + Vector<SingleResponse> singleResponses = new Vector<SingleResponse>(); if (statsSub != null) { statsSub.startTiming("lookup"); } @@ -440,7 +437,7 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { mCacheCRLIssuingPoints.get(new String(keyhsh)); if (matched == null) { - Enumeration recs = searchCRLIssuingPointRecord( + Enumeration<Object> recs = searchCRLIssuingPointRecord( "objectclass=" + CMS.getCRLIssuingPointRecordName(), 100); @@ -524,7 +521,7 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { // if crl is not available, we can try crl cache if (theRec != null) { CMS.debug("DefStore: evaluating crl cache"); - Hashtable cache = theRec.getCRLCacheNoClone(); + Hashtable<BigInteger, RevokedCertificate> cache = theRec.getCRLCacheNoClone(); if (cache != null) { RevokedCertificate rc = (RevokedCertificate) cache.get(new BigInteger(serialNo.toString())); @@ -582,7 +579,7 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { return mDBService.getBaseDN(); } - public Enumeration searchAllCRLIssuingPointRecord(int maxSize) + public Enumeration<Object> searchAllCRLIssuingPointRecord(int maxSize) throws EBaseException { return searchCRLIssuingPointRecord( "objectclass=" + @@ -590,11 +587,11 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { maxSize); } - public Enumeration searchCRLIssuingPointRecord(String filter, + public Enumeration<Object> searchCRLIssuingPointRecord(String filter, int maxSize) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<Object> e = null; try { e = s.search(getBaseDN(), filter, maxSize); @@ -688,10 +685,10 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { } } - public Enumeration searchRepository(String name, String filter) + public Enumeration<Object> searchRepository(String name, String filter) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<Object> e = null; try { e = s.search("cn=" + transformDN(name) + "," + getBaseDN(), @@ -739,10 +736,10 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { } } - public Enumeration searchCertRecord(String name, String thisUpdate, + public Enumeration<Object> searchCertRecord(String name, String thisUpdate, String filter) throws EBaseException { IDBSSession s = mDBService.createSession(); - Enumeration e = null; + Enumeration<Object> e = null; try { e = s.search("ou=" + thisUpdate + ",cn=" + @@ -814,7 +811,7 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { public void setConfigParameters(NameValuePairs pairs) throws EBaseException { - Enumeration k = pairs.getNames(); + Enumeration<String> k = pairs.getNames(); while (k.hasMoreElements()) { String key = (String) k.nextElement(); @@ -938,10 +935,10 @@ class CRLIPContainer { } class DefStoreCRLUpdater extends Thread { - private Hashtable mCache = null; + private Hashtable<String, CRLIPContainer> mCache = null; private int mSec = 0; - public DefStoreCRLUpdater(Hashtable cache, int sec) { + public DefStoreCRLUpdater(Hashtable<String, CRLIPContainer> cache, int sec) { mCache = cache; mSec = sec; } 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 6fa3d300c..4a0225a40 100644 --- a/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java +++ b/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java @@ -101,7 +101,7 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { private boolean mByName = true; private String mCACertAttr = null; protected Hashtable mReqCounts = new Hashtable(); - private Hashtable mCRLs = new Hashtable(); + private Hashtable<X509CertImpl, Object> mCRLs = new Hashtable<X509CertImpl, Object>(); /** * Constructs the default store. @@ -112,15 +112,15 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { public String[] getExtendedPluginInfo(Locale locale) { Vector v = new Vector(); - v.addElement(PROP_NOT_FOUND_GOOD + ";boolean; " - + CMS.getUserMessage(locale, "CMS_OCSP_LDAPSTORE_PROP_NOT_FOUND_GOOD")); - v.addElement(PROP_INCLUDE_NEXT_UPDATE + ";boolean; " - + CMS.getUserMessage(locale, "CMS_OCSP_LDAPSTORE_PROP_INCLUDE_NEXT_UPDATE")); + v.addElement(PROP_NOT_FOUND_GOOD + + ";boolean; " + CMS.getUserMessage(locale, "CMS_OCSP_LDAPSTORE_PROP_NOT_FOUND_GOOD")); + v.addElement(PROP_INCLUDE_NEXT_UPDATE + + ";boolean; " + CMS.getUserMessage(locale, "CMS_OCSP_LDAPSTORE_PROP_INCLUDE_NEXT_UPDATE")); v.addElement(PROP_NUM_CONNS + ";number; " + CMS.getUserMessage(locale, "CMS_OCSP_LDAPSTORE_PROP_NUM_CONNS")); v.addElement(PROP_BY_NAME + ";boolean; " + CMS.getUserMessage(locale, "CMS_OCSP_LDAPSTORE_PROP_BY_NAME")); v.addElement(PROP_CRL_ATTR + ";string; " + CMS.getUserMessage(locale, "CMS_OCSP_LDAPSTORE_PROP_CRL_ATTR")); - v.addElement(PROP_CA_CERT_ATTR + ";string; " - + CMS.getUserMessage(locale, "CMS_OCSP_LDAPSTORE_PROP_CA_CERT_ATTR")); + v.addElement(PROP_CA_CERT_ATTR + + ";string; " + CMS.getUserMessage(locale, "CMS_OCSP_LDAPSTORE_PROP_CA_CERT_ATTR")); v.addElement(IExtendedPluginInfo.HELP_TEXT + "; " + CMS.getUserMessage(locale, "CMS_OCSP_LDAPSTORE_DESC")); v.addElement(IExtendedPluginInfo.HELP_TOKEN + ";configuration-ocspstores-ldapstore"); return com.netscape.cmsutil.util.Utils.getStringArrayFromVector(v); @@ -393,13 +393,13 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { throw new EBaseException("NOT SUPPORTED"); } - public Enumeration searchAllCRLIssuingPointRecord(int maxSize) + public Enumeration<Object> searchAllCRLIssuingPointRecord(int maxSize) throws EBaseException { Vector recs = new Vector(); - Enumeration keys = mCRLs.keys(); + Enumeration<X509CertImpl> keys = mCRLs.keys(); while (keys.hasMoreElements()) { - X509CertImpl caCert = (X509CertImpl) keys.nextElement(); + X509CertImpl caCert = keys.nextElement(); X509CRLImpl crl = (X509CRLImpl) mCRLs.get(caCert); recs.addElement(new TempCRLIssuingPointRecord(caCert, crl)); diff --git a/pki/base/common/src/com/netscape/cms/policy/constraints/IssuerConstraints.java b/pki/base/common/src/com/netscape/cms/policy/constraints/IssuerConstraints.java index 09feb2766..b0e27501e 100644 --- a/pki/base/common/src/com/netscape/cms/policy/constraints/IssuerConstraints.java +++ b/pki/base/common/src/com/netscape/cms/policy/constraints/IssuerConstraints.java @@ -72,7 +72,7 @@ public class IssuerConstraints extends APolicyRule IExtendedPluginInfo.HELP_TEXT + ";Rejects the request if the issuer in the certificate is" + "not of the one specified" - }; + }; return params; diff --git a/pki/base/common/src/com/netscape/cms/policy/constraints/RenewalConstraints.java b/pki/base/common/src/com/netscape/cms/policy/constraints/RenewalConstraints.java index 2b220cb8f..185bceed9 100644 --- a/pki/base/common/src/com/netscape/cms/policy/constraints/RenewalConstraints.java +++ b/pki/base/common/src/com/netscape/cms/policy/constraints/RenewalConstraints.java @@ -84,7 +84,7 @@ public class RenewalConstraints extends APolicyRule IExtendedPluginInfo.HELP_TEXT + ";Permit administrator to decide policy on whether to " + "permit renewals for already-expired certificates" - }; + }; return params; diff --git a/pki/base/common/src/com/netscape/cms/policy/constraints/RenewalValidityConstraints.java b/pki/base/common/src/com/netscape/cms/policy/constraints/RenewalValidityConstraints.java index 862f8ac5a..b2f654b77 100644 --- a/pki/base/common/src/com/netscape/cms/policy/constraints/RenewalValidityConstraints.java +++ b/pki/base/common/src/com/netscape/cms/policy/constraints/RenewalValidityConstraints.java @@ -86,8 +86,10 @@ public class RenewalValidityConstraints extends APolicyRule public String[] getExtendedPluginInfo(Locale locale) { String[] params = { - PROP_MIN_VALIDITY + ";number;Specifies the minimum validity period, in days, for renewed certificates.", - PROP_MAX_VALIDITY + ";number;Specifies the maximum validity period, in days, for renewed certificates.", + PROP_MIN_VALIDITY + + ";number;Specifies the minimum validity period, in days, for renewed certificates.", + PROP_MAX_VALIDITY + + ";number;Specifies the maximum validity period, in days, for renewed certificates.", PROP_RENEWAL_INTERVAL + ";number;Specifies how many days before its expiration that a certificate can be renewed.", IExtendedPluginInfo.HELP_TOKEN + @@ -95,7 +97,7 @@ public class RenewalValidityConstraints extends APolicyRule IExtendedPluginInfo.HELP_TEXT + ";Reject renewal request if the certificate is too far " + "before it's expiry date" - }; + }; return params; diff --git a/pki/base/common/src/com/netscape/cms/policy/constraints/SigningAlgorithmConstraints.java b/pki/base/common/src/com/netscape/cms/policy/constraints/SigningAlgorithmConstraints.java index 1dd99702f..8c2ba0796 100644 --- a/pki/base/common/src/com/netscape/cms/policy/constraints/SigningAlgorithmConstraints.java +++ b/pki/base/common/src/com/netscape/cms/policy/constraints/SigningAlgorithmConstraints.java @@ -376,7 +376,8 @@ public class SigningAlgorithmConstraints extends APolicyRule String[] params = null; String[] params_BOTH = { - PROP_ALGORITHMS + ";" + PROP_ALGORITHMS + + ";" + "choice(MD2withRSA\\,MD5withRSA\\,SHA1withRSA\\,SHA256withRSA\\,SHA512withRSA\\,SHA1withDSA," + "MD2withRSA\\,MD5withRSA\\,SHA1withRSA\\,SHA1withDSA," + @@ -399,7 +400,7 @@ public class SigningAlgorithmConstraints extends APolicyRule IExtendedPluginInfo.HELP_TEXT + ";Restricts the requested signing algorithm to be one of" + " the algorithms supported by Certificate System" - }; + }; String[] params_RSA = { PROP_ALGORITHMS + ";" + "choice(MD2withRSA\\,MD5withRSA\\,SHA1withRSA," + @@ -414,7 +415,7 @@ public class SigningAlgorithmConstraints extends APolicyRule IExtendedPluginInfo.HELP_TEXT + ";Restricts the requested signing algorithm to be one of" + " the algorithms supported by Certificate System" - }; + }; String[] params_DSA = { PROP_ALGORITHMS + ";" + "choice(SHA1withDSA);Restrict the requested signing " + @@ -424,7 +425,7 @@ public class SigningAlgorithmConstraints extends APolicyRule IExtendedPluginInfo.HELP_TEXT + ";Restricts the requested signing algorithm to be one of" + " the algorithms supported by Certificate System" - }; + }; switch (mDefaultAllowedAlgs.length) { case 1: diff --git a/pki/base/common/src/com/netscape/cms/policy/constraints/UniqueSubjectNameConstraints.java b/pki/base/common/src/com/netscape/cms/policy/constraints/UniqueSubjectNameConstraints.java index a3eeae98c..8c106800a 100644 --- a/pki/base/common/src/com/netscape/cms/policy/constraints/UniqueSubjectNameConstraints.java +++ b/pki/base/common/src/com/netscape/cms/policy/constraints/UniqueSubjectNameConstraints.java @@ -94,7 +94,7 @@ public class UniqueSubjectNameConstraints extends APolicyRule IExtendedPluginInfo.HELP_TEXT + ";Rejects a request if there exists an unrevoked, unexpired " + "certificate with the same subject name" - }; + }; return params; @@ -185,14 +185,15 @@ public class UniqueSubjectNameConstraints extends APolicyRule String filter = "x509Cert.subject=" + certSubjectName; // subject name is indexed, so we only use subject name // in the filter - Enumeration matched = + Enumeration<ICertRecord> matched = mCA.getCertificateRepository().findCertRecords(filter); while (matched.hasMoreElements()) { - ICertRecord rec = (ICertRecord) matched.nextElement(); + ICertRecord rec = matched.nextElement(); String status = rec.getStatus(); - if (status.equals(ICertRecord.STATUS_REVOKED) || status.equals(ICertRecord.STATUS_EXPIRED) + if (status.equals(ICertRecord.STATUS_REVOKED) + || status.equals(ICertRecord.STATUS_EXPIRED) || status.equals(ICertRecord.STATUS_REVOKED_EXPIRED)) { // accept this only if we have a REVOKED, // EXPIRED or REVOKED_EXPIRED certificate @@ -287,8 +288,8 @@ public class UniqueSubjectNameConstraints extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { - Vector confParams = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> confParams = new Vector<String>(); confParams.addElement(PROP_PRE_AGENT_APPROVAL_CHECKING + "=" + mPreAgentApprovalChecking); @@ -302,8 +303,8 @@ public class UniqueSubjectNameConstraints extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { - Vector defParams = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> defParams = new Vector<String>(); defParams.addElement(PROP_PRE_AGENT_APPROVAL_CHECKING + "="); defParams.addElement(PROP_KEY_USAGE_EXTENSION_CHECKING + "="); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/AuthInfoAccessExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/AuthInfoAccessExt.java index cf94d73ee..fea126567 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/AuthInfoAccessExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/AuthInfoAccessExt.java @@ -18,6 +18,7 @@ package com.netscape.cms.policy.extensions; import java.io.IOException; +import java.io.Serializable; import java.security.cert.CertificateException; import java.util.Enumeration; import java.util.Locale; @@ -104,7 +105,7 @@ public class AuthInfoAccessExt extends APolicyRule implements } public String[] getExtendedPluginInfo(Locale locale) { - Vector v = new Vector(); + Vector<String> v = new Vector<String>(); v.addElement(PROP_CRITICAL + ";boolean;RFC 2459 recommendation: This extension MUST be non-critical."); @@ -122,10 +123,10 @@ public class AuthInfoAccessExt extends APolicyRule implements + PROP_METHOD + ";string;" + "A unique,valid OID specified in dot-separated numeric component notation. e.g. 1.3.6.1.5.5.7.48.1 (ocsp), 1.3.6.1.5.5.7.48.2 (caIssuers), 2.16.840.1.113730.1.16.1 (renewal)"); - v.addElement(PROP_AD + Integer.toString(i) + "_" + PROP_LOCATION_TYPE + ";" - + IGeneralNameUtil.GENNAME_CHOICE_INFO); - v.addElement(PROP_AD + Integer.toString(i) + "_" + PROP_LOCATION + ";" - + IGeneralNameUtil.GENNAME_VALUE_INFO); + v.addElement(PROP_AD + + Integer.toString(i) + "_" + PROP_LOCATION_TYPE + ";" + IGeneralNameUtil.GENNAME_CHOICE_INFO); + v.addElement(PROP_AD + + Integer.toString(i) + "_" + PROP_LOCATION + ";" + IGeneralNameUtil.GENNAME_VALUE_INFO); } return com.netscape.cmsutil.util.Utils.getStringArrayFromVector(v); } @@ -149,8 +150,8 @@ public class AuthInfoAccessExt extends APolicyRule implements /** * Returns a sequence of access descriptions. */ - private Enumeration getAccessDescriptions() throws EBaseException { - Vector ads = new Vector(); + private Enumeration<Vector<Serializable>> getAccessDescriptions() throws EBaseException { + Vector<Vector<Serializable>> ads = new Vector<Vector<Serializable>>(); // // read until there is *NO* ad<NUM>_method @@ -200,7 +201,7 @@ public class AuthInfoAccessExt extends APolicyRule implements if (location == null) break; GeneralName gn = CMS.form_GeneralName(location_type, location); - Vector e = new Vector(); + Vector<Serializable> e = new Vector<Serializable>(); e.addElement(methodOID); e.addElement(gn); @@ -245,7 +246,7 @@ public class AuthInfoAccessExt extends APolicyRule implements certInfo.get(X509CertInfo.EXTENSIONS); // add access descriptions - Enumeration e = getAccessDescriptions(); + Enumeration<Vector<Serializable>> e = getAccessDescriptions(); if (!e.hasMoreElements()) { return res; @@ -261,7 +262,8 @@ public class AuthInfoAccessExt extends APolicyRule implements // check to see if AIA is already exist try { extensions.delete(AuthInfoAccessExtension.NAME); - log(ILogger.LL_WARN, "Previous extension deleted: " + AuthInfoAccessExtension.NAME); + log(ILogger.LL_WARN, + "Previous extension deleted: " + AuthInfoAccessExtension.NAME); } catch (IOException ex) { } } @@ -272,7 +274,7 @@ public class AuthInfoAccessExt extends APolicyRule implements PROP_CRITICAL, false)); while (e.hasMoreElements()) { - Vector ad = (Vector) e.nextElement(); + Vector<Serializable> ad = e.nextElement(); ObjectIdentifier oid = (ObjectIdentifier) ad.elementAt(0); GeneralName gn = (GeneralName) ad.elementAt(1); @@ -306,8 +308,8 @@ public class AuthInfoAccessExt extends APolicyRule implements * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { - Vector params = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> params = new Vector<String>(); try { params.addElement(PROP_CRITICAL + "=" + @@ -368,8 +370,8 @@ public class AuthInfoAccessExt extends APolicyRule implements * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { - Vector defParams = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> defParams = new Vector<String>(); defParams.addElement(PROP_CRITICAL + "=false"); defParams.addElement(PROP_NUM_ADS + "=" + MAX_AD); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/AuthorityKeyIdentifierExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/AuthorityKeyIdentifierExt.java index 94a1f19a7..971379a46 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/AuthorityKeyIdentifierExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/AuthorityKeyIdentifierExt.java @@ -80,10 +80,10 @@ public class AuthorityKeyIdentifierExt extends APolicyRule protected AuthorityKeyIdentifierExtension mTheExtension = null; // instance params for console - protected Vector mInstanceParams = new Vector(); + protected Vector<String> mInstanceParams = new Vector<String>(); // default params for console. - protected static Vector mDefaultParams = new Vector(); + protected static Vector<String> mDefaultParams = new Vector<String>(); static { // form static default params. mDefaultParams.addElement(PROP_CRITICAL + "=" + DEF_CRITICAL); @@ -390,7 +390,7 @@ public class AuthorityKeyIdentifierExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { + public Vector<String> getInstanceParams() { return mInstanceParams; } @@ -399,7 +399,7 @@ public class AuthorityKeyIdentifierExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return mDefaultParams; } diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/BasicConstraintsExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/BasicConstraintsExt.java index 10aa8630f..1d22d48ec 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/BasicConstraintsExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/BasicConstraintsExt.java @@ -464,8 +464,8 @@ public class BasicConstraintsExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { - Vector params = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> params = new Vector<String>(); // Because of one of the UI bugs 385273, we should leave the empty space // as is. Do not convert the space to some definite numbers. @@ -480,8 +480,8 @@ public class BasicConstraintsExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { - Vector defParams = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> defParams = new Vector<String>(); defParams.addElement(PROP_IS_CRITICAL + "=true"); defParams.addElement(PROP_MAXPATHLEN + "="); @@ -501,7 +501,7 @@ public class BasicConstraintsExt extends APolicyRule ";configuration-policyrules-basicconstraints", IExtendedPluginInfo.HELP_TEXT + ";Adds the Basic Constraints extension. See RFC 2459 (4.2.1.10)" - }; + }; return params; } diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/CRLDistributionPointsExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/CRLDistributionPointsExt.java index 4ba2a44dc..1ede3d5d0 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/CRLDistributionPointsExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/CRLDistributionPointsExt.java @@ -75,14 +75,14 @@ class NameType { stringRep = s; } - private static Hashtable map = new Hashtable(); + private static Hashtable<String, NameType> map = new Hashtable<String, NameType>(); /** * Looks up a NameType from its string representation. Returns null * if no matching NameType was found. */ public static NameType fromString(String s) { - return (NameType) map.get(s); + return map.get(s); } public String toString() { @@ -144,9 +144,9 @@ public class CRLDistributionPointsExt extends APolicyRule // PKIX specifies the that the extension SHOULD NOT be critical public static final boolean DEFAULT_CRITICALITY = false; - private Vector defaultParams = new Vector(); + private Vector<String> defaultParams = new Vector<String>(); - private Vector mParams = new Vector(); + private Vector<String> mParams = new Vector<String>(); private String mExtParams[] = null; private CRLDistributionPointsExtension mCrldpExt = null; @@ -165,7 +165,7 @@ public class CRLDistributionPointsExt extends APolicyRule } private void setExtendedPluginInfo() { - Vector v = new Vector(); + Vector<String> v = new Vector<String>(); // should replace MAX_POINTS with mNumPoints if bug 385118 is fixed for (int i = 0; i < MAX_POINTS; i++) { @@ -462,7 +462,7 @@ public class CRLDistributionPointsExt extends APolicyRule } // parameters must be entered in the config file - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { for (int i = DEFAULT_NUM_BLANK_POINTS; i < mNumPoints; i++) { defaultParams.addElement(PROP_POINT_NAME + i + "="); defaultParams.addElement(PROP_POINT_TYPE + i + "="); @@ -478,7 +478,7 @@ public class CRLDistributionPointsExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { + public Vector<String> getInstanceParams() { return mParams; } } diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/CertificatePoliciesExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/CertificatePoliciesExt.java index e2c31cf5a..7ea2d6fb8 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/CertificatePoliciesExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/CertificatePoliciesExt.java @@ -79,7 +79,7 @@ public class CertificatePoliciesExt extends APolicyRule protected int mNumCertPolicies = DEF_NUM_CERTPOLICIES; protected CertPolicy[] mCertPolicies = null; - protected Vector mInstanceParams = new Vector(); + protected Vector<String> mInstanceParams = new Vector<String>(); protected CertificatePoliciesExtension mCertificatePoliciesExtension = null; public CertificatePoliciesExt() { @@ -132,7 +132,7 @@ public class CertificatePoliciesExt extends APolicyRule // create instance of certificate policy extension if enabled. if (mEnabled) { try { - Vector CertPolicies = new Vector(); + Vector<CertificatePolicyInfo> CertPolicies = new Vector<CertificatePolicyInfo>(); for (int j = 0; j < mNumCertPolicies; j++) { CertPolicies.addElement( @@ -239,7 +239,7 @@ public class CertificatePoliciesExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { + public Vector<String> getInstanceParams() { return mInstanceParams; } @@ -249,7 +249,7 @@ public class CertificatePoliciesExt extends APolicyRule * increase the num to greater than 0 and more configuration params * will show up in the console. */ - private static Vector mDefParams = new Vector(); + private static Vector<String> mDefParams = new Vector<String>(); static { mDefParams.addElement(PROP_CRITICAL + "=" + DEF_CRITICAL); mDefParams.addElement( @@ -274,12 +274,12 @@ public class CertificatePoliciesExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return mDefParams; } public String[] getExtendedPluginInfo(Locale locale) { - Vector theparams = new Vector(); + Vector<String> theparams = new Vector<String>(); theparams.addElement(PROP_CRITICAL + ";boolean;RFC 3280 recommendation: MUST be non-critical."); theparams.addElement(PROP_NUM_CERTPOLICIES @@ -445,7 +445,7 @@ class CertPolicy { // should add a method to NoticeReference to take a // Vector...but let's do this for now - Vector numsVector = new Vector(); + Vector<String> numsVector = new Vector<String>(); StringTokenizer tokens = new StringTokenizer(mNoticeRefNums, ","); @@ -458,7 +458,7 @@ class CertPolicy { nums = new int[numsVector.size()]; for (int i = 0; i < numsVector.size(); i++) { - Integer ii = new Integer((String) numsVector.elementAt(i)); + Integer ii = new Integer(numsVector.elementAt(i)); nums[i] = ii.intValue(); } @@ -516,7 +516,7 @@ class CertPolicy { } } - protected void getInstanceParams(Vector instanceParams) { + protected void getInstanceParams(Vector<String> instanceParams) { instanceParams.addElement( mNameDot + PROP_POLICY_IDENTIFIER + "=" + (mPolicyId == null ? "" : mPolicyId)); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/CertificateRenewalWindowExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/CertificateRenewalWindowExt.java index 305c11b2e..28366ade8 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/CertificateRenewalWindowExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/CertificateRenewalWindowExt.java @@ -210,7 +210,7 @@ public class CertificateRenewalWindowExt extends APolicyRule ";configuration-policyrules-certificaterenewalwindow", IExtendedPluginInfo.HELP_TEXT + ";Adds 'Certificate Renewal Window' extension. See manual" - }; + }; return params; @@ -221,8 +221,8 @@ public class CertificateRenewalWindowExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { - Vector params = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> params = new Vector<String>(); params.addElement(PROP_CRITICAL + "=" + mCritical); if (mBeginTime == null) { @@ -243,8 +243,8 @@ public class CertificateRenewalWindowExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { - Vector defParams = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> defParams = new Vector<String>(); defParams.addElement(PROP_CRITICAL + "=false"); defParams.addElement(PROP_BEGIN_TIME + "="); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/CertificateScopeOfUseExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/CertificateScopeOfUseExt.java index 88ffb4dff..b385923af 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/CertificateScopeOfUseExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/CertificateScopeOfUseExt.java @@ -78,7 +78,7 @@ public class CertificateScopeOfUseExt extends APolicyRule implements } public String[] getExtendedPluginInfo(Locale locale) { - Vector v = new Vector(); + Vector<String> v = new Vector<String>(); v.addElement(PROP_CRITICAL + ";boolean; This extension may be either critical or non-critical."); @@ -89,10 +89,10 @@ public class CertificateScopeOfUseExt extends APolicyRule implements for (int i = 0; i < MAX_ENTRY; i++) { v.addElement(PROP_ENTRY + Integer.toString(i) + "_" + PROP_NAME + ";" + IGeneralNameUtil.GENNAME_VALUE_INFO); - v.addElement(PROP_ENTRY + Integer.toString(i) + "_" + PROP_NAME_TYPE + ";" - + IGeneralNameUtil.GENNAME_CHOICE_INFO); - v.addElement(PROP_ENTRY + Integer.toString(i) + "_" + PROP_PORT_NUMBER + ";string;" - + "The port number (optional)."); + v.addElement(PROP_ENTRY + + Integer.toString(i) + "_" + PROP_NAME_TYPE + ";" + IGeneralNameUtil.GENNAME_CHOICE_INFO); + v.addElement(PROP_ENTRY + + Integer.toString(i) + "_" + PROP_PORT_NUMBER + ";string;" + "The port number (optional)."); } return com.netscape.cmsutil.util.Utils.getStringArrayFromVector(v); } @@ -116,8 +116,8 @@ public class CertificateScopeOfUseExt extends APolicyRule implements /** * Returns a sequence of scope entry. */ - private Vector getScopeEntries() throws EBaseException { - Vector entries = new Vector(); + private Vector<CertificateScopeEntry> getScopeEntries() throws EBaseException { + Vector<CertificateScopeEntry> entries = new Vector<CertificateScopeEntry>(); // // read until there is *NO* ad<NUM>_method @@ -190,7 +190,7 @@ public class CertificateScopeOfUseExt extends APolicyRule implements certInfo.get(X509CertInfo.EXTENSIONS); // add access descriptions - Vector entries = getScopeEntries(); + Vector<CertificateScopeEntry> entries = getScopeEntries(); if (entries.size() == 0) { return res; @@ -247,8 +247,8 @@ public class CertificateScopeOfUseExt extends APolicyRule implements * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { - Vector params = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> params = new Vector<String>(); try { params.addElement(PROP_CRITICAL + "=" + @@ -303,8 +303,8 @@ public class CertificateScopeOfUseExt extends APolicyRule implements * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { - Vector defParams = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> defParams = new Vector<String>(); defParams.addElement(PROP_CRITICAL + "=false"); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/ExtendedKeyUsageExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/ExtendedKeyUsageExt.java index 98ab09166..65ef6b937 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/ExtendedKeyUsageExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/ExtendedKeyUsageExt.java @@ -59,7 +59,7 @@ public class ExtendedKeyUsageExt extends APolicyRule protected static int MAX_PURPOSE_ID = 10; private boolean mCritical = false; private IConfigStore mConfig = null; - private Vector mUsages = null; + private Vector<ObjectIdentifier> mUsages = null; private String[] mParams = null; @@ -156,8 +156,8 @@ public class ExtendedKeyUsageExt extends APolicyRule /** * Returns instance specific parameters. */ - public Vector getInstanceParams() { - Vector params = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> params = new Vector<String>(); params.addElement(PROP_CRITICAL + "=" + mCritical); int numIds = MAX_PURPOSE_ID; @@ -188,7 +188,7 @@ public class ExtendedKeyUsageExt extends APolicyRule } private void setExtendedPluginInfo() { - Vector v = new Vector(); + Vector<String> v = new Vector<String>(); int mNum = MAX_PURPOSE_ID; if (mConfig != null) { @@ -228,8 +228,8 @@ public class ExtendedKeyUsageExt extends APolicyRule /** * Returns default parameters. */ - public Vector getDefaultParams() { - Vector defParams = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> defParams = new Vector<String>(); defParams.addElement(PROP_CRITICAL + "=false"); defParams.addElement(PROP_NUM_IDS + "=" + MAX_PURPOSE_ID); @@ -246,7 +246,7 @@ public class ExtendedKeyUsageExt extends APolicyRule mCritical = mConfig.getBoolean(PROP_CRITICAL, false); if (mUsages == null) { - mUsages = new Vector(); + mUsages = new Vector<ObjectIdentifier>(); } int mNum = mConfig.getInteger(PROP_NUM_IDS, MAX_PURPOSE_ID); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/GenericASN1Ext.java b/pki/base/common/src/com/netscape/cms/policy/extensions/GenericASN1Ext.java index 495788a1a..0202ee784 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/GenericASN1Ext.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/GenericASN1Ext.java @@ -388,7 +388,7 @@ public class GenericASN1Ext extends APolicyRule implements // Create the extension GenericASN1Extension priExt = mkExtension(); - extensions.set(GenericASN1Extension.NAME, priExt); + extensions.set(priExt.getName(), priExt); } catch (IOException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("BASE_IO_ERROR", e.getMessage())); @@ -429,9 +429,9 @@ public class GenericASN1Ext extends APolicyRule implements throws IOException, EBaseException, ParseException { GenericASN1Extension ext; - Hashtable h = new Hashtable(); + Hashtable<String, String> h = new Hashtable<String, String>(); // This only show one level, not substores! - Enumeration e = mConfig.getPropertyNames(); + Enumeration<String> e = mConfig.getPropertyNames(); while (e.hasMoreElements()) { String n = (String) e.nextElement(); @@ -456,9 +456,9 @@ public class GenericASN1Ext extends APolicyRule implements * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { + public Vector<String> getInstanceParams() { int idx = 0; - Vector params = new Vector(); + Vector<String> params = new Vector<String>(); try { params.addElement(PROP_CRITICAL + "=" + mConfig.getBoolean(PROP_CRITICAL, false)); @@ -488,10 +488,10 @@ public class GenericASN1Ext extends APolicyRule implements * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { int idx = 0; - Vector defParams = new Vector(); + Vector<String> defParams = new Vector<String>(); defParams.addElement(PROP_CRITICAL + "=false"); defParams.addElement(PROP_NAME + "="); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/IssuerAltNameExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/IssuerAltNameExt.java index b76651ea6..21afaa188 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/IssuerAltNameExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/IssuerAltNameExt.java @@ -62,14 +62,14 @@ public class IssuerAltNameExt extends APolicyRule // PKIX specifies the that the extension SHOULD NOT be critical public static final boolean DEFAULT_CRITICALITY = false; - private static Vector defaultParams = new Vector(); + private static Vector<String> defaultParams = new Vector<String>(); private static String[] mInfo = null; static { defaultParams.addElement(PROP_CRITICAL + "=" + DEFAULT_CRITICALITY); CMS.getGeneralNamesConfigDefaultParams(null, true, defaultParams); - Vector info = new Vector(); + Vector<String> info = new Vector<String>(); info.addElement(PROP_CRITICAL + ";boolean;RFC 2459 recommendation: SHOULD NOT be marked critical."); info.addElement(IExtendedPluginInfo.HELP_TOKEN + @@ -84,7 +84,7 @@ public class IssuerAltNameExt extends APolicyRule info.copyInto(mInfo); } - private Vector mParams = new Vector(); + private Vector<String> mParams = new Vector<String>(); private IConfigStore mConfig = null; private boolean mCritical = DEFAULT_CRITICALITY; private boolean mEnabled = false; @@ -230,7 +230,7 @@ public class IssuerAltNameExt extends APolicyRule * @return Empty Vector since this policy has no configuration parameters. * for this policy instance. */ - public Vector getInstanceParams() { + public Vector<String> getInstanceParams() { return mParams; } @@ -240,7 +240,7 @@ public class IssuerAltNameExt extends APolicyRule * @return Empty Vector since this policy implementation has no * configuration parameters. */ - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return defaultParams; } diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/KeyUsageExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/KeyUsageExt.java index e89aa8488..037206b89 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/KeyUsageExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/KeyUsageExt.java @@ -282,8 +282,8 @@ public class KeyUsageExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { - Vector params = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> params = new Vector<String>(); params.addElement(PROP_CRITICAL + "=" + mCritical); params.addElement(PROP_DIGITAL_SIGNATURE + "=" + mDigitalSignature); @@ -298,7 +298,7 @@ public class KeyUsageExt extends APolicyRule return params; } - private static Vector mDefParams = new Vector(); + private static Vector<String> mDefParams = new Vector<String>(); static { mDefParams.addElement(PROP_CRITICAL + "=true"); mDefParams.addElement(PROP_DIGITAL_SIGNATURE + "="); @@ -348,7 +348,7 @@ public class KeyUsageExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return mDefParams; } diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/NSCCommentExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/NSCCommentExt.java index 7540191f3..f3ae4efa4 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/NSCCommentExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/NSCCommentExt.java @@ -71,7 +71,7 @@ public class NSCCommentExt extends APolicyRule protected String mCommentFile; protected String mInputType; protected boolean mCritical; - private Vector mParams = new Vector(); + private Vector<String> mParams = new Vector<String>(); protected String tempCommentFile; protected boolean certApplied = false; @@ -276,7 +276,7 @@ public class NSCCommentExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { + public Vector<String> getInstanceParams() { return mParams; } @@ -285,8 +285,8 @@ public class NSCCommentExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { - Vector defParams = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> defParams = new Vector<String>(); defParams.addElement(PROP_CRITICAL + "=false"); defParams.addElement(PROP_INPUT_TYPE + "=" + TEXT); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/NSCertTypeExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/NSCertTypeExt.java index 195a8792a..8903535dd 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/NSCertTypeExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/NSCertTypeExt.java @@ -494,8 +494,8 @@ public class NSCertTypeExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { - Vector params = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> params = new Vector<String>(); params.addElement(PROP_CRITICAL + "=" + mCritical); params.addElement(PROP_SET_DEFAULT_BITS + "=" + mSetDefaultBits); @@ -503,7 +503,7 @@ public class NSCertTypeExt extends APolicyRule return params; } - private static Vector mDefParams = new Vector(); + private static Vector<String> mDefParams = new Vector<String>(); static { mDefParams.addElement( PROP_CRITICAL + "=false"); @@ -532,7 +532,7 @@ public class NSCertTypeExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return mDefParams; } } diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/NameConstraintsExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/NameConstraintsExt.java index 3492ea5ed..f010bf3f1 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/NameConstraintsExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/NameConstraintsExt.java @@ -79,7 +79,7 @@ public class NameConstraintsExt extends APolicyRule protected Subtree[] mExcludedSubtrees = null; protected NameConstraintsExtension mNameConstraintsExtension = null; - protected Vector mInstanceParams = new Vector(); + protected Vector<String> mInstanceParams = new Vector<String>(); public NameConstraintsExt() { NAME = "NameConstraintsExt"; @@ -157,13 +157,13 @@ public class NameConstraintsExt extends APolicyRule // create instance of name constraints extension if enabled. if (mEnabled) { try { - Vector permittedSubtrees = new Vector(); + Vector<GeneralSubtree> permittedSubtrees = new Vector<GeneralSubtree>(); for (int i = 0; i < mNumPermittedSubtrees; i++) { permittedSubtrees.addElement( mPermittedSubtrees[i].mGeneralSubtree); } - Vector excludedSubtrees = new Vector(); + Vector<GeneralSubtree> excludedSubtrees = new Vector<GeneralSubtree>(); for (int j = 0; j < mNumExcludedSubtrees; j++) { excludedSubtrees.addElement( @@ -323,7 +323,7 @@ public class NameConstraintsExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { + public Vector<String> getInstanceParams() { return mInstanceParams; } @@ -333,7 +333,7 @@ public class NameConstraintsExt extends APolicyRule * increase the num to greater than 0 and more configuration params * will show up in the console. */ - private static Vector mDefParams = new Vector(); + private static Vector<String> mDefParams = new Vector<String>(); static { mDefParams.addElement(PROP_CRITICAL + "=" + DEF_CRITICAL); mDefParams.addElement( @@ -353,12 +353,12 @@ public class NameConstraintsExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return mDefParams; } public String[] getExtendedPluginInfo(Locale locale) { - Vector theparams = new Vector(); + Vector<String> theparams = new Vector<String>(); theparams.addElement(PROP_CRITICAL + ";boolean;RFC 2459 recommendation: MUST be critical."); theparams.addElement( @@ -447,13 +447,13 @@ class Subtree { } } - void getInstanceParams(Vector instanceParams) { + void getInstanceParams(Vector<String> instanceParams) { mBase.getInstanceParams(instanceParams); instanceParams.addElement(mNameDotMin + "=" + mMin); instanceParams.addElement(mNameDotMax + "=" + mMax); } - static void getDefaultParams(String name, Vector params) { + static void getDefaultParams(String name, Vector<String> params) { String nameDot = ""; if (name != null && name.length() >= 0) @@ -463,7 +463,7 @@ class Subtree { params.addElement(nameDot + PROP_MAX + "=" + DEF_MAX); } - static void getExtendedPluginInfo(String name, Vector info) { + static void getExtendedPluginInfo(String name, Vector<String> info) { String nameDot = ""; if (name != null && name.length() > 0) diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/OCSPNoCheckExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/OCSPNoCheckExt.java index 2bb3ff803..33f2f85e0 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/OCSPNoCheckExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/OCSPNoCheckExt.java @@ -169,8 +169,8 @@ public class OCSPNoCheckExt extends APolicyRule /** * Returns instance parameters. */ - public Vector getInstanceParams() { - Vector params = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> params = new Vector<String>(); params.addElement(PROP_CRITICAL + "=" + mCritical); return params; @@ -180,8 +180,8 @@ public class OCSPNoCheckExt extends APolicyRule /** * Returns default parameters. */ - public Vector getDefaultParams() { - Vector defParams = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> defParams = new Vector<String>(); defParams.addElement(PROP_CRITICAL + "=false"); return defParams; diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/PolicyConstraintsExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/PolicyConstraintsExt.java index ec6762701..861107b8e 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/PolicyConstraintsExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/PolicyConstraintsExt.java @@ -71,9 +71,9 @@ public class PolicyConstraintsExt extends APolicyRule protected int mInhibitPolicyMapping = DEF_INHIBIT_POLICY_MAPPING; protected PolicyConstraintsExtension mPolicyConstraintsExtension = null; - protected Vector mInstanceParams = new Vector(); + protected Vector<String> mInstanceParams = new Vector<String>(); - protected static Vector mDefaultParams = new Vector(); + protected static Vector<String> mDefaultParams = new Vector<String>(); static { mDefaultParams.addElement(PROP_CRITICAL + "=" + DEF_CRITICAL); mDefaultParams.addElement( @@ -250,7 +250,7 @@ public class PolicyConstraintsExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { + public Vector<String> getInstanceParams() { return mInstanceParams; } @@ -259,7 +259,7 @@ public class PolicyConstraintsExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return mDefaultParams; } @@ -280,7 +280,7 @@ public class PolicyConstraintsExt extends APolicyRule PROP_INHIBIT_POLICY_MAPPING + ";integer;Number of addional certificates that may appear in the path before policy mapping is no longer permitted. If less than 0 this field is unset in the extension.", IExtendedPluginInfo.HELP_TOKEN + ";configuration-policyrules-policyconstraints" - }; + }; return params; } diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/PolicyMappingsExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/PolicyMappingsExt.java index f3ef6c710..7623f455f 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/PolicyMappingsExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/PolicyMappingsExt.java @@ -74,7 +74,7 @@ public class PolicyMappingsExt extends APolicyRule protected PolicyMap[] mPolicyMaps = null; protected PolicyMappingsExtension mPolicyMappingsExtension = null; - protected Vector mInstanceParams = new Vector(); + protected Vector<String> mInstanceParams = new Vector<String>(); public PolicyMappingsExt() { NAME = "PolicyMappingsExt"; @@ -146,7 +146,7 @@ public class PolicyMappingsExt extends APolicyRule // create instance of policy mappings extension if enabled. if (mEnabled) { try { - Vector certPolicyMaps = new Vector(); + Vector<CertificatePolicyMap> certPolicyMaps = new Vector<CertificatePolicyMap>(); for (int j = 0; j < mNumPolicyMappings; j++) { certPolicyMaps.addElement( @@ -261,7 +261,7 @@ public class PolicyMappingsExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { + public Vector<String> getInstanceParams() { return mInstanceParams; } @@ -271,7 +271,7 @@ public class PolicyMappingsExt extends APolicyRule * increase the num to greater than 0 and more configuration params * will show up in the console. */ - private static Vector mDefParams = new Vector(); + private static Vector<String> mDefParams = new Vector<String>(); static { mDefParams.addElement(PROP_CRITICAL + "=" + DEF_CRITICAL); mDefParams.addElement( @@ -289,12 +289,12 @@ public class PolicyMappingsExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return mDefParams; } public String[] getExtendedPluginInfo(Locale locale) { - Vector theparams = new Vector(); + Vector<String> theparams = new Vector<String>(); theparams.addElement(PROP_CRITICAL + ";boolean;RFC 2459 recommendation: MUST be non-critical."); theparams.addElement(PROP_NUM_POLICYMAPPINGS @@ -414,7 +414,7 @@ class PolicyMap { } } - protected void getInstanceParams(Vector instanceParams) { + protected void getInstanceParams(Vector<String> instanceParams) { instanceParams.addElement( mNameDot + PROP_ISSUER_DOMAIN_POLICY + "=" + (mIssuerDomainPolicy == null ? "" : mIssuerDomainPolicy)); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/PresenceExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/PresenceExt.java index 4ce870950..e13a7a84c 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/PresenceExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/PresenceExt.java @@ -41,7 +41,7 @@ import com.netscape.cms.policy.APolicyRule; * @version $Revision$, $Date$ */ public class PresenceExt extends APolicyRule { - private static Vector mDefParams = new Vector(); + private static Vector<String> mDefParams = new Vector<String>(); private IConfigStore mConfig = null; private String mOID = null; private boolean mCritical; @@ -106,8 +106,8 @@ public class PresenceExt extends APolicyRule { return res; } - public Vector getInstanceParams() { - Vector params = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> params = new Vector<String>(); params.addElement(PROP_IS_CRITICAL + "=" + mCritical); params.addElement(PROP_OID + "=" + mOID); @@ -151,7 +151,7 @@ public class PresenceExt extends APolicyRule { * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return mDefParams; } } diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/PrivateKeyUsagePeriodExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/PrivateKeyUsagePeriodExt.java index eaf19bb33..52c8f1f69 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/PrivateKeyUsagePeriodExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/PrivateKeyUsagePeriodExt.java @@ -78,13 +78,13 @@ public class PrivateKeyUsagePeriodExt extends APolicyRule protected String mNotAfter; protected boolean mCritical; - private static Vector defaultParams; + private static Vector<String> defaultParams; static { formatter.setLenient(false); - defaultParams = new Vector(); + defaultParams = new Vector<String>(); defaultParams.addElement(PROP_IS_CRITICAL + "=" + DEFAULT_CRITICALITY); defaultParams.addElement(PROP_NOT_BEFORE + "=" + DEFAULT_NOT_BEFORE); defaultParams.addElement(PROP_NOT_AFTER + "=" + DEFAULT_NOT_AFTER); @@ -230,8 +230,8 @@ public class PrivateKeyUsagePeriodExt extends APolicyRule * @return Empty Vector since this policy has no configuration parameters. * for this policy instance. */ - public Vector getInstanceParams() { - Vector params = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> params = new Vector<String>(); params.addElement(PROP_IS_CRITICAL + "=" + mCritical); params.addElement(PROP_NOT_BEFORE + "=" + mNotBefore); @@ -245,8 +245,8 @@ public class PrivateKeyUsagePeriodExt extends APolicyRule * @return Empty Vector since this policy implementation has no * configuration parameters. */ - public Vector getDefaultParams() { - Vector defParams = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> defParams = new Vector<String>(); defParams.addElement(PROP_IS_CRITICAL + "=" + DEFAULT_CRITICALITY); defParams.addElement(PROP_NOT_BEFORE + "=" + DEFAULT_NOT_BEFORE); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/RemoveBasicConstraintsExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/RemoveBasicConstraintsExt.java index 197d1585e..0af977a24 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/RemoveBasicConstraintsExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/RemoveBasicConstraintsExt.java @@ -113,8 +113,8 @@ public class RemoveBasicConstraintsExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { - Vector params = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> params = new Vector<String>(); return params; } @@ -124,8 +124,8 @@ public class RemoveBasicConstraintsExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { - Vector defParams = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> defParams = new Vector<String>(); return defParams; } diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/SubjAltNameExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/SubjAltNameExt.java index 8152db07b..63bd8804c 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/SubjAltNameExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/SubjAltNameExt.java @@ -107,7 +107,7 @@ public class SubjAltNameExt extends APolicyRule "the 'mail' or 'mailalternateaddress' values in the authToken. " + "See the 'ldapStringAttrs' parameter in the Directory-based " + "authentication plugin" - }; + }; return params; @@ -208,7 +208,7 @@ public class SubjAltNameExt extends APolicyRule if (tok == null) break apply; - Vector emails = getEmailList(tok); + Vector<String> emails = getEmailList(tok); if (emails == null) break apply; @@ -251,10 +251,10 @@ public class SubjAltNameExt extends APolicyRule * Generate a String Vector containing all the email addresses * found in this Authentication token */ - protected Vector /* of String */ - getEmailList(IAuthToken tok) { + protected Vector /* of String */<String> + getEmailList(IAuthToken tok) { - Vector v = new Vector(); + Vector<String> v = new Vector<String>(); addValues(tok, "mail", v); addValues(tok, "mailalternateaddress", v); @@ -269,7 +269,7 @@ public class SubjAltNameExt extends APolicyRule * Add attribute values from an LDAP attribute to a vector */ protected void - addValues(IAuthToken tok, String attrName, Vector v) { + addValues(IAuthToken tok, String attrName, Vector<String> v) { String attr[] = tok.getInStringArray(attrName); if (attr == null) @@ -284,13 +284,13 @@ public class SubjAltNameExt extends APolicyRule * Make a Subject name extension given a list of email addresses */ protected SubjectAlternativeNameExtension - mkExt(Vector emails) + mkExt(Vector<String> emails) throws IOException { SubjectAlternativeNameExtension sa; GeneralNames gns = new GeneralNames(); for (int i = 0; i < emails.size(); i++) { - String email = (String) emails.elementAt(i); + String email = emails.elementAt(i); gns.addElement(new RFC822Name(email)); } @@ -326,8 +326,8 @@ public class SubjAltNameExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { - Vector params = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> params = new Vector<String>(); //params.addElement("PROP_AGENT_OVERR = " + mAllowAgentOverride); //params.addElement("PROP_EE_OVERR = " + mAllowEEOverride); @@ -342,8 +342,8 @@ public class SubjAltNameExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { - Vector defParams = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> defParams = new Vector<String>(); //defParams.addElement("PROP_AGENT_OVERR = " + DEF_AGENT_OVERR); //defParams.addElement("PROP_EE_OVERR = " + DEF_EE_OVERR); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectAltNameExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectAltNameExt.java index 9a54a7aad..62f0b21da 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectAltNameExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectAltNameExt.java @@ -80,10 +80,10 @@ public class SubjectAltNameExt extends APolicyRule protected int mNumGNs = 0; protected ISubjAltNameConfig[] mGNs = null; - Vector mInstanceParams = new Vector(); + Vector<String> mInstanceParams = new Vector<String>(); // init default params and extended plugin info. - private static Vector mDefParams = new Vector(); + private static Vector<String> mDefParams = new Vector<String>(); static { // default params. mDefParams.addElement(PROP_CRITICAL + "=" + DEF_CRITICAL); @@ -211,12 +211,12 @@ public class SubjectAltNameExt extends APolicyRule if (value == null) { continue; } - Vector gn = mGNs[i].formGeneralNames(value); + Vector<GeneralName> gn = mGNs[i].formGeneralNames(value); if (gn.size() == 0) continue; - for (Enumeration n = gn.elements(); n.hasMoreElements();) { - gns.addElement((GeneralName) n.nextElement()); + for (Enumeration<GeneralName> n = gn.elements(); n.hasMoreElements();) { + gns.addElement(n.nextElement()); } } @@ -288,7 +288,7 @@ public class SubjectAltNameExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { + public Vector<String> getInstanceParams() { return mInstanceParams; } @@ -297,14 +297,14 @@ public class SubjectAltNameExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return mDefParams; } public String[] getExtendedPluginInfo(Locale locale) { // extended plugin info. - Vector info = new Vector(); + Vector<String> info = new Vector<String>(); info.addElement(PROP_CRITICAL + ";boolean;RFC2459 recommendation: If the certificate subject field contains an empty sequence, the extension MUST be marked critical."); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectDirectoryAttributesExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectDirectoryAttributesExt.java index f7e18e8ca..6c1c6a4e8 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectDirectoryAttributesExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectDirectoryAttributesExt.java @@ -73,9 +73,9 @@ public class SubjectDirectoryAttributesExt extends APolicyRule protected IConfigStore mConfig; protected SubjectDirAttributesExtension mExt = null; - protected Vector mParams = new Vector(); + protected Vector<String> mParams = new Vector<String>(); private String[] mEPI = null; // extended plugin info - protected static Vector mDefParams = new Vector(); + protected static Vector<String> mDefParams = new Vector<String>(); static { setDefaultParams(); @@ -190,11 +190,11 @@ public class SubjectDirectoryAttributesExt extends APolicyRule } } - public Vector getInstanceParams() { + public Vector<String> getInstanceParams() { return mParams; // inited in init() } - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return mDefParams; } @@ -223,7 +223,7 @@ public class SubjectDirectoryAttributesExt extends APolicyRule } private void setExtendedPluginInfo() { - Vector v = new Vector(); + Vector<String> v = new Vector<String>(); v.addElement(PROP_CRITICAL + ";boolean;" + "RFC 2459 recommendation: MUST be non-critical."); @@ -245,7 +245,7 @@ public class SubjectDirectoryAttributesExt extends APolicyRule private SubjectDirAttributesExtension formExt(IRequest req) throws IOException { - Vector attrs = new Vector(); + Vector<Attribute> attrs = new Vector<Attribute>(); // if we're called from init and one attribute is from request attribute // the ext can't be formed yet. @@ -369,7 +369,7 @@ class AttributeConfig { } } - public static void getDefaultParams(String name, Vector v) { + public static void getDefaultParams(String name, Vector<String> v) { String nameDot = name + "."; v.addElement(nameDot + PROP_ATTRIBUTE_NAME + "="); @@ -377,7 +377,7 @@ class AttributeConfig { v.addElement(nameDot + PROP_VALUE + "="); } - public static void getExtendedPluginInfo(String name, Vector v) { + public static void getExtendedPluginInfo(String name, Vector<String> v) { String nameDot = name + "."; String attrChoices = getAllNames(); @@ -387,7 +387,7 @@ class AttributeConfig { v.addElement(nameDot + VALUE_INFO); } - public void getInstanceParams(Vector v) { + public void getInstanceParams(Vector<String> v) { String nameDot = mName + "."; v.addElement(nameDot + PROP_ATTRIBUTE_NAME + "=" + mAttributeName); @@ -407,9 +407,9 @@ class AttributeConfig { } static private String getAllNames() { - Enumeration n = X500NameAttrMap.getDefault().getAllNames(); + Enumeration<String> n = X500NameAttrMap.getDefault().getAllNames(); StringBuffer sb = new StringBuffer(); - sb.append((String) n.nextElement()); + sb.append(n.nextElement()); while (n.hasMoreElements()) { sb.append(","); diff --git a/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectKeyIdentifierExt.java b/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectKeyIdentifierExt.java index 73649dd61..32d254c40 100644 --- a/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectKeyIdentifierExt.java +++ b/pki/base/common/src/com/netscape/cms/policy/extensions/SubjectKeyIdentifierExt.java @@ -80,9 +80,9 @@ public class SubjectKeyIdentifierExt extends APolicyRule protected String mKeyIdType = DEF_KEYID_TYPE;; protected String mReqAttrName = DEF_REQATTR_NAME; - protected Vector mInstanceParams = new Vector(); + protected Vector<String> mInstanceParams = new Vector<String>(); - protected static Vector mDefaultParams = new Vector(); + protected static Vector<String> mDefaultParams = new Vector<String>(); static { // form static default params. mDefaultParams.addElement(PROP_CRITICAL + "=" + DEF_CRITICAL); @@ -342,7 +342,7 @@ public class SubjectKeyIdentifierExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getInstanceParams() { + public Vector<String> getInstanceParams() { return mInstanceParams; } @@ -351,7 +351,7 @@ public class SubjectKeyIdentifierExt extends APolicyRule * * @return nvPairs A Vector of name/value pairs. */ - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return mDefaultParams; } diff --git a/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java b/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java index 7a1a31a3d..941617121 100644 --- a/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java +++ b/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java @@ -883,16 +883,16 @@ public abstract class BasicProfile implements IProfile { matches++; if (createConfig) { if (matches == 1) { - CMS.debug("WARNING attempt to add duplicate Policy " + defaultClassId + ":" - + constraintClassId + + CMS.debug("WARNING attempt to add duplicate Policy " + + defaultClassId + ":" + constraintClassId + " Contact System Administrator."); - throw new EProfileException("Attempt to add duplicate Policy : " + defaultClassId + ":" - + constraintClassId); + throw new EProfileException("Attempt to add duplicate Policy : " + + defaultClassId + ":" + constraintClassId); } } else { if (matches > 1) { - CMS.debug("WARNING attempt to add duplicate Policy " + defaultClassId + ":" - + constraintClassId + + CMS.debug("WARNING attempt to add duplicate Policy " + + defaultClassId + ":" + constraintClassId + " Contact System Administrator."); } } diff --git a/pki/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java b/pki/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java index 9b8d09e0f..f2e921a53 100644 --- a/pki/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java +++ b/pki/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java @@ -729,15 +729,16 @@ public abstract class EnrollProfile extends BasicProfile INTEGER num = (INTEGER) (bodyIds.elementAt(i)); if (num.toString().equals(reqId.toString())) { donePOP = true; - CMS.debug("EnrollProfile: skip POP for request: " + reqId.toString() - + " because LRA POP Witness control is found."); + CMS.debug("EnrollProfile: skip POP for request: " + + reqId.toString() + " because LRA POP Witness control is found."); break; } } } if (!donePOP) { - CMS.debug("EnrollProfile: not skip POP for request: " + reqId.toString() + CMS.debug("EnrollProfile: not skip POP for request: " + + reqId.toString() + " because this request id is not part of the body list in LRA Pop witness control."); verifyPOP(locale, crm); } diff --git a/pki/base/common/src/com/netscape/cms/profile/constraint/EnrollConstraint.java b/pki/base/common/src/com/netscape/cms/profile/constraint/EnrollConstraint.java index b16a7d94b..40c2153a8 100644 --- a/pki/base/common/src/com/netscape/cms/profile/constraint/EnrollConstraint.java +++ b/pki/base/common/src/com/netscape/cms/profile/constraint/EnrollConstraint.java @@ -47,12 +47,12 @@ public abstract class EnrollConstraint implements IPolicyConstraint { public static final String CONFIG_NAME = "name"; protected IConfigStore mConfig = null; - protected Vector mConfigNames = new Vector(); + protected Vector<String> mConfigNames = new Vector<String>(); public EnrollConstraint() { } - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { return mConfigNames.elements(); } @@ -173,10 +173,10 @@ public abstract class EnrollConstraint implements IPolicyConstraint { } if (exts == null) return null; - Enumeration e = exts.getElements(); + Enumeration<Extension> e = exts.getAttributes(); while (e.hasMoreElements()) { - Extension ext = (Extension) e.nextElement(); + Extension ext = e.nextElement(); if (ext.getExtensionId().toString().equals(name)) { return ext; diff --git a/pki/base/common/src/com/netscape/cms/profile/constraint/KeyConstraint.java b/pki/base/common/src/com/netscape/cms/profile/constraint/KeyConstraint.java index 8bc16544c..558338e7f 100644 --- a/pki/base/common/src/com/netscape/cms/profile/constraint/KeyConstraint.java +++ b/pki/base/common/src/com/netscape/cms/profile/constraint/KeyConstraint.java @@ -55,8 +55,8 @@ public class KeyConstraint extends EnrollConstraint { public static final String CONFIG_KEY_TYPE = "keyType"; // (EC, RSA) public static final String CONFIG_KEY_PARAMETERS = "keyParameters"; - private static final String[] ecCurves = { "nistp256", "nistp384", "nistp521", "sect163k1", "nistk163", - "sect163r1", "sect163r2", + private static final String[] ecCurves = { + "nistp256", "nistp384", "nistp521", "sect163k1", "nistk163", "sect163r1", "sect163r2", "nistb163", "sect193r1", "sect193r2", "sect233k1", "nistk233", "sect233r1", "nistb233", "sect239k1", "sect283k1", "nistk283", "sect283r1", "nistb283", "sect409k1", "nistk409", "sect409r1", "nistb409", "sect571k1", "nistk571", diff --git a/pki/base/common/src/com/netscape/cms/profile/constraint/RenewGracePeriodConstraint.java b/pki/base/common/src/com/netscape/cms/profile/constraint/RenewGracePeriodConstraint.java index 8f78945f6..fb01d7d14 100644 --- a/pki/base/common/src/com/netscape/cms/profile/constraint/RenewGracePeriodConstraint.java +++ b/pki/base/common/src/com/netscape/cms/profile/constraint/RenewGracePeriodConstraint.java @@ -122,8 +122,8 @@ public class RenewGracePeriodConstraint extends EnrollConstraint { Date current = CMS.getCurrentDate(); long millisDiff = origExpDate.getTime() - current.getTime(); - CMS.debug("validateRenewGracePeriod: millisDiff=" + millisDiff + " origExpDate=" + origExpDate.getTime() - + " current=" + current.getTime()); + CMS.debug("validateRenewGracePeriod: millisDiff=" + + millisDiff + " origExpDate=" + origExpDate.getTime() + " current=" + current.getTime()); /* * "days", if positive, has to be less than renew_grace_before diff --git a/pki/base/common/src/com/netscape/cms/profile/constraint/UniqueSubjectNameConstraint.java b/pki/base/common/src/com/netscape/cms/profile/constraint/UniqueSubjectNameConstraint.java index 211aef913..7a985b631 100644 --- a/pki/base/common/src/com/netscape/cms/profile/constraint/UniqueSubjectNameConstraint.java +++ b/pki/base/common/src/com/netscape/cms/profile/constraint/UniqueSubjectNameConstraint.java @@ -179,14 +179,14 @@ public class UniqueSubjectNameConstraint extends EnrollConstraint { else { certsubjectname = sn.toString(); String filter = "x509Cert.subject=" + certsubjectname; - Enumeration sameSubjRecords = null; + Enumeration<ICertRecord> sameSubjRecords = null; try { sameSubjRecords = certdb.findCertRecords(filter); } catch (EBaseException e) { CMS.debug("UniqueSubjectNameConstraint exception: " + e.toString()); } while (sameSubjRecords != null && sameSubjRecords.hasMoreElements()) { - ICertRecord rec = (ICertRecord) sameSubjRecords.nextElement(); + ICertRecord rec = sameSubjRecords.nextElement(); String status = rec.getStatus(); IRevocationInfo revocationInfo = rec.getRevocationInfo(); @@ -196,10 +196,10 @@ public class UniqueSubjectNameConstraint extends EnrollConstraint { CRLExtensions crlExts = revocationInfo.getCRLEntryExtensions(); if (crlExts != null) { - Enumeration enumx = crlExts.getElements(); + Enumeration<Extension> enumx = crlExts.getElements(); while (enumx.hasMoreElements()) { - Extension ext = (Extension) enumx.nextElement(); + Extension ext = enumx.nextElement(); if (ext instanceof CRLReasonExtension) { reason = ((CRLReasonExtension) ext).getReason(); diff --git a/pki/base/common/src/com/netscape/cms/profile/constraint/ValidityConstraint.java b/pki/base/common/src/com/netscape/cms/profile/constraint/ValidityConstraint.java index abfef548d..98a7b4f96 100644 --- a/pki/base/common/src/com/netscape/cms/profile/constraint/ValidityConstraint.java +++ b/pki/base/common/src/com/netscape/cms/profile/constraint/ValidityConstraint.java @@ -141,8 +141,8 @@ public class ValidityConstraint extends EnrollConstraint { } long millisDiff = notAfter.getTime() - notBefore.getTime(); - CMS.debug("ValidityConstraint: millisDiff=" + millisDiff + " notAfter=" + notAfter.getTime() + " notBefore=" - + notBefore.getTime()); + CMS.debug("ValidityConstraint: millisDiff=" + + millisDiff + " notAfter=" + notAfter.getTime() + " notBefore=" + notBefore.getTime()); long long_days = (millisDiff / 1000) / 86400; CMS.debug("ValidityConstraint: long_days: " + long_days); int days = (int) long_days; diff --git a/pki/base/common/src/com/netscape/cms/profile/def/CRLDistributionPointsExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/CRLDistributionPointsExtDefault.java index 92592d137..a95ec6b7d 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/CRLDistributionPointsExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/CRLDistributionPointsExtDefault.java @@ -107,7 +107,7 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { super.setConfig(name, value); } - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { refreshConfigAndValueNames(); return super.getConfigNames(); } @@ -240,7 +240,7 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { if (ext == null) { return; } - Vector v = parseRecords(value); + Vector<NameValuePairs> v = parseRecords(value); int size = v.size(); boolean critical = ext.isCritical(); @@ -248,7 +248,7 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { for (; i < size; i++) { NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration names = nvps.getNames(); + Enumeration<String> names = nvps.getNames(); String pointType = null; String pointValue = null; String issuerType = null; @@ -438,7 +438,7 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { StringBuffer sb = new StringBuffer(); - Vector recs = new Vector(); + Vector<NameValuePairs> recs = new Vector<NameValuePairs>(); int num = getNumPoints(); for (int i = 0; i < num; i++) { diff --git a/pki/base/common/src/com/netscape/cms/profile/def/CertificatePoliciesExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/CertificatePoliciesExtDefault.java index 6668ee823..8d4ae2288 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/CertificatePoliciesExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/CertificatePoliciesExtDefault.java @@ -146,7 +146,7 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { super.setConfig(name, value); } - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { refreshConfigAndValueNames(); return super.getConfigNames(); } @@ -172,8 +172,8 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { addConfigName(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR + CONFIG_USERNOTICE_ENABLE); addConfigName(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR + CONFIG_CPSURI_VALUE); addConfigName(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR + CONFIG_USERNOTICE_ORG); - addConfigName(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR - + CONFIG_USERNOTICE_NUMBERS); + addConfigName(CONFIG_PREFIX + + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR + CONFIG_USERNOTICE_NUMBERS); addConfigName(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR + CONFIG_USERNOTICE_TEXT); } } @@ -243,9 +243,9 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { return null; } - private Hashtable buildRecords(String value) throws EPropertyException { + private Hashtable<String, String> buildRecords(String value) throws EPropertyException { StringTokenizer st = new StringTokenizer(value, "\r\n"); - Hashtable table = new Hashtable(); + Hashtable<String, String> table = new Hashtable<String, String>(); while (st.hasMoreTokens()) { String token = (String) st.nextToken(); int index = token.indexOf(":"); @@ -285,12 +285,12 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { getExtension(PKIXExtensions.CertificatePolicies_Id.toString(), info); - Hashtable h = buildRecords(value); + Hashtable<String, String> h = buildRecords(value); String numStr = (String) h.get(CONFIG_POLICY_NUM); int size = Integer.parseInt(numStr); - Vector certificatePolicies = new Vector(); + Vector<CertificatePolicyInfo> certificatePolicies = new Vector<CertificatePolicyInfo>(); for (int i = 0; i < size; i++) { String enable = (String) h.get(CONFIG_PREFIX + i + SEPARATOR + CONFIG_POLICY_ENABLE); CertificatePolicyInfo cinfo = null; @@ -302,30 +302,41 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { locale, "CMS_PROFILE_CERTIFICATE_POLICIES_EMPTY_POLICYID")); CertificatePolicyId cpolicyId = getPolicyId(policyId); - String qualifersNum = (String) h.get(CONFIG_PREFIX + i + SEPARATOR - + CONFIG_POLICY_QUALIFIERS_NUM); + String qualifersNum = + (String) h.get(CONFIG_PREFIX + i + SEPARATOR + CONFIG_POLICY_QUALIFIERS_NUM); PolicyQualifiers policyQualifiers = new PolicyQualifiers(); int num = 0; if (qualifersNum != null && qualifersNum.length() > 0) num = Integer.parseInt(qualifersNum); for (int j = 0; j < num; j++) { - String cpsuriEnable = (String) h.get(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + j - + SEPARATOR + CONFIG_CPSURI_ENABLE); - String usernoticeEnable = (String) h.get(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + j - + SEPARATOR + CONFIG_USERNOTICE_ENABLE); + String cpsuriEnable = + (String) h.get(CONFIG_PREFIX + + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR + CONFIG_CPSURI_ENABLE); + String usernoticeEnable = + (String) h + .get(CONFIG_PREFIX + + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR + + CONFIG_USERNOTICE_ENABLE); if (cpsuriEnable != null && cpsuriEnable.equals("true")) { - String cpsuri = (String) h.get(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + j - + SEPARATOR + CONFIG_CPSURI_VALUE); + String cpsuri = + (String) h.get(CONFIG_PREFIX + + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR + CONFIG_CPSURI_VALUE); netscape.security.x509.PolicyQualifierInfo qualifierInfo = createCPSuri(cpsuri); if (qualifierInfo != null) policyQualifiers.add(qualifierInfo); } else if (usernoticeEnable != null && enable.equals("true")) { - String org = (String) h.get(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + j - + SEPARATOR + CONFIG_USERNOTICE_ORG); - String noticenumbers = (String) h.get(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 - + j + SEPARATOR + CONFIG_USERNOTICE_NUMBERS); - String explicitText = (String) h.get(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + j - + SEPARATOR + CONFIG_USERNOTICE_TEXT); + String org = + (String) h.get(CONFIG_PREFIX + + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR + + CONFIG_USERNOTICE_ORG); + String noticenumbers = + (String) h.get(CONFIG_PREFIX + + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR + + CONFIG_USERNOTICE_NUMBERS); + String explicitText = + (String) h.get(CONFIG_PREFIX + + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR + + CONFIG_USERNOTICE_TEXT); netscape.security.x509.PolicyQualifierInfo qualifierInfo = createUserNotice(org, noticenumbers, explicitText); if (qualifierInfo != null) @@ -364,6 +375,7 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { } } + @SuppressWarnings("unchecked") public String getValue(String name, Locale locale, X509CertInfo info) throws EPropertyException { @@ -397,17 +409,17 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { StringBuffer sb = new StringBuffer(); int num_policies = getNumPolicies(); - int num_qualifiers = DEF_NUM_QUALIFIERS; sb.append(CONFIG_POLICY_NUM); sb.append(":"); sb.append(num_policies); sb.append("\n"); - Vector infos = null; + Vector<CertificatePolicyInfo> infos; + try { - infos = (Vector) (ext.get(CertificatePoliciesExtension.INFOS)); + infos = (Vector<CertificatePolicyInfo>) ext.get(CertificatePoliciesExtension.INFOS); } catch (IOException ee) { + infos = null; } - Enumeration policies = ext.getElements(); for (int i = 0; i < num_policies; i++) { int qSize = 0; @@ -416,7 +428,7 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { PolicyQualifiers qualifiers = null; if (infos.size() > 0) { CertificatePolicyInfo cinfo = - (CertificatePolicyInfo) infos.elementAt(0); + infos.elementAt(0); CertificatePolicyId id1 = cinfo.getPolicyIdentifier(); policyId = id1.getIdentifier().toString(); @@ -455,8 +467,8 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { sb.append(":"); sb.append(""); sb.append("\n"); - sb.append(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + "0" + SEPARATOR - + CONFIG_USERNOTICE_ENABLE); + sb.append(CONFIG_PREFIX + + i + SEPARATOR + CONFIG_PREFIX1 + "0" + SEPARATOR + CONFIG_USERNOTICE_ENABLE); sb.append(":"); sb.append("false"); sb.append("\n"); @@ -464,8 +476,8 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { sb.append(":"); sb.append(""); sb.append("\n"); - sb.append(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + "0" + SEPARATOR - + CONFIG_USERNOTICE_NUMBERS); + sb.append(CONFIG_PREFIX + + i + SEPARATOR + CONFIG_PREFIX1 + "0" + SEPARATOR + CONFIG_USERNOTICE_NUMBERS); sb.append(":"); sb.append(""); sb.append("\n"); @@ -527,8 +539,8 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { sb.append(":"); sb.append(org); sb.append("\n"); - sb.append(CONFIG_PREFIX + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR - + CONFIG_USERNOTICE_NUMBERS); + sb.append(CONFIG_PREFIX + + i + SEPARATOR + CONFIG_PREFIX1 + j + SEPARATOR + CONFIG_USERNOTICE_NUMBERS); sb.append(":"); sb.append(noticeNum.toString()); sb.append("\n"); @@ -547,7 +559,6 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { public String getText(Locale locale) { StringBuffer sb = new StringBuffer(); - String numPolicies = getConfig(CONFIG_POLICY_NUM); int num = getNumPolicies(); int num1 = getNumQualifiers(); @@ -630,7 +641,7 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { try { boolean critical = getConfigBoolean(CONFIG_CRITICAL); - Vector certificatePolicies = new Vector(); + Vector<CertificatePolicyInfo> certificatePolicies = new Vector<CertificatePolicyInfo>(); int num = getNumPolicies(); CMS.debug("CertificatePoliciesExtension: createExtension: number of policies=" + num); IConfigStore config = getConfigStore(); @@ -644,8 +655,8 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { if (enable != null && enable.equals("true")) { String policyId = substore.getString(CONFIG_POLICY_ID); CertificatePolicyId cpolicyId = getPolicyId(policyId); - CMS.debug("CertificatePoliciesExtension: createExtension: CertificatePolicy " + i + " policyId=" - + policyId); + CMS.debug("CertificatePoliciesExtension: createExtension: CertificatePolicy " + + i + " policyId=" + policyId); int qualifierNum = getNumQualifiers(); PolicyQualifiers policyQualifiers = new PolicyQualifiers(); for (int j = 0; j < qualifierNum; j++) { @@ -741,7 +752,7 @@ public class CertificatePoliciesExtDefault extends EnrollExtDefault { int nums[] = null; if (noticeNums != null && noticeNums.length() > 0) { - Vector numsVector = new Vector(); + Vector<String> numsVector = new Vector<String>(); StringTokenizer tokens = new StringTokenizer(noticeNums, ";"); while (tokens.hasMoreTokens()) { String num = tokens.nextToken().trim(); diff --git a/pki/base/common/src/com/netscape/cms/profile/def/EnrollDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/EnrollDefault.java index 060f2ad16..855cd92c7 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/EnrollDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/EnrollDefault.java @@ -289,10 +289,10 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe info.get(X509CertInfo.EXTENSIONS); if (exts == null) return; - Enumeration<?> e = exts.getNames(); + Enumeration<String> e = exts.getNames(); while (e.hasMoreElements()) { - String n = (String) e.nextElement(); + String n = e.nextElement(); Extension ext = (Extension) exts.get(n); if (ext.getExtensionId().toString().equals(name)) { @@ -321,10 +321,10 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe protected Extension getExtension(String name, CertificateExtensions exts) { if (exts == null) return null; - Enumeration<?> e = exts.getElements(); + Enumeration<Extension> e = exts.getAttributes(); while (e.hasMoreElements()) { - Extension ext = (Extension) e.nextElement(); + Extension ext = e.nextElement(); if (ext.getExtensionId().toString().equals(name)) { return ext; @@ -632,19 +632,19 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe return true; } - protected String buildRecords(Vector<?> recs) throws EPropertyException { + protected String buildRecords(Vector<NameValuePairs> recs) throws EPropertyException { StringBuffer sb = new StringBuffer(); for (int i = 0; i < recs.size(); i++) { - NameValuePairs pairs = (NameValuePairs) recs.elementAt(i); + NameValuePairs pairs = recs.elementAt(i); sb.append("Record #"); sb.append(i); sb.append("\r\n"); - Enumeration<?> e = pairs.getNames(); + Enumeration<String> e = pairs.getNames(); while (e.hasMoreElements()) { - String key = (String) e.nextElement(); + String key = e.nextElement(); String val = pairs.getValue(key); sb.append(key); @@ -665,14 +665,14 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe NameValuePairs nvps = null; while (st.hasMoreTokens()) { - String token = (String) st.nextToken(); + String token = st.nextToken(); if (token.equals("Record #" + num)) { CMS.debug("parseRecords: Record" + num); nvps = new NameValuePairs(); v.addElement(nvps); try { - token = (String) st.nextToken(); + token = st.nextToken(); } catch (NoSuchElementException e) { v.removeElementAt(num); CMS.debug(e.toString()); @@ -756,7 +756,7 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe return locale; } - public String toGeneralNameString(GeneralName gn) { + public String toGeneralNameString(GeneralNameInterface gn) { int type = gn.getType(); // Sun's General Name is not consistent, so we need // to do a special case for directory string diff --git a/pki/base/common/src/com/netscape/cms/profile/def/FreshestCRLExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/FreshestCRLExtDefault.java index 3dcf89929..d5ac9247d 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/FreshestCRLExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/FreshestCRLExtDefault.java @@ -119,7 +119,7 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { super.setConfig(name, value); } - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { refreshConfigAndValueNames(); return super.getConfigNames(); } @@ -224,7 +224,7 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { getExtension(FreshestCRLExtension.OID, info); - Vector v = parseRecords(value); + Vector<NameValuePairs> v = parseRecords(value); int size = v.size(); boolean critical = ext.isCritical(); @@ -232,7 +232,7 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { for (; i < size; i++) { NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration names = nvps.getNames(); + Enumeration<String> names = nvps.getNames(); String pointType = null; String pointValue = null; String issuerType = null; @@ -384,7 +384,7 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { StringBuffer sb = new StringBuffer(); - Vector recs = new Vector(); + Vector<NameValuePairs> recs = new Vector<NameValuePairs>(); int num = getNumPoints(); for (int i = 0; i < num; i++) { NameValuePairs pairs = null; diff --git a/pki/base/common/src/com/netscape/cms/profile/def/IssuerAltNameExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/IssuerAltNameExtDefault.java index d56eebc02..251d8a3e7 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/IssuerAltNameExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/IssuerAltNameExtDefault.java @@ -235,7 +235,7 @@ public class IssuerAltNameExtDefault extends EnrollExtDefault { GeneralNames names = (GeneralNames) ext.get(IssuerAlternativeNameExtension.ISSUER_NAME); StringBuffer sb = new StringBuffer(); - Enumeration e = names.elements(); + Enumeration<GeneralNameInterface> e = names.elements(); while (e.hasMoreElements()) { GeneralName gn = (GeneralName) e.nextElement(); diff --git a/pki/base/common/src/com/netscape/cms/profile/def/NameConstraintsExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/NameConstraintsExtDefault.java index 45db35767..c513c332b 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/NameConstraintsExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/NameConstraintsExtDefault.java @@ -315,9 +315,9 @@ public class NameConstraintsExtDefault extends EnrollExtDefault { return; } - Vector v = parseRecords(value); + Vector<NameValuePairs> v = parseRecords(value); - Vector permittedSubtrees = createSubtrees(locale, v); + Vector<GeneralSubtree> permittedSubtrees = createSubtrees(locale, v); ext.set(NameConstraintsExtension.PERMITTED_SUBTREES, new GeneralSubtrees(permittedSubtrees)); @@ -333,9 +333,9 @@ public class NameConstraintsExtDefault extends EnrollExtDefault { "blank value for excluded subtrees ... returning"); return; } - Vector v = parseRecords(value); + Vector<NameValuePairs> v = parseRecords(value); - Vector excludedSubtrees = createSubtrees(locale, v); + Vector<GeneralSubtree> excludedSubtrees = createSubtrees(locale, v); ext.set(NameConstraintsExtension.EXCLUDED_SUBTREES, new GeneralSubtrees(excludedSubtrees)); @@ -356,18 +356,18 @@ public class NameConstraintsExtDefault extends EnrollExtDefault { } } - private Vector createSubtrees(Locale locale, Vector v) throws EPropertyException { + private Vector<GeneralSubtree> createSubtrees(Locale locale, Vector<NameValuePairs> v) throws EPropertyException { int size = v.size(); String choice = null; String val = ""; String minS = null; String maxS = null; - Vector subtrees = new Vector(); + Vector<GeneralSubtree> subtrees = new Vector<GeneralSubtree>(); for (int i = 0; i < size; i++) { NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration names = nvps.getNames(); + Enumeration<String> names = nvps.getNames(); while (names.hasMoreElements()) { String name1 = (String) names.nextElement(); @@ -512,10 +512,10 @@ public class NameConstraintsExtDefault extends EnrollExtDefault { private String getSubtreesInfo(NameConstraintsExtension ext, GeneralSubtrees subtrees) throws EPropertyException { - Vector trees = subtrees.getSubtrees(); + Vector<GeneralSubtree> trees = subtrees.getSubtrees(); int size = trees.size(); - Vector recs = new Vector(); + Vector<NameValuePairs> recs = new Vector<NameValuePairs>(); for (int i = 0; i < size; i++) { GeneralSubtree tree = (GeneralSubtree) trees.elementAt(i); @@ -601,7 +601,7 @@ public class NameConstraintsExtDefault extends EnrollExtDefault { boolean critical = getConfigBoolean(CONFIG_CRITICAL); - Vector v = new Vector(); + Vector<GeneralSubtree> v = new Vector<GeneralSubtree>(); for (int i = 0; i < num; i++) { String enable = getConfig(CONFIG_PERMITTED_ENABLE + i); @@ -616,7 +616,7 @@ public class NameConstraintsExtDefault extends EnrollExtDefault { } } - Vector v1 = new Vector(); + Vector<GeneralSubtree> v1 = new Vector<GeneralSubtree>(); num = getNumExcluded(); for (int i = 0; i < num; i++) { diff --git a/pki/base/common/src/com/netscape/cms/profile/def/PolicyMappingsExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/PolicyMappingsExtDefault.java index f8fcfe15a..183ef87bc 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/PolicyMappingsExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/PolicyMappingsExtDefault.java @@ -108,7 +108,7 @@ public class PolicyMappingsExtDefault extends EnrollExtDefault { super.setConfig(name, value); } - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { refreshConfigAndValueNames(); return super.getConfigNames(); } @@ -207,17 +207,17 @@ public class PolicyMappingsExtDefault extends EnrollExtDefault { if (ext == null) { return; } - Vector v = parseRecords(value); + Vector<NameValuePairs> v = parseRecords(value); int size = v.size(); String issuerPolicyId = null; String subjectPolicyId = null; String enable = null; - Vector policyMaps = new Vector(); + Vector<CertificatePolicyMap> policyMaps = new Vector<CertificatePolicyMap>(); for (int i = 0; i < size; i++) { NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration names = nvps.getNames(); + Enumeration<String> names = nvps.getNames(); while (names.hasMoreElements()) { String name1 = (String) names.nextElement(); @@ -310,12 +310,12 @@ public class PolicyMappingsExtDefault extends EnrollExtDefault { int num_mappings = getNumMappings(); - Enumeration maps = ext.getMappings(); + Enumeration<CertificatePolicyMap> maps = ext.getMappings(); int num = 0; StringBuffer sb = new StringBuffer(); - Vector recs = new Vector(); + Vector<NameValuePairs> recs = new Vector<NameValuePairs>(); for (int i = 0; i < num_mappings; i++) { NameValuePairs pairs = new NameValuePairs(); @@ -388,7 +388,7 @@ public class PolicyMappingsExtDefault extends EnrollExtDefault { try { boolean critical = getConfigBoolean(CONFIG_CRITICAL); - Vector policyMaps = new Vector(); + Vector<CertificatePolicyMap> policyMaps = new Vector<CertificatePolicyMap>(); int num = getNumMappings(); for (int i = 0; i < num; i++) { diff --git a/pki/base/common/src/com/netscape/cms/profile/def/SubjectAltNameExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/SubjectAltNameExtDefault.java index c14f3239f..b205f7df4 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/SubjectAltNameExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/SubjectAltNameExtDefault.java @@ -23,7 +23,6 @@ import java.util.Locale; import java.util.StringTokenizer; import java.util.UUID; -import netscape.security.x509.GeneralName; import netscape.security.x509.GeneralNameInterface; import netscape.security.x509.GeneralNames; import netscape.security.x509.PKIXExtensions; @@ -156,7 +155,7 @@ public class SubjectAltNameExtDefault extends EnrollExtDefault { super.setConfig(name, value); } - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { refreshConfigAndValueNames(); return super.getConfigNames(); } @@ -354,13 +353,10 @@ public class SubjectAltNameExtDefault extends EnrollExtDefault { GeneralNames names = (GeneralNames) ext.get(SubjectAlternativeNameExtension.SUBJECT_NAME); StringBuffer sb = new StringBuffer(); - Enumeration e = names.elements(); + Enumeration<GeneralNameInterface> e = names.elements(); while (e.hasMoreElements()) { - Object o = (Object) e.nextElement(); - if (!(o instanceof GeneralName)) - continue; - GeneralName gn = (GeneralName) o; + GeneralNameInterface gn = e.nextElement(); if (!sb.toString().equals("")) { sb.append("\r\n"); diff --git a/pki/base/common/src/com/netscape/cms/profile/def/SubjectDirAttributesExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/SubjectDirAttributesExtDefault.java index ca361f6b8..29562123e 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/SubjectDirAttributesExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/SubjectDirAttributesExtDefault.java @@ -114,7 +114,7 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { super.setConfig(name, value); } - public Enumeration getConfigNames() { + public Enumeration<String> getConfigNames() { refreshConfigAndValueNames(); return super.getConfigNames(); } @@ -212,21 +212,21 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { if (ext == null) { return; } - Vector v = parseRecords(value); + Vector<NameValuePairs> v = parseRecords(value); int size = v.size(); boolean critical = ext.isCritical(); X500NameAttrMap map = X500NameAttrMap.getDefault(); - Vector attrV = new Vector(); + Vector<Attribute> attrV = new Vector<Attribute>(); for (int i = 0; i < size; i++) { - NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration names = nvps.getNames(); + NameValuePairs nvps = v.elementAt(i); + Enumeration<String> names = nvps.getNames(); String attrName = null; String attrValue = null; String enable = "false"; while (names.hasMoreElements()) { - String name1 = (String) names.nextElement(); + String name1 = names.nextElement(); if (name1.equals(ATTR_NAME)) { attrName = nvps.getValue(name1); @@ -309,16 +309,16 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { X500NameAttrMap map = X500NameAttrMap.getDefault(); - Vector recs = new Vector(); + Vector<NameValuePairs> recs = new Vector<NameValuePairs>(); int num = getNumAttrs(); - Enumeration e = ext.getAttributesList(); + Enumeration<Attribute> e = ext.getAttributesList(); CMS.debug("SubjectDirAttributesExtDefault: getValue: attributesList=" + e); int i = 0; while (e.hasMoreElements()) { NameValuePairs pairs = new NameValuePairs(); pairs.add(ENABLE, "true"); - Attribute attr = (Attribute) (e.nextElement()); + Attribute attr = e.nextElement(); CMS.debug("SubjectDirAttributesExtDefault: getValue: attribute=" + attr); ObjectIdentifier oid = attr.getOid(); CMS.debug("SubjectDirAttributesExtDefault: getValue: oid=" + oid); @@ -329,7 +329,7 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { pairs.add(ATTR_NAME, vv); else pairs.add(ATTR_NAME, oid.toString()); - Enumeration v = attr.getValues(); + Enumeration<String> v = attr.getValues(); // just support single value for now StringBuffer ss = new StringBuffer(); @@ -410,7 +410,7 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { num = getNumAttrs(); AttributeConfig attributeConfig = null; - Vector attrs = new Vector(); + Vector<Attribute> attrs = new Vector<Attribute>(); for (int i = 0; i < num; i++) { String enable = getConfig(CONFIG_ENABLE + i); if (enable != null && enable.equals("true")) { @@ -517,9 +517,9 @@ class AttributeConfig { return; } - private Vector str2MultiValues(String attrValue) { + private Vector<String> str2MultiValues(String attrValue) { StringTokenizer tokenizer = new StringTokenizer(attrValue, ","); - Vector v = new Vector(); + Vector<String> v = new Vector<String>(); while (tokenizer.hasMoreTokens()) { v.addElement(tokenizer.nextToken()); } diff --git a/pki/base/common/src/com/netscape/cms/profile/def/nsNKeySubjectNameDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/nsNKeySubjectNameDefault.java index 476db0e02..cc1a8de81 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/nsNKeySubjectNameDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/nsNKeySubjectNameDefault.java @@ -384,8 +384,8 @@ public class nsNKeySubjectNameDefault extends EnrollDefault { ; LDAPEntry entry = null; - CMS.debug("nsNKeySubjectNameDefault: getSubjectName(): about to search with " + mLdapStringAttrs.length - + " attributes"); + CMS.debug("nsNKeySubjectNameDefault: getSubjectName(): about to search with " + + mLdapStringAttrs.length + " attributes"); LDAPSearchResults results = conn.search(userdn, LDAPv2.SCOPE_BASE, "objectclass=*", mLdapStringAttrs, false); diff --git a/pki/base/common/src/com/netscape/cms/profile/def/nsTokenUserKeySubjectNameDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/nsTokenUserKeySubjectNameDefault.java index bbb3369ce..65adabfad 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/nsTokenUserKeySubjectNameDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/nsTokenUserKeySubjectNameDefault.java @@ -406,8 +406,8 @@ public class nsTokenUserKeySubjectNameDefault extends EnrollDefault { CMS.debug("nsTokenUserKeySubjectNameDefault: getSubjectName(): " + searchName + " does not exist"); throw new EProfileException("id does not exist"); } - CMS.debug("nsTokenUserKeySubjectNameDefault: getSubjectName(): retrieved entry for " + searchName + " = " - + request.getExtDataInString("uid")); + CMS.debug("nsTokenUserKeySubjectNameDefault: getSubjectName(): retrieved entry for " + + searchName + " = " + request.getExtDataInString("uid")); LDAPEntry entry = null; CMS.debug("nsTokenUserKeySubjectNameDefault: getSubjectName(): about to search with " diff --git a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapEnhancedMap.java b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapEnhancedMap.java index 5db61f94d..7fd2bb44e 100644 --- a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapEnhancedMap.java +++ b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapEnhancedMap.java @@ -120,7 +120,7 @@ public class LdapEnhancedMap * for instances of this implementation can be configured through the * console. */ - private static Vector defaultParams = new Vector(); + private static Vector<String> defaultParams = new Vector<String>(); static { defaultParams.addElement(PROP_DNPATTERN + "="); @@ -392,12 +392,12 @@ public class LdapEnhancedMap return "LdapEnhancedMap"; } - public Vector getDefaultParams() { + public Vector<String> getDefaultParams() { return defaultParams; } - public Vector getInstanceParams() { - Vector v = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> v = new Vector<String>(); try { if (mDnPattern == null) { @@ -584,7 +584,7 @@ public class LdapEnhancedMap ///////////////////////////////// public String[] getExtendedPluginInfo(Locale locale) { - Vector v = new Vector(); + Vector<String> v = new Vector<String>(); v.addElement(PROP_DNPATTERN + ";string;Describes how to form the Ldap " + diff --git a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapSimpleMap.java b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapSimpleMap.java index fe7493565..b3177787f 100644 --- a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapSimpleMap.java +++ b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapSimpleMap.java @@ -304,15 +304,15 @@ public class LdapSimpleMap implements ILdapMapper, IExtendedPluginInfo { return "LdapSimpleMap"; } - public Vector getDefaultParams() { - Vector v = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> v = new Vector<String>(); v.addElement(PROP_DNPATTERN + "="); return v; } - public Vector getInstanceParams() { - Vector v = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> v = new Vector<String>(); try { if (mDnPattern == null) { diff --git a/pki/base/common/src/com/netscape/cms/publish/mappers/MapAVAPattern.java b/pki/base/common/src/com/netscape/cms/publish/mappers/MapAVAPattern.java index 98fb41496..7aeb672d0 100644 --- a/pki/base/common/src/com/netscape/cms/publish/mappers/MapAVAPattern.java +++ b/pki/base/common/src/com/netscape/cms/publish/mappers/MapAVAPattern.java @@ -29,6 +29,7 @@ import netscape.security.x509.AVA; import netscape.security.x509.CertificateExtensions; import netscape.security.x509.Extension; import netscape.security.x509.GeneralName; +import netscape.security.x509.GeneralNameInterface; import netscape.security.x509.GeneralNames; import netscape.security.x509.LdapV3DNStrConverter; import netscape.security.x509.OIDMap; @@ -533,7 +534,8 @@ class MapAVAPattern { // For now, just give subjectAltName as an example. if (mValue.equalsIgnoreCase(SubjectAlternativeNameExtension.NAME)) { try { - GeneralNames subjectNames = (GeneralNames) + GeneralNames subjectNames = + (GeneralNames) ((SubjectAlternativeNameExtension) ext) .get(SubjectAlternativeNameExtension.SUBJECT_NAME); @@ -541,7 +543,7 @@ class MapAVAPattern { break; int j = 0; - for (Enumeration n = subjectNames.elements(); n.hasMoreElements();) { + for (Enumeration<GeneralNameInterface> n = subjectNames.elements(); n.hasMoreElements();) { GeneralName gn = (GeneralName) n.nextElement(); String gname = gn.toString(); @@ -623,7 +625,7 @@ class MapAVAPattern { if (plus == -1) return new String[] { rdn }; - Vector avas = new Vector(); + Vector<String> avas = new Vector<String>(); StringTokenizer token = new StringTokenizer(rdn, "+"); while (token.hasMoreTokens()) diff --git a/pki/base/common/src/com/netscape/cms/publish/mappers/MapDNPattern.java b/pki/base/common/src/com/netscape/cms/publish/mappers/MapDNPattern.java index 4eb6baeca..7a9025b1d 100644 --- a/pki/base/common/src/com/netscape/cms/publish/mappers/MapDNPattern.java +++ b/pki/base/common/src/com/netscape/cms/publish/mappers/MapDNPattern.java @@ -121,7 +121,7 @@ public class MapDNPattern { private void parse(PushbackReader in) throws ELdapException { - Vector rdnPatterns = new Vector(); + Vector<MapRDNPattern> rdnPatterns = new Vector<MapRDNPattern>(); MapRDNPattern rdnPattern = null; int lastChar = -1; @@ -139,7 +139,7 @@ public class MapDNPattern { mRDNPatterns = new MapRDNPattern[rdnPatterns.size()]; rdnPatterns.copyInto(mRDNPatterns); - Vector reqAttrs = new Vector(); + Vector<String> reqAttrs = new Vector<String>(); for (int i = 0; i < mRDNPatterns.length; i++) { String[] rdnAttrs = mRDNPatterns[i].getReqAttrs(); @@ -151,7 +151,7 @@ public class MapDNPattern { mReqAttrs = new String[reqAttrs.size()]; reqAttrs.copyInto(mReqAttrs); - Vector certAttrs = new Vector(); + Vector<String> certAttrs = new Vector<String>(); for (int i = 0; i < mRDNPatterns.length; i++) { String[] rdnAttrs = mRDNPatterns[i].getCertAttrs(); diff --git a/pki/base/common/src/com/netscape/cms/publish/mappers/MapRDNPattern.java b/pki/base/common/src/com/netscape/cms/publish/mappers/MapRDNPattern.java index c494627f1..c1688345b 100644 --- a/pki/base/common/src/com/netscape/cms/publish/mappers/MapRDNPattern.java +++ b/pki/base/common/src/com/netscape/cms/publish/mappers/MapRDNPattern.java @@ -124,7 +124,7 @@ class MapRDNPattern { private void parse(PushbackReader in) throws ELdapException { //System.out.println("_________ begin rdn _________"); - Vector avaPatterns = new Vector(); + Vector<MapAVAPattern> avaPatterns = new Vector<MapAVAPattern>(); MapAVAPattern avaPattern = null; int lastChar; @@ -156,7 +156,7 @@ class MapRDNPattern { mAVAPatterns = new MapAVAPattern[avaPatterns.size()]; avaPatterns.copyInto(mAVAPatterns); - Vector reqAttrs = new Vector(); + Vector<String> reqAttrs = new Vector<String>(); for (int i = 0; i < mAVAPatterns.length; i++) { String avaAttr = mAVAPatterns[i].getReqAttr(); @@ -168,7 +168,7 @@ class MapRDNPattern { mReqAttrs = new String[reqAttrs.size()]; reqAttrs.copyInto(mReqAttrs); - Vector certAttrs = new Vector(); + Vector<String> certAttrs = new Vector<String>(); for (int i = 0; i < mAVAPatterns.length; i++) { String avaAttr = mAVAPatterns[i].getCertAttr(); diff --git a/pki/base/common/src/com/netscape/cms/publish/publishers/FileBasedPublisher.java b/pki/base/common/src/com/netscape/cms/publish/publishers/FileBasedPublisher.java index b8d6a8e54..d8cec78d8 100644 --- a/pki/base/common/src/com/netscape/cms/publish/publishers/FileBasedPublisher.java +++ b/pki/base/common/src/com/netscape/cms/publish/publishers/FileBasedPublisher.java @@ -100,9 +100,11 @@ public class FileBasedPublisher implements ILdapPublisher, IExtendedPluginInfo { PROP_B64 + ";boolean;Store certificates or CRLs into *.b64 files.", PROP_GMT + ";choice(LocalTime,GMT);Use local time or GMT to time stamp CRL file name with CRL's 'thisUpdate' field.", - PROP_LNK + ";boolean;Generate link to the latest binary CRL. It requires '" + PROP_DER + PROP_LNK + + ";boolean;Generate link to the latest binary CRL. It requires '" + PROP_DER + "' to be enabled.", - PROP_EXT + ";string;Name extension used by link to the latest CRL. Default name extension is 'der'.", + PROP_EXT + + ";string;Name extension used by link to the latest CRL. Default name extension is 'der'.", PROP_ZIP + ";boolean;Generate compressed CRLs.", PROP_LEV + ";choice(0,1,2,3,4,5,6,7,8,9);Set compression level from 0 to 9.", IExtendedPluginInfo.HELP_TOKEN + @@ -110,7 +112,7 @@ public class FileBasedPublisher implements ILdapPublisher, IExtendedPluginInfo { IExtendedPluginInfo.HELP_TEXT + ";Stores the certificates or CRLs into files. Certificate is named as cert-<serialno>.der or *.b64, and CRL is named as <IssuingPoint>-<thisUpdate-time>.der or *.b64." - }; + }; return params; } diff --git a/pki/base/common/src/com/netscape/cms/publish/publishers/LdapEncryptCertPublisher.java b/pki/base/common/src/com/netscape/cms/publish/publishers/LdapEncryptCertPublisher.java index 337c5a383..d5cbfb323 100644 --- a/pki/base/common/src/com/netscape/cms/publish/publishers/LdapEncryptCertPublisher.java +++ b/pki/base/common/src/com/netscape/cms/publish/publishers/LdapEncryptCertPublisher.java @@ -89,15 +89,15 @@ public class LdapEncryptCertPublisher implements ILdapPublisher, IExtendedPlugin } - public Vector getInstanceParams() { - Vector v = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> v = new Vector<String>(); v.addElement("certAttr=" + mCertAttr); return v; } - public Vector getDefaultParams() { - Vector v = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> v = new Vector<String>(); v.addElement("certAttr=" + mCertAttr); return v; @@ -247,11 +247,12 @@ public class LdapEncryptCertPublisher implements ILdapPublisher, IExtendedPlugin return at; } - Enumeration vals = attr.getByteValues(); + @SuppressWarnings("unchecked") + Enumeration<byte[]> vals = attr.getByteValues(); byte[] val = null; while (vals.hasMoreElements()) { - val = (byte[]) vals.nextElement(); + val = vals.nextElement(); try { X509CertImpl cert = new X509CertImpl(val); @@ -322,7 +323,8 @@ public class LdapEncryptCertPublisher implements ILdapPublisher, IExtendedPlugin if (attr == null) { return false; } - Enumeration vals = attr.getByteValues(); + @SuppressWarnings("unchecked") + Enumeration<byte[]> vals = attr.getByteValues(); byte[] val = null; while (vals.hasMoreElements()) { @@ -341,11 +343,12 @@ public class LdapEncryptCertPublisher implements ILdapPublisher, IExtendedPlugin if (attr == null) { return false; } - Enumeration vals = attr.getStringValues(); + @SuppressWarnings("unchecked") + Enumeration<String> vals = attr.getStringValues(); String val = null; while (vals.hasMoreElements()) { - val = (String) vals.nextElement(); + val = vals.nextElement(); if (val.equalsIgnoreCase(sval)) { return true; } diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/CMSAdminServlet.java index 92cbb8885..41f0c248f 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 @@ -354,7 +354,7 @@ public final class CMSAdminServlet extends AdminServlet { } private boolean isSubsystemInstalled(String subsystem) { - Enumeration e = CMS.getSubsystems(); + Enumeration<ISubsystem> e = CMS.getSubsystems(); while (e.hasMoreElements()) { String type = ""; @@ -382,7 +382,7 @@ public final class CMSAdminServlet extends AdminServlet { HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration e = CMS.getSubsystems(); + Enumeration<ISubsystem> e = CMS.getSubsystems(); boolean isCAInstalled = false; boolean isRAInstalled = false; boolean isKRAInstalled = false; @@ -536,13 +536,14 @@ public final class CMSAdminServlet extends AdminServlet { // ensure that any low-level exceptions are reported // to the signed audit log and stored as failures try { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); NameValuePairs params = new NameValuePairs(); ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); jssSubSystem.getInternalTokenName(); - Enumeration e = CMS.getSubsystems(); + Enumeration<ISubsystem> e = CMS.getSubsystems(); boolean isCAInstalled = false; boolean isRAInstalled = false; boolean isKRAInstalled = false; @@ -797,7 +798,7 @@ public final class CMSAdminServlet extends AdminServlet { HttpServletResponse resp) throws ServletException, IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration e = CMS.getSubsystems(); + Enumeration<ISubsystem> e = CMS.getSubsystems(); StringBuffer buff = new StringBuffer(); while (e.hasMoreElements()) { @@ -863,7 +864,8 @@ public final class CMSAdminServlet extends AdminServlet { IOException, EBaseException { IConfigStore dbConfig = mConfig.getSubStore(PROP_INTERNAL_DB); - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); while (enum1.hasMoreElements()) { String key = (String) enum1.nextElement(); @@ -890,7 +892,8 @@ public final class CMSAdminServlet extends AdminServlet { IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> e = req.getParameterNames(); String newKeyName = null, selectedToken = null; while (e.hasMoreElements()) { String name = (String) e.nextElement(); @@ -923,7 +926,8 @@ public final class CMSAdminServlet extends AdminServlet { IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> e = req.getParameterNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); @@ -974,7 +978,8 @@ public final class CMSAdminServlet extends AdminServlet { IConfigStore dbConfig = mConfig.getSubStore(PROP_DB); IConfigStore ldapConfig = dbConfig.getSubStore("ldap"); NameValuePairs params = new NameValuePairs(); - Enumeration e = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> e = req.getParameterNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); @@ -1036,7 +1041,8 @@ public final class CMSAdminServlet extends AdminServlet { private void loggedInToken(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String tokenName = ""; String pwd = ""; @@ -1064,7 +1070,8 @@ public final class CMSAdminServlet extends AdminServlet { private void checkTokenStatus(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String key = ""; String value = ""; @@ -1110,7 +1117,8 @@ public final class CMSAdminServlet extends AdminServlet { // to the signed audit log and stored as failures try { NameValuePairs params = new NameValuePairs(); - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String tokenName = Constants.PR_INTERNAL_TOKEN_NAME; String keyType = ""; int keyLength = 512; @@ -1486,7 +1494,8 @@ public final class CMSAdminServlet extends AdminServlet { // ensure that any low-level exceptions are reported // to the signed audit log and stored as failures try { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String pkcs = ""; String type = ""; String tokenName = Constants.PR_INTERNAL_TOKEN_NAME; @@ -1921,7 +1930,8 @@ public final class CMSAdminServlet extends AdminServlet { String serverRoot = ""; String serverID = ""; String certpath = ""; - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); while (enum1.hasMoreElements()) { String key = (String) enum1.nextElement(); @@ -2086,8 +2096,8 @@ public final class CMSAdminServlet extends AdminServlet { String eString = e.toString(); if (eString.contains("Failed to find certificate that was just imported")) { - CMS.debug("CMSAdminServlet.installCert(): nickname=" + nicknameWithoutTokenName - + " TokenException: " + eString); + CMS.debug("CMSAdminServlet.installCert(): nickname=" + + nicknameWithoutTokenName + " TokenException: " + eString); X509Certificate cert = null; try { @@ -2338,7 +2348,8 @@ public final class CMSAdminServlet extends AdminServlet { String serverRoot = ""; String serverID = ""; String certpath = ""; - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); NameValuePairs results = new NameValuePairs(); while (enum1.hasMoreElements()) { @@ -2565,7 +2576,8 @@ public final class CMSAdminServlet extends AdminServlet { private void getCertInfo(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); NameValuePairs results = new NameValuePairs(); String pkcs = ""; String path = ""; @@ -2662,7 +2674,8 @@ public final class CMSAdminServlet extends AdminServlet { private void getCertPrettyPrint(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); String nickname = ""; @@ -2705,7 +2718,8 @@ public final class CMSAdminServlet extends AdminServlet { private void getRootCertTrustBit(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); String nickname = ""; @@ -2821,7 +2835,8 @@ public final class CMSAdminServlet extends AdminServlet { private void deleteCerts(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); String nickname = ""; @@ -2853,8 +2868,8 @@ public final class CMSAdminServlet extends AdminServlet { private void validateSubjectName(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); while (enum1.hasMoreElements()) { String key = (String) enum1.nextElement(); @@ -2874,7 +2889,8 @@ public final class CMSAdminServlet extends AdminServlet { private void validateKeyLength(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String keyType = "RSA"; String keyLen = "512"; String certType = ""; @@ -2904,7 +2920,8 @@ public final class CMSAdminServlet extends AdminServlet { private void validateCurveName(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String curveName = null; while (enum1.hasMoreElements()) { @@ -2934,7 +2951,8 @@ public final class CMSAdminServlet extends AdminServlet { private void validateCertExtension(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException, EBaseException { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String certExt = ""; while (enum1.hasMoreElements()) { @@ -2958,7 +2976,8 @@ public final class CMSAdminServlet extends AdminServlet { HttpServletResponse resp) throws ServletException, IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String nickname = ""; String keyType = "RSA"; @@ -2989,7 +3008,8 @@ public final class CMSAdminServlet extends AdminServlet { HttpServletResponse resp) throws ServletException, IOException, EBaseException { NameValuePairs params = new NameValuePairs(); - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String nickname = ""; String keyType = "RSA"; @@ -3078,7 +3098,8 @@ public final class CMSAdminServlet extends AdminServlet { // ensure that any low-level exceptions are reported // to the signed audit log and stored as failures try { - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); String trust = ""; @@ -3178,8 +3199,8 @@ public final class CMSAdminServlet extends AdminServlet { CMS.debug("CMSAdminServlet::runSelfTestsOnDemand():" + " ENTERING . . ."); } - - Enumeration enum1 = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> enum1 = req.getParameterNames(); String request = ""; NameValuePairs results = new NameValuePairs(); String content = ""; diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/ProfileAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/ProfileAdminServlet.java index 57fadab47..cbc406997 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/ProfileAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/ProfileAdminServlet.java @@ -1981,7 +1981,8 @@ public class ProfileAdminServlet extends AdminServlet { nvp.add(name, ";" + ";" + rule.getConfig(name)); } else { nvp.add(name, - desc.getSyntax() + ";" + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getSyntax() + + ";" + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getDescription(getLocale(req)) + ";" + rule.getConfig(name)); } } @@ -2031,8 +2032,9 @@ public class ProfileAdminServlet extends AdminServlet { nvp.add(name, ";" + rule.getConfig(name)); } else { nvp.add(name, - desc.getSyntax() + ";" + getNonNull(desc.getConstraint()) + ";" - + desc.getDescription(getLocale(req)) + ";" + rule.getConfig(name)); + desc.getSyntax() + + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getDescription(getLocale(req)) + + ";" + rule.getConfig(name)); } } sendResponse(SUCCESS, null, nvp, resp); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java index e8d80640e..58cf327bb 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/PublisherAdminServlet.java @@ -353,13 +353,15 @@ public class PublisherAdminServlet extends AdminServlet { String epi[] = new String[] { "type;choice(cacert,crl,certs,xcert);The certType of the request", - "mapper;choice(" + map.toString() + "mapper;choice(" + + map.toString() + ");Use the mapper to find the ldap dn to publish the certificate or crl", - "publisher;choice(" + publish.toString() + "publisher;choice(" + + publish.toString() + ");Use the publisher to publish the certificate or crl a directory etc", "enable;boolean;", "predicate;string;" - }; + }; return new ExtendedPluginInfo(epi); } @@ -714,9 +716,10 @@ public class PublisherAdminServlet extends AdminServlet { if (authType.equals(ILdapAuthInfo.LDAP_SSLCLIENTAUTH_STR)) { try { //certNickName = authInfo.getParms()[0]; - certNickName = ldap.getSubStore( - ILdapBoundConnFactory.PROP_LDAPAUTHINFO).getString( - ILdapAuthInfo.PROP_CLIENTCERTNICKNAME); + certNickName = + ldap.getSubStore( + ILdapBoundConnFactory.PROP_LDAPAUTHINFO).getString( + ILdapAuthInfo.PROP_CLIENTCERTNICKNAME); conn = new LDAPConnection(CMS.getLdapJssSSLSocketFactory( certNickName)); CMS.debug("Publishing Test certNickName=" + certNickName); @@ -725,7 +728,8 @@ public class PublisherAdminServlet extends AdminServlet { certNickName + dashes(70 - 44 - certNickName.length()) + " Success"); } catch (Exception ex) { params.add(Constants.PR_CONN_INIT_FAIL, - "Create ssl LDAPConnection with certificate: " + + "Create ssl LDAPConnection with certificate: " + + certNickName + dashes(70 - 44 - certNickName.length()) + " failure\n" + " exception: " + ex); params.add(Constants.PR_SAVE_NOT, @@ -737,7 +741,8 @@ public class PublisherAdminServlet extends AdminServlet { try { conn.connect(host, port); params.add(Constants.PR_CONN_OK, - "Connect to directory server " + + "Connect to directory server " + + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Success"); @@ -799,7 +804,8 @@ public class PublisherAdminServlet extends AdminServlet { try { conn.connect(host, port); params.add(Constants.PR_CONN_OK, - "Connect to directory server " + + "Connect to directory server " + + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Success"); @@ -808,14 +814,16 @@ public class PublisherAdminServlet extends AdminServlet { // need to intercept this because message from LDAP is // "DSA is unavailable" which confuses with DSA PKI. params.add(Constants.PR_CONN_FAIL, - "Connect to directory server " + + "Connect to directory server " + + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Failure" + "\nerror: server unavailable"); } else { params.add(Constants.PR_CONN_FAIL, - "Connect to directory server " + + "Connect to directory server " + + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Failure" + diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/RegistryAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/RegistryAdminServlet.java index 41c07d810..0175d9aa4 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/RegistryAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/RegistryAdminServlet.java @@ -290,7 +290,8 @@ public class RegistryAdminServlet extends AdminServlet { CMS.debug("RegistryAdminServlet: getSUpportedConstraint isApplicable " + constraintInfo.getClassName()); nvp.add(constraintID, - constraintInfo.getClassName() + "," + + constraintInfo.getClassName() + + "," + constraintInfo.getDescription(getLocale(req)) + "," + constraintInfo.getName(getLocale(req))); } @@ -344,8 +345,11 @@ public class RegistryAdminServlet extends AdminServlet { if (desc != null) { try { - String value = getNonNull(desc.getSyntax()) + ";" + getNonNull(desc.getConstraint()) + ";" - + desc.getDescription(getLocale(req)) + ";" + getNonNull(desc.getDefaultValue()); + String value = + getNonNull(desc.getSyntax()) + + ";" + getNonNull(desc.getConstraint()) + ";" + + desc.getDescription(getLocale(req)) + ";" + + getNonNull(desc.getDefaultValue()); CMS.debug("RegistryAdminServlet: getProfileImpl " + value); nvp.add(name, value); diff --git a/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java b/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java index 2920d0f46..e292e501a 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java @@ -493,8 +493,8 @@ public abstract class CMSServlet extends HttpServlet { Date endDate = CMS.getCurrentDate(); long endTime = endDate.getTime(); if (CMS.debugOn()) { - CMS.debug(CMS.DEBUG_INFORM, "CMSServlet: curDate=" + endDate + " id=" + mId + " time=" - + (endTime - startTime)); + CMS.debug(CMS.DEBUG_INFORM, "CMSServlet: curDate=" + + endDate + " id=" + mId + " time=" + (endTime - startTime)); } iCommandQueue.unRegisterProccess((Object) cmsRequest, (Object) this); } catch (EBaseException e) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java b/pki/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java index 0d7da7fa8..461fa0b94 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/CMCRevReqServlet.java @@ -236,8 +236,9 @@ public class CMCRevReqServlet extends CMSServlet { certs = new X509CertImpl[serialNoArray.length]; for (int i = 0; i < serialNoArray.length; i++) { - certs[i] = ((ICertificateAuthority) mAuthority).getCertificateRepository().getX509Certificate( - serialNoArray[i]); + certs[i] = + ((ICertificateAuthority) mAuthority).getCertificateRepository().getX509Certificate( + serialNoArray[i]); } } else if (mAuthority instanceof IRegistrationAuthority) { @@ -379,8 +380,8 @@ public class CMCRevReqServlet extends CMSServlet { try { int count = 0; - Vector oldCertsV = new Vector(); - Vector revCertImplsV = new Vector(); + Vector<X509CertImpl> oldCertsV = new Vector<X509CertImpl>(); + Vector<RevokedCertImpl> revCertImplsV = new Vector<RevokedCertImpl>(); // Construct a CRL reason code extension. RevocationReason revReason = RevocationReason.fromInt(reason); @@ -406,7 +407,7 @@ public class CMCRevReqServlet extends CMSServlet { if (mAuthority instanceof ICertificateAuthority) { ICertRecordList list = (ICertRecordList) mCertDB.findCertRecordsInList( revokeAll, null, totalRecordCount); - Enumeration e = list.getCertRecords(0, totalRecordCount - 1); + Enumeration<ICertRecord> e = list.getCertRecords(0, totalRecordCount - 1); while (e != null && e.hasMoreElements()) { ICertRecord rec = (ICertRecord) e.nextElement(); @@ -439,11 +440,11 @@ public class CMCRevReqServlet extends CMSServlet { if (mRequestID != null && mRequestID.length() > 0) reqIdStr = mRequestID; - Vector serialNumbers = new Vector(); + Vector<String> serialNumbers = new Vector<String>(); if (revokeAll != null && revokeAll.length() > 0) { - for (int i = revokeAll.indexOf('='); i < revokeAll.length() && i > -1; i = revokeAll - .indexOf('=', i)) { + for (int i = revokeAll.indexOf('='); i < revokeAll.length() && i > -1; i = + revokeAll.indexOf('=', i)) { if (i > -1) { i++; while (i < revokeAll.length() && revokeAll.charAt(i) == ' ') { @@ -654,7 +655,7 @@ public class CMCRevReqServlet extends CMSServlet { } if (mAuthority instanceof ICertificateAuthority) { // let known update and publish status of all crls. - Enumeration otherCRLs = + Enumeration<ICRLIssuingPoint> otherCRLs = ((ICertificateAuthority) mAuthority).getCRLIssuingPoints(); while (otherCRLs.hasMoreElements()) { @@ -761,7 +762,7 @@ public class CMCRevReqServlet extends CMSServlet { } } else { - Vector errors = revReq.getExtDataInStringVector(IRequest.ERRORS); + Vector<String> errors = revReq.getExtDataInStringVector(IRequest.ERRORS); StringBuffer errorStr = new StringBuffer(); if (errors != null && errors.size() > 0) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/ChallengeRevocationServlet1.java b/pki/base/common/src/com/netscape/cms/servlet/cert/ChallengeRevocationServlet1.java index 14f28bce9..8ca35484b 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/ChallengeRevocationServlet1.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/ChallengeRevocationServlet1.java @@ -213,8 +213,9 @@ public class ChallengeRevocationServlet1 extends CMSServlet { certs = new X509CertImpl[serialNoArray.length]; for (int i = 0; i < serialNoArray.length; i++) { - certs[i] = ((ICertificateAuthority) mAuthority).getCertificateRepository().getX509Certificate( - serialNoArray[i]); + certs[i] = + ((ICertificateAuthority) mAuthority).getCertificateRepository().getX509Certificate( + serialNoArray[i]); } } else if (mAuthority instanceof IRegistrationAuthority) { @@ -308,8 +309,8 @@ public class ChallengeRevocationServlet1 extends CMSServlet { throws EBaseException { try { int count = 0; - Vector oldCertsV = new Vector(); - Vector revCertImplsV = new Vector(); + Vector<X509CertImpl> oldCertsV = new Vector<X509CertImpl>(); + Vector<RevokedCertImpl> revCertImplsV = new Vector<RevokedCertImpl>(); // Construct a CRL reason code extension. RevocationReason revReason = RevocationReason.fromInt(reason); @@ -335,7 +336,7 @@ public class ChallengeRevocationServlet1 extends CMSServlet { if (mAuthority instanceof ICertificateAuthority) { ICertRecordList list = (ICertRecordList) mCertDB.findCertRecordsInList( revokeAll, null, totalRecordCount); - Enumeration e = list.getCertRecords(0, totalRecordCount - 1); + Enumeration<ICertRecord> e = list.getCertRecords(0, totalRecordCount - 1); while (e != null && e.hasMoreElements()) { ICertRecord rec = (ICertRecord) e.nextElement(); @@ -368,7 +369,7 @@ public class ChallengeRevocationServlet1 extends CMSServlet { if (mRequestID != null && mRequestID.length() > 0) reqIdStr = mRequestID; - Vector serialNumbers = new Vector(); + Vector<String> serialNumbers = new Vector<String>(); if (revokeAll != null && revokeAll.length() > 0) { for (int i = revokeAll.indexOf('='); i < revokeAll.length() && i > -1; @@ -563,7 +564,7 @@ public class ChallengeRevocationServlet1 extends CMSServlet { } if (mAuthority instanceof ICertificateAuthority) { // let known update and publish status of all crls. - Enumeration otherCRLs = + Enumeration<ICRLIssuingPoint> otherCRLs = ((ICertificateAuthority) mAuthority).getCRLIssuingPoints(); while (otherCRLs.hasMoreElements()) { @@ -672,7 +673,7 @@ public class ChallengeRevocationServlet1 extends CMSServlet { } } else { - Vector errors = revReq.getExtDataInStringVector(IRequest.ERRORS); + Vector<String> errors = revReq.getExtDataInStringVector(IRequest.ERRORS); StringBuffer errorStr = new StringBuffer(); if (errors != null && errors.size() > 0) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayBySerial.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayBySerial.java index 1c9838f83..36746106a 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayBySerial.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DisplayBySerial.java @@ -309,8 +309,8 @@ public class DisplayBySerial extends CMSServlet { String rid = (String) metaInfo.get(ICertRecord.META_REQUEST_ID); if (rid != null && mAuthority instanceof ICertificateAuthority) { - IRequest r = ((ICertificateAuthority) mAuthority).getRequestQueue().findRequest( - new RequestId(rid)); + IRequest r = + ((ICertificateAuthority) mAuthority).getRequestQueue().findRequest(new RequestId(rid)); String certType = r.getExtDataInString(IRequest.HTTP_PARAMS, IRequest.CERT_TYPE); if (certType != null && certType.equals(IRequest.CLIENT_CERT)) { @@ -331,7 +331,7 @@ public class DisplayBySerial extends CMSServlet { CRLExtensions crlExts = revocationInfo.getCRLEntryExtensions(); if (crlExts != null) { - Enumeration enumx = crlExts.getElements(); + Enumeration<Extension> enumx = crlExts.getElements(); int reason = 0; while (enumx.hasMoreElements()) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java index 97a70fac3..b84f5ace1 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java @@ -439,8 +439,8 @@ public class DoRevoke extends CMSServlet { try { int count = 0; - Vector oldCertsV = new Vector(); - Vector revCertImplsV = new Vector(); + Vector<X509CertImpl> oldCertsV = new Vector<X509CertImpl>(); + Vector<RevokedCertImpl> revCertImplsV = new Vector<RevokedCertImpl>(); // Construct a CRL reason code extension. RevocationReason revReason = RevocationReason.fromInt(reason); @@ -465,11 +465,11 @@ public class DoRevoke extends CMSServlet { if (mAuthority instanceof ICertificateAuthority) { - Enumeration e = mCertDB.searchCertificates(revokeAll, + Enumeration<ICertRecord> e = mCertDB.searchCertificates(revokeAll, totalRecordCount, mTimeLimits); while (e != null && e.hasMoreElements()) { - ICertRecord rec = (ICertRecord) e.nextElement(); + ICertRecord rec = e.nextElement(); if (rec == null) continue; @@ -532,7 +532,7 @@ public class DoRevoke extends CMSServlet { } else if (mAuthority instanceof IRegistrationAuthority) { String reqIdStr = req.getParameter("requestId"); - Vector serialNumbers = new Vector(); + Vector<String> serialNumbers = new Vector<String>(); if (revokeAll != null && revokeAll.length() > 0) { for (int i = revokeAll.indexOf('='); i < revokeAll.length() && i > -1; @@ -787,8 +787,8 @@ public class DoRevoke extends CMSServlet { "completed", cert.getSubjectDN(), cert.getSerialNumber().toString(16), - RevocationReason.fromInt(reason).toString() + " time: " - + (endTime - startTime) } + RevocationReason.fromInt(reason).toString() + + " time: " + (endTime - startTime) } ); } } @@ -833,7 +833,7 @@ public class DoRevoke extends CMSServlet { if (mAuthority instanceof ICertificateAuthority) { // let known update and publish status of all crls. - Enumeration otherCRLs = + Enumeration<ICRLIssuingPoint> otherCRLs = ((ICertificateAuthority) mAuthority).getCRLIssuingPoints(); while (otherCRLs.hasMoreElements()) { @@ -925,7 +925,7 @@ public class DoRevoke extends CMSServlet { } else { header.addStringValue("revoked", "no"); } - Vector errors = revReq.getExtDataInStringVector(IRequest.ERRORS); + Vector<String> errors = revReq.getExtDataInStringVector(IRequest.ERRORS); if (errors != null) { StringBuffer errInfo = new StringBuffer(); for (int i = 0; i < errors.size(); i++) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java b/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java index 075f3218b..00cca204a 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/DoRevokeTPS.java @@ -353,8 +353,8 @@ public class DoRevokeTPS extends CMSServlet { try { int count = 0; - Vector oldCertsV = new Vector(); - Vector revCertImplsV = new Vector(); + Vector<X509CertImpl> oldCertsV = new Vector<X509CertImpl>(); + Vector<RevokedCertImpl> revCertImplsV = new Vector<RevokedCertImpl>(); // Construct a CRL reason code extension. RevocationReason revReason = RevocationReason.fromInt(reason); @@ -377,7 +377,7 @@ public class DoRevokeTPS extends CMSServlet { entryExtn.set(invalidityDateExtn.getName(), invalidityDateExtn); } - Enumeration e = mCertDB.searchCertificates(revokeAll, + Enumeration<ICertRecord> e = mCertDB.searchCertificates(revokeAll, totalRecordCount, mTimeLimits); boolean alreadyRevokedCertFound = false; @@ -593,8 +593,8 @@ public class DoRevokeTPS extends CMSServlet { "completed", cert.getSubjectDN(), cert.getSerialNumber().toString(16), - RevocationReason.fromInt(reason).toString() + " time: " - + (endTime - startTime) } + RevocationReason.fromInt(reason).toString() + + " time: " + (endTime - startTime) } ); } } @@ -633,7 +633,7 @@ public class DoRevokeTPS extends CMSServlet { if (mAuthority instanceof ICertificateAuthority) { // let known update and publish status of all crls. - Enumeration otherCRLs = + Enumeration<ICRLIssuingPoint> otherCRLs = ((ICertificateAuthority) mAuthority).getCRLIssuingPoints(); while (otherCRLs.hasMoreElements()) { @@ -718,7 +718,7 @@ public class DoRevokeTPS extends CMSServlet { o_status = "status=2"; errorString = "error=Undefined request status"; } - Vector errors = revReq.getExtDataInStringVector(IRequest.ERRORS); + Vector<String> errors = revReq.getExtDataInStringVector(IRequest.ERRORS); if (errors != null) { StringBuffer errInfo = new StringBuffer(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/EnrollServlet.java b/pki/base/common/src/com/netscape/cms/servlet/cert/EnrollServlet.java index 0c7b73780..7b3fb2f74 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/EnrollServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/EnrollServlet.java @@ -465,12 +465,13 @@ public class EnrollServlet extends CMSServlet { } String filter = - "(&(x509cert.subject=" + certBasedOldSubjectDN + ")(!(x509cert.serialNumber=" + certBasedOldSerialNum + "(&(x509cert.subject=" + + certBasedOldSubjectDN + ")(!(x509cert.serialNumber=" + certBasedOldSerialNum + "))(certStatus=VALID))"; ICertRecordList list = (ICertRecordList) mCa.getCertificateRepository().findCertRecordsInList(filter, null, 10); int size = list.getSize(); - Enumeration en = list.getCertRecords(0, size - 1); + Enumeration<ICertRecord> en = list.getCertRecords(0, size - 1); boolean gotEncCert = false; CMS.debug("EnrollServlet: signing cert filter " + filter); @@ -572,10 +573,10 @@ public class EnrollServlet extends CMSServlet { // audit log the status try { if (status == RequestStatus.REJECTED) { - Vector messages = req.getExtDataInStringVector(IRequest.ERRORS); + Vector<String> messages = req.getExtDataInStringVector(IRequest.ERRORS); if (messages != null) { - Enumeration msgs = messages.elements(); + Enumeration<String> msgs = messages.elements(); StringBuffer wholeMsg = new StringBuffer(); while (msgs.hasMoreElements()) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/HashEnrollServlet.java b/pki/base/common/src/com/netscape/cms/servlet/cert/HashEnrollServlet.java index e42150f87..4d5b711c0 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/HashEnrollServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/HashEnrollServlet.java @@ -487,13 +487,14 @@ public class HashEnrollServlet extends CMSServlet { } String filter = - "(&(x509cert.subject=" + certBasedOldSubjectDN + ")(!(x509cert.serialNumber=" - + certBasedOldSerialNum + "))(certStatus=VALID))"; + "(&(x509cert.subject=" + + certBasedOldSubjectDN + ")(!(x509cert.serialNumber=" + certBasedOldSerialNum + + "))(certStatus=VALID))"; ICertRecordList list = (ICertRecordList) mCa.getCertificateRepository().findCertRecordsInList(filter, null, 10); int size = list.getSize(); - Enumeration en = list.getCertRecords(0, size - 1); + Enumeration<ICertRecord> en = list.getCertRecords(0, size - 1); boolean gotEncCert = false; if (!en.hasMoreElements()) { @@ -656,10 +657,10 @@ public class HashEnrollServlet extends CMSServlet { // audit log the status try { if (status == RequestStatus.REJECTED) { - Vector messages = req.getExtDataInStringVector(IRequest.ERRORS); + Vector<String> messages = req.getExtDataInStringVector(IRequest.ERRORS); if (messages != null) { - Enumeration msgs = messages.elements(); + Enumeration<String> msgs = messages.elements(); StringBuffer wholeMsg = new StringBuffer(); while (msgs.hasMoreElements()) { @@ -947,8 +948,8 @@ public class HashEnrollServlet extends CMSServlet { // field suggested notBefore and notAfter in CRMF // Tech Support #383184 if (certTemplate.getNotBefore() != null || certTemplate.getNotAfter() != null) { - CertificateValidity certValidity = new CertificateValidity(certTemplate.getNotBefore(), - certTemplate.getNotAfter()); + CertificateValidity certValidity = + new CertificateValidity(certTemplate.getNotBefore(), certTemplate.getNotAfter()); certInfo.set(X509CertInfo.VALIDITY, certValidity); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/ListCerts.java b/pki/base/common/src/com/netscape/cms/servlet/cert/ListCerts.java index c12c8193d..8a818f5e8 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/ListCerts.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/ListCerts.java @@ -68,10 +68,8 @@ public class ListCerts extends CMSServlet { */ private static final long serialVersionUID = -3568155814023099576L; private final static String TPL_FILE = "queryCert.template"; - private final static String INFO = "ListCerts"; private final static BigInteger MINUS_ONE = new BigInteger("-1"); - private final static String CURRENT_TIME = "currentTime"; private final static String USE_CLIENT_FILTER = "useClientFilter"; private final static String ALLOWED_CLIENT_FILTERS = "allowedClientFilters"; @@ -82,7 +80,7 @@ public class ListCerts extends CMSServlet { private boolean mHardJumpTo = false; //jump to the end private String mDirection = null; private boolean mUseClientFilter = false; - private Vector mAllowedClientFilters = new Vector(); + private Vector<String> mAllowedClientFilters = new Vector<String>(); private int mMaxReturns = 2000; /** @@ -149,18 +147,18 @@ public class ListCerts extends CMSServlet { if (mUseClientFilter) { com.netscape.certsrv.apps.CMS.debug("useClientFilter=true"); - Enumeration filters = mAllowedClientFilters.elements(); + Enumeration<String> filters = mAllowedClientFilters.elements(); // check to see if the filter is allowed while (filters.hasMoreElements()) { String filter = (String) filters.nextElement(); - com.netscape.certsrv.apps.CMS.debug("Comparing filter=" + filter + " queryCertFilter=" - + queryCertFilter); + com.netscape.certsrv.apps.CMS.debug("Comparing filter=" + + filter + " queryCertFilter=" + queryCertFilter); if (filter.equals(queryCertFilter)) { return queryCertFilter; } } - com.netscape.certsrv.apps.CMS.debug("Requested filter '" + queryCertFilter - + "' is not allowed. Please check the " + ALLOWED_CLIENT_FILTERS + "parameter"); + com.netscape.certsrv.apps.CMS.debug("Requested filter '" + + queryCertFilter + "' is not allowed. Please check the " + ALLOWED_CLIENT_FILTERS + "parameter"); return null; } else { com.netscape.certsrv.apps.CMS.debug("useClientFilter=false"); @@ -320,8 +318,9 @@ public class ListCerts extends CMSServlet { } catch (NumberFormatException e) { log(ILogger.LL_FAILURE, com.netscape.certsrv.apps.CMS.getLogMessage("BASE_INVALID_NUMBER_FORMAT")); - error = new EBaseException(com.netscape.certsrv.apps.CMS.getUserMessage(getLocale(req), - "CMS_BASE_INVALID_NUMBER_FORMAT")); + error = + new EBaseException(com.netscape.certsrv.apps.CMS.getUserMessage(getLocale(req), + "CMS_BASE_INVALID_NUMBER_FORMAT")); } catch (EBaseException e) { error = e; } @@ -395,7 +394,7 @@ public class ListCerts extends CMSServlet { pSize); // retrive maxCount + 1 entries - Enumeration e = list.getCertRecords(0, maxCount); + Enumeration<ICertRecord> e = list.getCertRecords(0, maxCount); ICertRecordList tolist = null; int toCurIndex = 0; @@ -407,7 +406,7 @@ public class ListCerts extends CMSServlet { filter, (String[]) null, serialTo, "serialno", maxCount); - Enumeration en = tolist.getCertRecords(0, 0); + Enumeration<ICertRecord> en = tolist.getCertRecords(0, 0); if (en == null || (!en.hasMoreElements())) { toCurIndex = list.getSize() - 1; @@ -654,7 +653,7 @@ public class ListCerts extends CMSServlet { CRLExtensions crlExts = revocationInfo.getCRLEntryExtensions(); if (crlExts != null) { - Enumeration enum1 = crlExts.getElements(); + Enumeration<Extension> enum1 = crlExts.getElements(); int reason = 0; while (enum1.hasMoreElements()) { 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 bbe8a479e..8e6d58216 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 @@ -608,14 +608,14 @@ public class SrchCerts extends CMSServlet { CMS.debug("Resetting timelimit from " + timeLimit + " to " + mTimeLimits); timeLimit = mTimeLimits; } - CMS.debug("Start searching ... " + "filter=" + filter + " maxreturns=" + maxResults + " timelimit=" - + timeLimit); - Enumeration e = mCertDB.searchCertificates(filter, maxResults, timeLimit); + CMS.debug("Start searching ... " + + "filter=" + filter + " maxreturns=" + maxResults + " timelimit=" + timeLimit); + Enumeration<ICertRecord> e = mCertDB.searchCertificates(filter, maxResults, timeLimit); int count = 0; while (e != null && e.hasMoreElements()) { - ICertRecord rec = (ICertRecord) e.nextElement(); + ICertRecord rec = e.nextElement(); if (rec != null) { count++; @@ -744,11 +744,11 @@ public class SrchCerts extends CMSServlet { CRLExtensions crlExts = revocationInfo.getCRLEntryExtensions(); if (crlExts != null) { - Enumeration enum1 = crlExts.getElements(); + Enumeration<Extension> enum1 = crlExts.getElements(); int reason = 0; while (enum1.hasMoreElements()) { - Extension ext = (Extension) enum1.nextElement(); + Extension ext = enum1.nextElement(); if (ext instanceof CRLReasonExtension) { reason = ((CRLReasonExtension) ext).getReason().toInt(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateCRL.java b/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateCRL.java index 9d3e633d2..680886b95 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateCRL.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/UpdateCRL.java @@ -50,6 +50,7 @@ import com.netscape.certsrv.ca.ICertificateAuthority; import com.netscape.certsrv.ldap.ELdapException; import com.netscape.certsrv.logging.AuditFormat; import com.netscape.certsrv.logging.ILogger; +import com.netscape.certsrv.publish.ILdapRule; import com.netscape.certsrv.publish.IPublisherProcessor; import com.netscape.certsrv.util.IStatsSubsystem; import com.netscape.cms.servlet.base.CMSServlet; @@ -72,7 +73,7 @@ public class UpdateCRL extends CMSServlet { private final static String INFO = "UpdateCRL"; private final static String TPL_FILE = "updateCRL.template"; - private static Vector mTesting = new Vector(); + private static Vector<String> mTesting = new Vector<String>(); private String mFormPath = null; private ICertificateAuthority mCA = null; @@ -278,7 +279,7 @@ public class UpdateCRL extends CMSServlet { rarg.addStringValue("crlSizes", crlSizes); StringBuffer crlSplits = new StringBuffer(); - Vector splits = crlIssuingPoint.getSplitTimes(); + Vector<Long> splits = crlIssuingPoint.getSplitTimes(); for (int i = 0; i < splits.size(); i++) { crlSplits.append(splits.elementAt(i)); if (i + 1 < splits.size()) @@ -311,10 +312,10 @@ public class UpdateCRL extends CMSServlet { String results = req.getParameter("results"); if (crlIssuingPointId != null) { - Enumeration ips = mCA.getCRLIssuingPoints(); + Enumeration<ICRLIssuingPoint> ips = mCA.getCRLIssuingPoints(); while (ips.hasMoreElements()) { - ICRLIssuingPoint ip = (ICRLIssuingPoint) ips.nextElement(); + ICRLIssuingPoint ip = ips.nextElement(); if (crlIssuingPointId.equals(ip.getId())) { break; @@ -447,7 +448,7 @@ public class UpdateCRL extends CMSServlet { } if (lpm != null && lpm.enabled()) { - Enumeration rules = lpm.getRules(IPublisherProcessor.PROP_LOCAL_CRL); + Enumeration<ILdapRule> rules = lpm.getRules(IPublisherProcessor.PROP_LOCAL_CRL); if (rules != null && rules.hasMoreElements()) { if (publishError != null) { header.addStringValue("crlPublished", "Failure"); @@ -481,8 +482,8 @@ public class UpdateCRL extends CMSServlet { crlIssuingPoint.getCRLNumber(), crlIssuingPoint.getLastUpdate(), crlIssuingPoint.getNextUpdate(), - Long.toString(crlIssuingPoint.getCRLSize()) + " time: " - + (endTime - startTime) } + Long.toString(crlIssuingPoint.getCRLSize()) + + " time: " + (endTime - startTime) } ); } else { mLogger.log(ILogger.EV_AUDIT, ILogger.S_OTHER, @@ -496,8 +497,8 @@ public class UpdateCRL extends CMSServlet { crlIssuingPoint.getCRLNumber(), crlIssuingPoint.getLastUpdate(), "not set", - Long.toString(crlIssuingPoint.getCRLSize()) + " time: " - + (endTime - startTime) } + Long.toString(crlIssuingPoint.getCRLSize()) + + " time: " + (endTime - startTime) } ); } } catch (EBaseException e) { diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java b/pki/base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java index 75ec99e13..23793b3f9 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java @@ -206,9 +206,10 @@ public class CRSEnrollment extends HttpServlet { public CRSEnrollment() { } - public static Hashtable toHashtable(HttpServletRequest req) { - Hashtable httpReqHash = new Hashtable(); - Enumeration names = req.getParameterNames(); + public static Hashtable<String, String> toHashtable(HttpServletRequest req) { + Hashtable<String, String> httpReqHash = new Hashtable<String, String>(); + @SuppressWarnings("unchecked") + Enumeration<String> names = req.getParameterNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); httpReqHash.put(name, req.getParameter(name)); @@ -416,7 +417,7 @@ public class CRSEnrollment extends HttpServlet { HttpServletRequest request) throws EBaseException { // build credential - Enumeration authNames = authenticator.getValueNames(); + Enumeration<String> authNames = authenticator.getValueNames(); if (authNames != null) { while (authNames.hasMoreElements()) { @@ -536,7 +537,7 @@ public class CRSEnrollment extends HttpServlet { public String getPasswordFromP10(PKCS10 p10) { PKCS10Attributes p10atts = p10.getAttributes(); - Enumeration e = p10atts.getElements(); + Enumeration<PKCS10Attribute> e = p10atts.getElements(); try { while (e.hasMoreElements()) { @@ -688,7 +689,7 @@ public class CRSEnrollment extends HttpServlet { String pkcs10Attr = ""; PKCS10Attributes p10atts = p10.getAttributes(); - Enumeration e = p10atts.getElements(); + Enumeration<PKCS10Attribute> e = p10atts.getElements(); while (e.hasMoreElements()) { PKCS10Attribute p10a = (PKCS10Attribute) e.nextElement(); @@ -696,18 +697,21 @@ public class CRSEnrollment extends HttpServlet { if (attr.getName().equals(ChallengePassword.NAME)) { if (attr.get(ChallengePassword.PASSWORD) != null) { - pkcs10Attr = pkcs10Attr + + pkcs10Attr = + pkcs10Attr + + "<ChallengePassword><Password>" - + (String) attr.get(ChallengePassword.PASSWORD) + "</Password></ChallengePassword>"; + + (String) attr.get(ChallengePassword.PASSWORD) + + "</Password></ChallengePassword>"; } } String extensionsStr = ""; if (attr.getName().equals(ExtensionsRequested.NAME)) { - Enumeration exts = ((ExtensionsRequested) attr).getExtensions().elements(); + Enumeration<Extension> exts = ((ExtensionsRequested) attr).getExtensions().elements(); while (exts.hasMoreElements()) { - Extension ext = (Extension) exts.nextElement(); + Extension ext = exts.nextElement(); if (ext.getExtensionId().equals( OIDMap.getOID(SubjectAlternativeNameExtension.IDENT))) { @@ -716,14 +720,16 @@ public class CRSEnrollment extends HttpServlet { Boolean.valueOf(false), // noncritical ext.getExtensionValue()); - Vector v = - (Vector) sane.get(SubjectAlternativeNameExtension.SUBJECT_NAME); + @SuppressWarnings("unchecked") + Vector<GeneralNameInterface> v = + (Vector<GeneralNameInterface>) sane + .get(SubjectAlternativeNameExtension.SUBJECT_NAME); - Enumeration gne = v.elements(); + Enumeration<GeneralNameInterface> gne = v.elements(); StringBuffer subjAltNameStr = new StringBuffer(); while (gne.hasMoreElements()) { - GeneralNameInterface gni = (GeneralNameInterface) gne.nextElement(); + GeneralNameInterface gni = gne.nextElement(); if (gni instanceof GeneralName) { GeneralName genName = (GeneralName) gni; @@ -974,14 +980,14 @@ public class CRSEnrollment extends HttpServlet { IRequestQueue rq = ca.getRequestQueue(); IRequest foundRequest = null; - Enumeration rids = rq.findRequestsBySourceId(txid); + Enumeration<RequestId> rids = rq.findRequestsBySourceId(txid); if (rids == null) { return null; } int count = 0; while (rids.hasMoreElements()) { - RequestId rid = (RequestId) rids.nextElement(); + RequestId rid = rids.nextElement(); if (rid == null) { continue; } @@ -1151,12 +1157,11 @@ public class CRSEnrollment extends HttpServlet { IRequest issueReq = null; X509CertImpl issuedCert = null; - Vector extensionsRequested = null; SubjectAlternativeNameExtension sane = null; CertAttrSet requested_ext = null; try { - PKCS10 p10 = (PKCS10) req.getP10(); + PKCS10 p10 = req.getP10(); if (p10 == null) { crsResp.setFailInfo(CRSPKIMessage.mFailInfo_badMessageCheck); @@ -1185,10 +1190,10 @@ public class CRSEnrollment extends HttpServlet { // one RDN, with many AVA's to // many RDN's with one AVA in each. - Enumeration rdne = p10subject.getRDNs(); - Vector rdnv = new Vector(); + Enumeration<RDN> rdne = p10subject.getRDNs(); + Vector<RDN> rdnv = new Vector<RDN>(); - Hashtable sanehash = new Hashtable(); + Hashtable<String, String> sanehash = new Hashtable<String, String>(); X500NameAttrMap xnap = X500NameAttrMap.getDefault(); while (rdne.hasMoreElements()) { @@ -1228,7 +1233,7 @@ public class CRSEnrollment extends HttpServlet { kue.set(KeyUsageExtension.KEY_ENCIPHERMENT, Boolean.valueOf(true)); PKCS10Attributes p10atts = p10.getAttributes(); - Enumeration e = p10atts.getElements(); + Enumeration<PKCS10Attribute> e = p10atts.getElements(); while (e.hasMoreElements()) { PKCS10Attribute p10a = (PKCS10Attribute) e.nextElement(); @@ -1246,9 +1251,9 @@ public class CRSEnrollment extends HttpServlet { if (attr.getName().equals(ExtensionsRequested.NAME)) { - Enumeration exts = ((ExtensionsRequested) attr).getExtensions().elements(); + Enumeration<Extension> exts = ((ExtensionsRequested) attr).getExtensions().elements(); while (exts.hasMoreElements()) { - Extension ext = (Extension) exts.nextElement(); + Extension ext = exts.nextElement(); if (ext.getExtensionId().equals( OIDMap.getOID(KeyUsageExtension.IDENT))) { @@ -1265,10 +1270,12 @@ public class CRSEnrollment extends HttpServlet { new Boolean(false), // noncritical ext.getExtensionValue()); - Vector v = - (Vector) sane.get(SubjectAlternativeNameExtension.SUBJECT_NAME); + @SuppressWarnings("unchecked") + Vector<GeneralNameInterface> v = + (Vector<GeneralNameInterface>) sane + .get(SubjectAlternativeNameExtension.SUBJECT_NAME); - Enumeration gne = v.elements(); + Enumeration<GeneralNameInterface> gne = v.elements(); while (gne.hasMoreElements()) { GeneralNameInterface gni = (GeneralNameInterface) gne.nextElement(); @@ -1308,8 +1315,8 @@ public class CRSEnrollment extends HttpServlet { } catch (Exception sne) { log(ILogger.LL_INFO, - "Unable to use appendDN parameter: " + mAppendDN + ". Error is " + sne.getMessage() - + " Using unmodified subjectname"); + "Unable to use appendDN parameter: " + + mAppendDN + ". Error is " + sne.getMessage() + " Using unmodified subjectname"); } if (subject != null) @@ -1350,7 +1357,7 @@ public class CRSEnrollment extends HttpServlet { } // NEED TO FIX } - private SubjectAlternativeNameExtension makeDefaultSubjectAltName(Hashtable ht) { + private SubjectAlternativeNameExtension makeDefaultSubjectAltName(Hashtable<String, String> ht) { // if no subjectaltname extension was requested, we try to make it up // from some of the elements of the subject name @@ -1359,7 +1366,7 @@ public class CRSEnrollment extends HttpServlet { GeneralNameInterface[] gn = new GeneralNameInterface[ht.size()]; itemCount = 0; - Enumeration en = ht.keys(); + Enumeration<String> en = ht.keys(); while (en.hasMoreElements()) { String key = (String) en.nextElement(); if (key.equals(SANE_DNSNAME)) { @@ -1445,15 +1452,15 @@ public class CRSEnrollment extends HttpServlet { return authenticationFailed; } - private boolean areFingerprintsEqual(IRequest req, Hashtable fingerprints) { + private boolean areFingerprintsEqual(IRequest req, Hashtable<String, byte[]> fingerprints) { - Hashtable old_fprints = req.getExtDataInHashtable(IRequest.FINGERPRINTS); + Hashtable<String, String> old_fprints = req.getExtDataInHashtable(IRequest.FINGERPRINTS); if (old_fprints == null) { return false; } - byte[] old_md5 = CMS.AtoB((String) old_fprints.get("MD5")); - byte[] new_md5 = (byte[]) fingerprints.get("MD5"); + byte[] old_md5 = CMS.AtoB(old_fprints.get("MD5")); + byte[] new_md5 = fingerprints.get("MD5"); if (old_md5.length != new_md5.length) return false; @@ -1474,7 +1481,7 @@ public class CRSEnrollment extends HttpServlet { try { unwrapPKCS10(req, cx); - Hashtable fingerprints = makeFingerPrints(req); + Hashtable<String, byte[]> fingerprints = makeFingerPrints(req); if (cmsRequest != null) { if (areFingerprintsEqual(cmsRequest, fingerprints)) { @@ -1562,7 +1569,7 @@ public class CRSEnrollment extends HttpServlet { // use profile framework to handle SCEP if (mProfileId != null) { - PKCS10 pkcs10data = (PKCS10) req.getP10(); + PKCS10 pkcs10data = req.getP10(); String pkcs10blob = CMS.BtoA(pkcs10data.toByteArray()); // XXX authentication handling @@ -1673,10 +1680,10 @@ public class CRSEnrollment extends HttpServlet { } catch (Exception pwex) { } - Hashtable fingerprints = (Hashtable) req.get(IRequest.FINGERPRINTS); + Hashtable<?, ?> fingerprints = (Hashtable<?, ?>) req.get(IRequest.FINGERPRINTS); if (fingerprints.size() > 0) { - Hashtable encodedPrints = new Hashtable(fingerprints.size()); - Enumeration e = fingerprints.keys(); + Hashtable<String, String> encodedPrints = new Hashtable<String, String>(fingerprints.size()); + Enumeration<?> e = fingerprints.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); byte[] value = (byte[]) fingerprints.get(key); @@ -1706,8 +1713,8 @@ public class CRSEnrollment extends HttpServlet { return pkiReq; } - public Hashtable makeFingerPrints(CRSPKIMessage req) { - Hashtable fingerprints = new Hashtable(); + public Hashtable<String, byte[]> makeFingerPrints(CRSPKIMessage req) { + Hashtable<String, byte[]> fingerprints = new Hashtable<String, byte[]>(); MessageDigest md; String[] hashes = new String[] { "MD2", "MD5", "SHA1", "SHA256", "SHA512" }; @@ -1936,7 +1943,7 @@ public class CRSEnrollment extends HttpServlet { private CryptoToken keyStorageToken; private CryptoToken internalKeyStorageToken; private KeyGenerator DESkg; - private Enumeration externalTokens = null; + private Enumeration<?> externalTokens = null; private org.mozilla.jss.crypto.X509Certificate signingCert; private org.mozilla.jss.crypto.PrivateKey signingCertPrivKey; private int signingCertKeySize = 0; @@ -2033,11 +2040,11 @@ public class CRSEnrollment extends HttpServlet { return internalToken; } - public void setExternalTokens(Enumeration tokens) { + public void setExternalTokens(Enumeration<?> tokens) { externalTokens = tokens; } - public Enumeration getExternalTokens() { + public Enumeration<?> getExternalTokens() { return externalTokens; } diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ChallengePassword.java b/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ChallengePassword.java index 8a3ddb5d9..ff55dc9ce 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ChallengePassword.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ChallengePassword.java @@ -23,7 +23,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.security.cert.CertificateException; import java.util.Enumeration; -import java.util.Hashtable; +import java.util.Vector; import netscape.security.util.DerValue; import netscape.security.x509.CertAttrSet; @@ -127,8 +127,8 @@ public class ChallengePassword implements CertAttrSet { /** * @return an empty set of elements */ - public Enumeration getElements() { - return (new Hashtable()).elements(); + public Enumeration<String> getAttributeNames() { + return (new Vector<String>()).elements(); } /** diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ExtensionsRequested.java b/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ExtensionsRequested.java index 33c28447f..b3a0f5651 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ExtensionsRequested.java +++ b/pki/base/common/src/com/netscape/cms/servlet/cert/scep/ExtensionsRequested.java @@ -23,7 +23,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.security.cert.CertificateException; import java.util.Enumeration; -import java.util.Hashtable; import java.util.Vector; import netscape.security.util.DerInputStream; @@ -41,7 +40,7 @@ public class ExtensionsRequested implements CertAttrSet { private String kue_digital_signature = "false"; private String kue_key_encipherment = "false"; - private Vector exts = new Vector(); + private Vector<Extension> exts = new Vector<Extension>(); public ExtensionsRequested(Object stuff) throws IOException { ByteArrayInputStream is = new ByteArrayInputStream((byte[]) stuff); @@ -85,8 +84,8 @@ public class ExtensionsRequested implements CertAttrSet { throws CertificateException, IOException { } - public Enumeration getElements() { - return (new Hashtable()).elements(); + public Enumeration<String> getAttributeNames() { + return (new Vector<String>()).elements(); } public String getName() { @@ -171,7 +170,7 @@ public class ExtensionsRequested implements CertAttrSet { } - public Vector getExtensions() { + public Vector<Extension> getExtensions() { return exts; } diff --git a/pki/base/common/src/com/netscape/cms/servlet/common/CMCOutputTemplate.java b/pki/base/common/src/com/netscape/cms/servlet/common/CMCOutputTemplate.java index 25f062657..aa95b622d 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/common/CMCOutputTemplate.java +++ b/pki/base/common/src/com/netscape/cms/servlet/common/CMCOutputTemplate.java @@ -778,12 +778,14 @@ public class CMCOutputTemplate { SignedData msgData = (SignedData) msgValue.decodeWith(SignedData.getTemplate()); if (!verifyRevRequestSignature(msgData)) { - OtherInfo otherInfo = new OtherInfo(OtherInfo.FAIL, new INTEGER( - OtherInfo.BAD_MESSAGE_CHECK), null); + OtherInfo otherInfo = + new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.BAD_MESSAGE_CHECK), + null); SEQUENCE failed_bpids = new SEQUENCE(); failed_bpids.addElement(attrbpid); - cmcStatusInfo = new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, - (String) null, otherInfo); + cmcStatusInfo = + new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, (String) null, + otherInfo); tagattr = new TaggedAttribute( new INTEGER(bpid++), OBJECT_IDENTIFIER.id_cmc_cMCStatusInfo, cmcStatusInfo); @@ -825,8 +827,8 @@ public class CMCOutputTemplate { if (!sharedSecretFound) { CMS.debug("CMCOutputTemplate: class for shared secret was not found."); - OtherInfo otherInfo = new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.INTERNAL_CA_ERROR), - null); + OtherInfo otherInfo = + new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.INTERNAL_CA_ERROR), null); SEQUENCE failed_bpids = new SEQUENCE(); failed_bpids.addElement(attrbpid); cmcStatusInfo = new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, (String) null, otherInfo); @@ -845,8 +847,8 @@ public class CMCOutputTemplate { if (sharedSecret == null) { CMS.debug("CMCOutputTemplate: class for shared secret was not found."); - OtherInfo otherInfo = new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.INTERNAL_CA_ERROR), - null); + OtherInfo otherInfo = + new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.INTERNAL_CA_ERROR), null); SEQUENCE failed_bpids = new SEQUENCE(); failed_bpids.addElement(attrbpid); cmcStatusInfo = new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, (String) null, otherInfo); @@ -864,8 +866,8 @@ public class CMCOutputTemplate { revoke = true; } else { CMS.debug("CMCOutputTemplate: Both client and server shared secret are not the same, cant revoke certificate."); - OtherInfo otherInfo = new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.BAD_MESSAGE_CHECK), - null); + OtherInfo otherInfo = + new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.BAD_MESSAGE_CHECK), null); SEQUENCE failed_bpids = new SEQUENCE(); failed_bpids.addElement(attrbpid); cmcStatusInfo = new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, (String) null, otherInfo); @@ -929,8 +931,8 @@ public class CMCOutputTemplate { entryExtn.set(crlReasonExtn.getName(), crlReasonExtn); } - RevokedCertImpl revCertImpl = new RevokedCertImpl(impl.getSerialNumber(), CMS.getCurrentDate(), - entryExtn); + RevokedCertImpl revCertImpl = + new RevokedCertImpl(impl.getSerialNumber(), CMS.getCurrentDate(), entryExtn); RevokedCertImpl[] revCertImpls = new RevokedCertImpl[1]; revCertImpls[0] = revCertImpl; IRequestQueue queue = ca.getRequestQueue(); @@ -950,12 +952,12 @@ public class CMCOutputTemplate { if (result.equals(IRequest.RES_ERROR)) { CMS.debug("CMCOutputTemplate: revReq exception: " + revReq.getExtDataInString(IRequest.ERROR)); - OtherInfo otherInfo = new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.BAD_REQUEST), - null); + OtherInfo otherInfo = + new OtherInfo(OtherInfo.FAIL, new INTEGER(OtherInfo.BAD_REQUEST), null); SEQUENCE failed_bpids = new SEQUENCE(); failed_bpids.addElement(attrbpid); - cmcStatusInfo = new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, (String) null, - otherInfo); + cmcStatusInfo = + new CMCStatusInfo(CMCStatusInfo.FAILED, failed_bpids, (String) null, otherInfo); tagattr = new TaggedAttribute( new INTEGER(bpid++), OBJECT_IDENTIFIER.id_cmc_cMCStatusInfo, cmcStatusInfo); @@ -1039,7 +1041,7 @@ public class CMCOutputTemplate { SET dias = msgData.getDigestAlgorithmIdentifiers(); int numDig = dias.size(); - Hashtable digs = new Hashtable(); + Hashtable<String, byte[]> digs = new Hashtable<String, byte[]>(); for (int i = 0; i < numDig; i++) { AlgorithmIdentifier dai = (AlgorithmIdentifier) dias.elementAt(i); @@ -1057,7 +1059,7 @@ public class CMCOutputTemplate { org.mozilla.jss.pkix.cms.SignerInfo si = (org.mozilla.jss.pkix.cms.SignerInfo) sis.elementAt(i); String name = si.getDigestAlgorithm().toString(); - byte[] digest = (byte[]) digs.get(name); + byte[] digest = digs.get(name); if (digest == null) { MessageDigest md = MessageDigest.getInstance(name); ByteArrayOutputStream ostream = new ByteArrayOutputStream(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/connector/ConnectorServlet.java b/pki/base/common/src/com/netscape/cms/servlet/connector/ConnectorServlet.java index ca7759d5a..b2c43b3f7 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/connector/ConnectorServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/connector/ConnectorServlet.java @@ -833,10 +833,10 @@ public class ConnectorServlet extends CMSServlet { int reason = 0; if (crlExts != null) { - Enumeration enum1 = crlExts.getElements(); + Enumeration<Extension> enum1 = crlExts.getElements(); while (enum1.hasMoreElements()) { - Extension ext = (Extension) enum1.nextElement(); + Extension ext = enum1.nextElement(); if (ext instanceof CRLReasonExtension) { reason = ((CRLReasonExtension) ext).getReason().toInt(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminAuthenticatePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminAuthenticatePanel.java index 16c5e6c65..8c84f4a21 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminAuthenticatePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminAuthenticatePanel.java @@ -249,12 +249,13 @@ public class AdminAuthenticatePanel extends WizardPanelBase { c1.append(",preop.ca.hostname,preop.ca.httpport,preop.ca.httpsport,preop.ca.list,preop.ca.pkcs7,preop.ca.type"); } - String content = "uid=" - + uid - + "&pwd=" - + pwd - + "&op=get&names=cloning.module.token,instanceId,internaldb.basedn,internaldb.ldapauth.password,internaldb.replication.password,internaldb.ldapconn.host,internaldb.ldapconn.port,internaldb.ldapauth.bindDN" - + c1.toString() + "&substores=" + s1.toString(); + String content = + "uid=" + + uid + + "&pwd=" + + pwd + + "&op=get&names=cloning.module.token,instanceId,internaldb.basedn,internaldb.ldapauth.password,internaldb.replication.password,internaldb.ldapconn.host,internaldb.ldapconn.port,internaldb.ldapauth.bindDN" + + c1.toString() + "&substores=" + s1.toString(); boolean success = updateConfigEntries(host, httpsport, true, "/" + cstype + "/admin/" + cstype + "/getConfigEntries", content, config, diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminPanel.java index d8d841e39..223801d8f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/AdminPanel.java @@ -481,8 +481,10 @@ public class AdminPanel extends WizardPanelBase { String session_id = CMS.getConfigSDSessionId(); String subjectDN = HttpInput.getString(request, "subject"); - String content = "profileId=" + profileId + "&cert_request_type=" + cert_request_type + "&cert_request=" - + cert_request + "&xmlOutput=true&sessionID=" + session_id + "&subject=" + subjectDN; + String content = + "profileId=" + + profileId + "&cert_request_type=" + cert_request_type + "&cert_request=" + cert_request + + "&xmlOutput=true&sessionID=" + session_id + "&subject=" + subjectDN; HttpClient httpclient = new HttpClient(); String c = null; @@ -651,7 +653,8 @@ public class AdminPanel extends WizardPanelBase { } catch (Exception e) { } if (ca == null && type.equals("otherca")) { - info = "Since you do not join the Redhat CA network, the administrator's certificate will not be generated automatically."; + info = + "Since you do not join the Redhat CA network, the administrator's certificate will not be generated automatically."; } context.put("info", info); context.put("admin_email", request.getParameter("email")); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java index f73e44c18..c81c666e6 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertRequestPanel.java @@ -128,8 +128,8 @@ public class CertRequestPanel extends WizardPanelBase { if (hardware) { CMS.debug("CertRequestPanel findCertificate: The certificate with the same nickname: " + fullnickname + " has been found on HSM. Please remove it before proceeding."); - throw new IOException("The certificate with the same nickname: " + fullnickname - + " has been found on HSM. Please remove it before proceeding."); + throw new IOException("The certificate with the same nickname: " + + fullnickname + " has been found on HSM. Please remove it before proceeding."); } return true; } @@ -212,8 +212,8 @@ public class CertRequestPanel extends WizardPanelBase { CMS.debug("CertRequestPanel cleanup: deleting certificate (" + nickname + ")."); deleteCert(tokenname, nickname); } catch (Exception e) { - CMS.debug("CertRequestPanel cleanup: failed to delete certificate (" + nickname + "). Exception: " - + e.toString()); + CMS.debug("CertRequestPanel cleanup: failed to delete certificate (" + + nickname + "). Exception: " + e.toString()); } } } @@ -735,8 +735,8 @@ public class CertRequestPanel extends WizardPanelBase { ic.setSSLTrust(InternalCertificate.USER); ic.setEmailTrust(InternalCertificate.USER); if (tag.equals("audit_signing")) { - ic.setObjectSigningTrust(InternalCertificate.USER | InternalCertificate.VALID_PEER - | InternalCertificate.TRUSTED_PEER); + ic.setObjectSigningTrust(InternalCertificate.USER + | InternalCertificate.VALID_PEER | InternalCertificate.TRUSTED_PEER); } else { ic.setObjectSigningTrust(InternalCertificate.USER); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertUtil.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertUtil.java index 5e1bd5e80..2934b3ebe 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertUtil.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/CertUtil.java @@ -643,8 +643,8 @@ public class CertUtil { try { privKey = cm.findPrivKeyByCert(cert); } catch (Exception e) { - CMS.debug("CertUtil privateKeyExistsOnToken: cant find private key (" + fullnickname + ") exception: " - + e.toString()); + CMS.debug("CertUtil privateKeyExistsOnToken: cant find private key (" + + fullnickname + ") exception: " + e.toString()); return false; } diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java index bd3a31770..02a992832 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java @@ -1035,8 +1035,8 @@ public class DatabasePanel extends WizardPanelBase { // setup replication after indexes have been created if (select.equals("clone")) { CMS.debug("Start setting up replication."); - setupReplication(request, context, (secure.equals("on") ? "true" : "false"), - (cloneStartTLS.equals("on") ? "true" : "false")); + setupReplication(request, context, (secure.equals("on") ? "true" : "false"), (cloneStartTLS.equals("on") + ? "true" : "false")); CMS.debug("Finish setting up replication."); try { @@ -1318,8 +1318,8 @@ public class DatabasePanel extends WizardPanelBase { } return id; } else { - CMS.debug("DatabasePanel enableReplication: Failed to create " + replicadn + " entry. Exception: " - + e.toString()); + CMS.debug("DatabasePanel enableReplication: Failed to create " + + replicadn + " entry. Exception: " + e.toString()); return id; } } @@ -1378,8 +1378,8 @@ public class DatabasePanel extends WizardPanelBase { throw ee; } } else { - CMS.debug("DatabasePanel createReplicationAgreement: Failed to create " + dn + " entry. Exception: " - + e.toString()); + CMS.debug("DatabasePanel createReplicationAgreement: Failed to create " + + dn + " entry. Exception: " + e.toString()); throw e; } } @@ -1391,8 +1391,8 @@ public class DatabasePanel extends WizardPanelBase { String name) { String dn = "cn=" + name + "," + replicadn; CMS.debug("DatabasePanel initializeConsumer: initializeConsumer dn: " + dn); - CMS.debug("DatabasePanel initializeConsumer: initializeConsumer host: " + conn.getHost() + " port: " - + conn.getPort()); + CMS.debug("DatabasePanel initializeConsumer: initializeConsumer host: " + + conn.getHost() + " port: " + conn.getPort()); try { LDAPAttribute attr = new LDAPAttribute("nsds5beginreplicarefresh", "start"); @@ -1487,9 +1487,9 @@ public class DatabasePanel extends WizardPanelBase { try { String filter = "(objectclass=*)"; String[] attrs = { "nsslapd-directory" }; - LDAPSearchResults results = conn.search("cn=config,cn=ldbm database,cn=plugins,cn=config", - LDAPv3.SCOPE_SUB, - filter, attrs, false); + LDAPSearchResults results = + conn.search("cn=config,cn=ldbm database,cn=plugins,cn=config", LDAPv3.SCOPE_SUB, + filter, attrs, false); while (results.hasMoreElements()) { LDAPEntry entry = results.next(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DisplayCertChainPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DisplayCertChainPanel.java index c24992cb4..2f5831794 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DisplayCertChainPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DisplayCertChainPanel.java @@ -195,11 +195,14 @@ public class DisplayCertChainPanel extends WizardPanelBase { String cs_hostname = cs.getString("machineName", ""); int cs_port = cs.getInteger("pkicreate.admin_secure_port", -1); String subsystem = cs.getString("cs.type", ""); - String urlVal = "https://" + cs_hostname + ":" + cs_port + "/" + toLowerCaseSubsystemType(subsystem) - + "/admin/console/config/wizard?p=" + panel + "&subsystem=" + subsystem; + String urlVal = + "https://" + + cs_hostname + ":" + cs_port + "/" + toLowerCaseSubsystemType(subsystem) + + "/admin/console/config/wizard?p=" + panel + "&subsystem=" + subsystem; String encodedValue = URLEncoder.encode(urlVal, "UTF-8"); - String sdurl = "https://" + sd_hostname + ":" + sd_port + "/ca/admin/ca/securityDomainLogin?url=" - + encodedValue; + String sdurl = + "https://" + + sd_hostname + ":" + sd_port + "/ca/admin/ca/securityDomainLogin?url=" + encodedValue; response.sendRedirect(sdurl); // The user previously specified the CA Security Domain's diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DonePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DonePanel.java index 388570531..ffadf5884 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DonePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DonePanel.java @@ -495,14 +495,14 @@ public class DonePanel extends WizardPanelBase { } else { serialdn = "ou=keyRepository,ou=" + type.toLowerCase() + "," + basedn; } - LDAPAttribute attrSerialNextRange = new LDAPAttribute("nextRange", endSerialNum.add(oneNum) - .toString()); + LDAPAttribute attrSerialNextRange = + new LDAPAttribute("nextRange", endSerialNum.add(oneNum).toString()); LDAPModification serialmod = new LDAPModification(LDAPModification.REPLACE, attrSerialNextRange); conn.modify(serialdn, serialmod); String requestdn = "ou=" + type.toLowerCase() + ",ou=requests," + basedn; - LDAPAttribute attrRequestNextRange = new LDAPAttribute("nextRange", endRequestNum.add(oneNum) - .toString()); + LDAPAttribute attrRequestNextRange = + new LDAPAttribute("nextRange", endRequestNum.add(oneNum).toString()); LDAPModification requestmod = new LDAPModification(LDAPModification.REPLACE, attrRequestNextRange); conn.modify(requestdn, requestmod); @@ -777,12 +777,15 @@ public class DonePanel extends WizardPanelBase { } else { CMS.debug("DonePanel: Transport certificate is being setup in " + url); String session_id = CMS.getConfigSDSessionId(); - String content = "ca.connector.KRA.enable=true&ca.connector.KRA.local=false&ca.connector.KRA.timeout=30&ca.connector.KRA.uri=/kra/agent/kra/connector&ca.connector.KRA.host=" - + ownagenthost - + "&ca.connector.KRA.port=" - + ownagentsport - + "&ca.connector.KRA.transportCert=" - + URLEncoder.encode(transportCert) + "&sessionID=" + session_id; + String content = + "ca.connector.KRA.enable=true&ca.connector.KRA.local=false&ca.connector.KRA.timeout=30&ca.connector.KRA.uri=/kra/agent/kra/connector&ca.connector.KRA.host=" + + ownagenthost + + "&ca.connector.KRA.port=" + + ownagentsport + + "&ca.connector.KRA.transportCert=" + + URLEncoder.encode(transportCert) + + "&sessionID=" + + session_id; updateConnectorInfo(host, port, true, content); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java index 4f6df0f0b..9e0ca6f38 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/NamePanel.java @@ -491,9 +491,11 @@ public class NamePanel extends WizardPanelBase { String machineName = config.getString("machineName", ""); String securePort = config.getString("service.securePort", ""); if (certTag.equals("subsystem")) { - String content = "requestor_name=" + sysType + "-" + machineName + "-" + securePort + "&profileId=" - + profileId + "&cert_request_type=pkcs10&cert_request=" - + URLEncoder.encode(pkcs10, "UTF-8") + "&xmlOutput=true&sessionID=" + session_id; + String content = + "requestor_name=" + + sysType + "-" + machineName + "-" + securePort + "&profileId=" + profileId + + "&cert_request_type=pkcs10&cert_request=" + URLEncoder.encode(pkcs10, "UTF-8") + + "&xmlOutput=true&sessionID=" + session_id; cert = CertUtil.createRemoteCert(sd_hostname, sd_ee_port, content, response, this); if (cert == null) { @@ -508,9 +510,11 @@ public class NamePanel extends WizardPanelBase { } catch (Exception ee) { } - String content = "requestor_name=" + sysType + "-" + machineName + "-" + securePort + "&profileId=" - + profileId + "&cert_request_type=pkcs10&cert_request=" - + URLEncoder.encode(pkcs10, "UTF-8") + "&xmlOutput=true&sessionID=" + session_id; + String content = + "requestor_name=" + + sysType + "-" + machineName + "-" + securePort + "&profileId=" + profileId + + "&cert_request_type=pkcs10&cert_request=" + URLEncoder.encode(pkcs10, "UTF-8") + + "&xmlOutput=true&sessionID=" + session_id; cert = CertUtil.createRemoteCert(ca_hostname, ca_port, content, response, this); if (cert == null) { @@ -651,8 +655,8 @@ public class NamePanel extends WizardPanelBase { config.commit(false); } } catch (Exception e) { - CMS.debug("NamePanel: configCertWithTag: Exception in setting nickname for " + ct + ": " - + e.toString()); + CMS.debug("NamePanel: configCertWithTag: Exception in setting nickname for " + + ct + ": " + e.toString()); } configCert(request, response, context, cert); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/RestoreKeyCertPanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/RestoreKeyCertPanel.java index dde150485..0ae550707 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/RestoreKeyCertPanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/RestoreKeyCertPanel.java @@ -456,8 +456,13 @@ public class RestoreKeyCertPanel extends WizardPanelBase { s1.append("ca.connector.KRA"); } - content = "op=get&names=cloning.token,instanceId,internaldb.basedn,internaldb.ldapauth.password,internaldb.replication.password,internaldb.ldapconn.host,internaldb.ldapconn.port,internaldb.ldapauth.bindDN" - + c1.toString() + "&substores=" + s1.toString() + "&xmlOutput=true&sessionID=" + session_id; + content = + "op=get&names=cloning.token,instanceId,internaldb.basedn,internaldb.ldapauth.password,internaldb.replication.password,internaldb.ldapconn.host,internaldb.ldapconn.port,internaldb.ldapauth.bindDN" + + c1.toString() + + "&substores=" + + s1.toString() + + "&xmlOutput=true&sessionID=" + + session_id; boolean success = updateConfigEntries(master_hostname, master_port, true, "/" + cstype + "/admin/" + cstype + "/getConfigEntries", content, config, response); if (!success) { @@ -562,8 +567,8 @@ public class RestoreKeyCertPanel extends WizardPanelBase { KeyWrapper wrapper = token.getKeyWrapper(KeyWrapAlgorithm.DES3_CBC_PAD); wrapper.initUnwrap(sk, param); - org.mozilla.jss.crypto.PrivateKey pp = wrapper.unwrapPrivate(encpkey, getPrivateKeyType(publickey), - publickey); + org.mozilla.jss.crypto.PrivateKey pp = + wrapper.unwrapPrivate(encpkey, getPrivateKeyType(publickey), publickey); } catch (Exception e) { CMS.debug("RestoreKeyCertPanel importkeycert: Exception=" + e.toString()); @@ -604,8 +609,8 @@ public class RestoreKeyCertPanel extends WizardPanelBase { | InternalCertificate.VALID_CA); } else if (name.startsWith("auditSigningCert")) { InternalCertificate icert = (InternalCertificate) xcert; - icert.setObjectSigningTrust(InternalCertificate.USER | InternalCertificate.VALID_PEER - | InternalCertificate.TRUSTED_PEER); + icert.setObjectSigningTrust(InternalCertificate.USER + | InternalCertificate.VALID_PEER | InternalCertificate.TRUSTED_PEER); } } else cm.importCACertPackage(cert); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/SizePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/SizePanel.java index c4329bda2..fcb88c917 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/SizePanel.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/SizePanel.java @@ -70,11 +70,12 @@ public class SizePanel extends WizardPanelBase { public PropertySet getUsage() { PropertySet set = new PropertySet(); - Descriptor choiceDesc = new Descriptor( - IDescriptor.CHOICE, - "default,custom", - null, /* no default parameter */ - "If 'default', the key size will be configured automatically. If 'custom', the key size will be set to the value of the parameter 'custom_size'."); + Descriptor choiceDesc = + new Descriptor( + IDescriptor.CHOICE, + "default,custom", + null, /* no default parameter */ + "If 'default', the key size will be configured automatically. If 'custom', the key size will be set to the value of the parameter 'custom_size'."); set.add("choice", choiceDesc); @@ -625,8 +626,9 @@ public class SizePanel extends WizardPanelBase { s = config.getString("preop.ecc.algorithm.list", "SHA256withEC,SHA1withEC,SHA384withEC,SHA512withEC"); context.put("ecclist", s); - s = config.getString("preop.rsa.algorithm.list", - "SHA256withRSA,SHA1withRSA,SHA512withRSA,MD5withRSA,MD2withRSA"); + s = + config.getString("preop.rsa.algorithm.list", + "SHA256withRSA,SHA1withRSA,SHA512withRSA,MD5withRSA,MD2withRSA"); context.put("rsalist", s); s = config.getString("keys.ecc.curve.list", "nistp256"); diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java index 7b381383b..93893bff1 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java +++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/WizardPanelBase.java @@ -1630,8 +1630,10 @@ public class WizardPanelBase implements IWizardPanel { int cs_port = cs.getInteger("pkicreate.admin_secure_port", -1); int panel = getPanelNo(); String subsystem = cs.getString("cs.type", ""); - String urlVal = "https://" + cs_hostname + ":" + cs_port + "/" + toLowerCaseSubsystemType(subsystem) - + "/admin/console/config/wizard?p=" + panel + "&subsystem=" + subsystem; + String urlVal = + "https://" + + cs_hostname + ":" + cs_port + "/" + toLowerCaseSubsystemType(subsystem) + + "/admin/console/config/wizard?p=" + panel + "&subsystem=" + subsystem; String encodedValue = URLEncoder.encode(urlVal, "UTF-8"); String sdurl = "https://" + hostname + ":" + port + "/ca/admin/ca/securityDomainLogin?url=" + encodedValue; response.sendRedirect(sdurl); diff --git a/pki/base/common/src/com/netscape/cms/servlet/ocsp/CheckCertServlet.java b/pki/base/common/src/com/netscape/cms/servlet/ocsp/CheckCertServlet.java index 5ccb87125..8d2c5a28b 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/ocsp/CheckCertServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/ocsp/CheckCertServlet.java @@ -192,8 +192,8 @@ public class CheckCertServlet extends CMSServlet { } catch (Exception e) { header.addStringValue(ATTR_STATUS, STATUS_UNKNOWN); } - log(ILogger.EV_AUDIT, AuditFormat.LEVEL, "Checked Certificate Status " + cert.getIssuerDN().getName() + " " - + cert.getSerialNumber().toString()); + log(ILogger.EV_AUDIT, AuditFormat.LEVEL, "Checked Certificate Status " + + cert.getIssuerDN().getName() + " " + cert.getSerialNumber().toString()); try { ServletOutputStream out = resp.getOutputStream(); 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 6b9d20944..83eaca45f 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,7 +128,7 @@ public class ListCAServlet extends CMSServlet { CMSTemplateParams argSet = new CMSTemplateParams(header, fixed); IDefStore defStore = mOCSPAuthority.getDefaultStore(); - Enumeration recs = defStore.searchAllCRLIssuingPointRecord(100); + Enumeration<Object> recs = defStore.searchAllCRLIssuingPointRecord(100); // show the current CRL number if present header.addStringValue("stateCount", 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 81d34a65d..51655f973 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 @@ -305,8 +305,9 @@ public class CMCProcessor extends PKIProcessor { PublicKey signKey = null; while (signKey == null && j < numReqs) { - X509Key subjectKeyInfo = (X509Key) ((CertificateX509Key) certInfoArray[j].get(X509CertInfo.KEY)) - .get(CertificateX509Key.KEY); + X509Key subjectKeyInfo = + (X509Key) ((CertificateX509Key) certInfoArray[j].get(X509CertInfo.KEY)) + .get(CertificateX509Key.KEY); MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(subjectKeyInfo.getEncoded()); 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 094ea263c..641017cc8 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 @@ -196,8 +196,8 @@ public class CRMFProcessor extends PKIProcessor { // field suggested notBefore and notAfter in CRMF // Tech Support #383184 if (certTemplate.getNotBefore() != null || certTemplate.getNotAfter() != null) { - CertificateValidity certValidity = new CertificateValidity(certTemplate.getNotBefore(), - certTemplate.getNotAfter()); + CertificateValidity certValidity = + new CertificateValidity(certTemplate.getNotBefore(), certTemplate.getNotAfter()); certInfo.set(X509CertInfo.VALIDITY, certValidity); } 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 b90dc97b7..4a7d70cc0 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 @@ -130,13 +130,13 @@ public class ProfileSubmitServlet extends ProfileServlet { private void setInputsIntoContext(HttpServletRequest request, IProfile profile, IProfileContext ctx) { // passing inputs into context - Enumeration inputIds = profile.getProfileInputIds(); + Enumeration<String> inputIds = profile.getProfileInputIds(); if (inputIds != null) { while (inputIds.hasMoreElements()) { String inputId = (String) inputIds.nextElement(); IProfileInput profileInput = profile.getProfileInput(inputId); - Enumeration inputNames = profileInput.getValueNames(); + Enumeration<String> inputNames = profileInput.getValueNames(); while (inputNames.hasMoreElements()) { String inputName = (String) inputNames.nextElement(); @@ -161,13 +161,13 @@ public class ProfileSubmitServlet extends ProfileServlet { */ private void setInputsIntoContext(IRequest request, IProfile profile, IProfileContext ctx, Locale locale) { // passing inputs into context - Enumeration inputIds = profile.getProfileInputIds(); + Enumeration<String> inputIds = profile.getProfileInputIds(); if (inputIds != null) { while (inputIds.hasMoreElements()) { String inputId = (String) inputIds.nextElement(); IProfileInput profileInput = profile.getProfileInput(inputId); - Enumeration inputNames = profileInput.getValueNames(); + Enumeration<String> inputNames = profileInput.getValueNames(); while (inputNames.hasMoreElements()) { String inputName = (String) inputNames.nextElement(); @@ -193,7 +193,7 @@ public class ProfileSubmitServlet extends ProfileServlet { private void setCredentialsIntoContext(HttpServletRequest request, IProfileAuthenticator authenticator, IProfileContext ctx) { - Enumeration authIds = authenticator.getValueNames(); + Enumeration<String> authIds = authenticator.getValueNames(); if (authIds != null) { CMS.debug("ProfileSubmitServlet:setCredentialsIntoContext() authNames not null"); @@ -303,7 +303,7 @@ public class ProfileSubmitServlet extends ProfileServlet { AuthCredentials credentials = new AuthCredentials(); // build credential - Enumeration authNames = authenticator.getValueNames(); + Enumeration<String> authNames = authenticator.getValueNames(); if (authNames != null) { while (authNames.hasMoreElements()) { @@ -329,13 +329,13 @@ public class ProfileSubmitServlet extends ProfileServlet { } private void setInputsIntoRequest(HttpServletRequest request, IProfile profile, IRequest req) { - Enumeration inputIds = profile.getProfileInputIds(); + Enumeration<String> inputIds = profile.getProfileInputIds(); if (inputIds != null) { while (inputIds.hasMoreElements()) { String inputId = (String) inputIds.nextElement(); IProfileInput profileInput = profile.getProfileInput(inputId); - Enumeration inputNames = profileInput.getValueNames(); + Enumeration<String> inputNames = profileInput.getValueNames(); if (inputNames != null) { while (inputNames.hasMoreElements()) { @@ -363,13 +363,13 @@ public class ProfileSubmitServlet extends ProfileServlet { */ private void setInputsIntoRequest(IRequest request, IProfile profile, IRequest req, Locale locale) { // passing inputs into request - Enumeration inputIds = profile.getProfileInputIds(); + Enumeration<String> inputIds = profile.getProfileInputIds(); if (inputIds != null) { while (inputIds.hasMoreElements()) { String inputId = (String) inputIds.nextElement(); IProfileInput profileInput = profile.getProfileInput(inputId); - Enumeration inputNames = profileInput.getValueNames(); + Enumeration<String> inputNames = profileInput.getValueNames(); while (inputNames.hasMoreElements()) { String inputName = (String) inputNames.nextElement(); @@ -394,14 +394,14 @@ public class ProfileSubmitServlet extends ProfileServlet { } private void setOutputIntoArgs(IProfile profile, ArgList outputlist, Locale locale, IRequest req) { - Enumeration outputIds = profile.getProfileOutputIds(); + Enumeration<String> outputIds = profile.getProfileOutputIds(); if (outputIds != null) { while (outputIds.hasMoreElements()) { String outputId = (String) outputIds.nextElement(); IProfileOutput profileOutput = profile.getProfileOutput(outputId); - Enumeration outputNames = profileOutput.getValueNames(); + Enumeration<String> outputNames = profileOutput.getValueNames(); if (outputNames != null) { while (outputNames.hasMoreElements()) { @@ -483,10 +483,11 @@ public class ProfileSubmitServlet extends ProfileServlet { if (CMS.debugOn()) { CMS.debug("Start of ProfileSubmitServlet Input Parameters"); - Enumeration paramNames = request.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> paramNames = request.getParameterNames(); while (paramNames.hasMoreElements()) { - String paramName = (String) paramNames.nextElement(); + String paramName = paramNames.nextElement(); // added this facility so that password can be hidden, // all sensitive parameters should be prefixed with // __ (double underscores); however, in the event that @@ -749,7 +750,7 @@ public class ProfileSubmitServlet extends ProfileServlet { if (origReq != null) { CMS.debug("ProfileSubmitServlet: renewal: found original enrollment request id:" + rid); // debug: print the extData keys - Enumeration en = origReq.getExtDataKeys(); + Enumeration<String> en = origReq.getExtDataKeys(); /* CMS.debug("ProfileSubmitServlet: renewal: origRequest extdata key print BEGINS"); while (en.hasMoreElements()) { @@ -973,11 +974,11 @@ public class ProfileSubmitServlet extends ProfileServlet { CMS.debug("ProfileSubmitServlet: authentication required."); String uid_cred = "Unidentified"; String uid_attempted_cred = "Unidentified"; - Enumeration authIds = authenticator.getValueNames(); + Enumeration<String> authIds = authenticator.getValueNames(); //Attempt to possibly fetch attemped uid, may not always be available. if (authIds != null) { while (authIds.hasMoreElements()) { - String authName = (String) authIds.nextElement(); + String authName = authIds.nextElement(); String value = request.getParameter(authName); if (value != null) { if (authName.equals("uid")) { @@ -1156,9 +1157,9 @@ public class ProfileSubmitServlet extends ProfileServlet { // serial auth token into request if (authToken != null) { - Enumeration tokenNames = authToken.getElements(); + Enumeration<String> tokenNames = authToken.getElements(); while (tokenNames.hasMoreElements()) { - String tokenName = (String) tokenNames.nextElement(); + String tokenName = tokenNames.nextElement(); String[] tokenVals = authToken.getInStringArray(tokenName); if (tokenVals != null) { for (int i = 0; i < tokenVals.length; i++) { @@ -1286,9 +1287,9 @@ public class ProfileSubmitServlet extends ProfileServlet { // print request debug if (reqs[k] != null) { requestIds += " " + reqs[k].getRequestId().toString(); - Enumeration reqKeys = reqs[k].getExtDataKeys(); + Enumeration<String> reqKeys = reqs[k].getExtDataKeys(); while (reqKeys.hasMoreElements()) { - String reqKey = (String) reqKeys.nextElement(); + String reqKey = reqKeys.nextElement(); String reqVal = reqs[k].getExtDataInString(reqKey); if (reqVal != null) { CMS.debug("ProfileSubmitServlet: key=$request." + reqKey + "$ value=" + reqVal); @@ -1491,15 +1492,15 @@ public class ProfileSubmitServlet extends ProfileServlet { } else { CMS.debug("ProfileSubmitServlet xmlOutput: no certInfo found in request"); } - Enumeration outputIds = profile.getProfileOutputIds(); + Enumeration<String> outputIds = profile.getProfileOutputIds(); if (outputIds != null) { while (outputIds.hasMoreElements()) { - String outputId = (String) outputIds.nextElement(); + String outputId = outputIds.nextElement(); IProfileOutput profileOutput = profile.getProfileOutput(outputId); - Enumeration outputNames = profileOutput.getValueNames(); + Enumeration<String> outputNames = profileOutput.getValueNames(); if (outputNames != null) { while (outputNames.hasMoreElements()) { - String outputName = (String) outputNames.nextElement(); + String outputName = outputNames.nextElement(); if (!outputName.equals("b64_cert") && !outputName.equals("pkcs7")) continue; try { diff --git a/pki/base/common/src/com/netscape/cms/servlet/request/CertReqParser.java b/pki/base/common/src/com/netscape/cms/servlet/request/CertReqParser.java index 7fc353a0f..d8fc68a69 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/request/CertReqParser.java +++ b/pki/base/common/src/com/netscape/cms/servlet/request/CertReqParser.java @@ -127,7 +127,7 @@ public class CertReqParser extends ReqParser { arg.addStringValue("certExtsEnabled", "yes"); int saCounter = 0; - Enumeration enum1 = req.getExtDataKeys(); + Enumeration<String> enum1 = req.getExtDataKeys(); // gross hack String prefix = "record."; @@ -136,14 +136,14 @@ public class CertReqParser extends ReqParser { prefix = "header."; while (enum1.hasMoreElements()) { - String name = (String) enum1.nextElement(); + String name = enum1.nextElement(); if (mDetails) { // show all http parameters stored in request. if (name.equalsIgnoreCase(IRequest.HTTP_PARAMS)) { - Hashtable http_params = req.getExtDataInHashtable(name); + Hashtable<String, String> http_params = req.getExtDataInHashtable(name); // show certType specially - String certType = (String) http_params.get(IRequest.CERT_TYPE); + String certType = http_params.get(IRequest.CERT_TYPE); if (certType != null) { arg.addStringValue(IRequest.CERT_TYPE, certType); @@ -155,13 +155,13 @@ public class CertReqParser extends ReqParser { } // show all http parameters in request int counter = 0; - Enumeration elms = http_params.keys(); + Enumeration<String> elms = http_params.keys(); while (elms.hasMoreElements()) { String parami = IRequest.HTTP_PARAMS + LB + String.valueOf(counter++) + RB; // hack - String n = (String) elms.nextElement(); + String n = elms.nextElement(); String rawJS = "new Object;\n\r" + prefix + parami + ".name=\"" + CMSTemplate.escapeJavaScriptString(n) + "\";\n\r" + @@ -173,15 +173,15 @@ public class CertReqParser extends ReqParser { } } // show all http headers stored in request. else if (name.equalsIgnoreCase(IRequest.HTTP_HEADERS)) { - Hashtable http_hdrs = req.getExtDataInHashtable(name); - Enumeration elms = http_hdrs.keys(); + Hashtable<String, String> http_hdrs = req.getExtDataInHashtable(name); + Enumeration<String> elms = http_hdrs.keys(); int counter = 0; while (elms.hasMoreElements()) { String parami = IRequest.HTTP_HEADERS + LB + String.valueOf(counter++) + RB; // hack - String n = (String) elms.nextElement(); + String n = elms.nextElement(); String rawJS = "new Object;\n\r" + prefix + parami + ".name=\"" + CMSTemplate.escapeJavaScriptString(n) + "\";\n\r" + @@ -194,14 +194,14 @@ public class CertReqParser extends ReqParser { } // show all auth token stored in request. else if (name.equalsIgnoreCase(IRequest.AUTH_TOKEN)) { IAuthToken auth_token = req.getExtDataInAuthToken(name); - Enumeration elms = auth_token.getElements(); + Enumeration<String> elms = auth_token.getElements(); int counter = 0; while (elms.hasMoreElements()) { String parami = IRequest.AUTH_TOKEN + LB + String.valueOf(counter++) + RB; // hack - String n = (String) elms.nextElement(); + String n = elms.nextElement(); Object authTokenValue = auth_token.getInStringArray(n); if (authTokenValue == null) { authTokenValue = auth_token.getInString(n); @@ -274,7 +274,7 @@ public class CertReqParser extends ReqParser { } if (name.equalsIgnoreCase(IRequest.ERRORS)) { - Vector errorStrings = req.getExtDataInStringVector(name); + Vector<String> errorStrings = req.getExtDataInStringVector(name); if (errorStrings != null) { StringBuffer errInfo = new StringBuffer(); @@ -346,10 +346,10 @@ public class CertReqParser extends ReqParser { } catch (Exception e) { } if (extensions != null) { - Enumeration exts = extensions.getElements(); + Enumeration<Extension> exts = extensions.getAttributes(); while (exts.hasMoreElements()) { - Extension ext = (Extension) exts.nextElement(); + Extension ext = exts.nextElement(); // only know about ns cert type if (ext instanceof NSCertTypeExtension) { @@ -526,16 +526,16 @@ public class CertReqParser extends ReqParser { } } if (name.equalsIgnoreCase(IRequest.FINGERPRINTS) && mDetails) { - Hashtable fingerprints = + Hashtable<String, String> fingerprints = req.getExtDataInHashtable(IRequest.FINGERPRINTS); if (fingerprints != null) { String namesAndHashes = null; - Enumeration enumFingerprints = fingerprints.keys(); + Enumeration<String> enumFingerprints = fingerprints.keys(); while (enumFingerprints.hasMoreElements()) { - String hashname = (String) enumFingerprints.nextElement(); - String hashvalue = (String) fingerprints.get(hashname); + String hashname = enumFingerprints.nextElement(); + String hashvalue = fingerprints.get(hashname); byte[] fingerprint = CMS.AtoB(hashvalue); String ppFingerprint = pp.toHexString(fingerprint, 0); @@ -568,7 +568,8 @@ public class CertReqParser extends ReqParser { int j = 0; StringBuffer sb = new StringBuffer(); - for (Enumeration n = ((Vector) v).elements(); n.hasMoreElements(); j++) { + for (@SuppressWarnings("unchecked") + Enumeration<String> n = ((Vector<String>) v).elements(); n.hasMoreElements(); j++) { sb.append(";\n"); sb.append(valuename); sb.append(LB); @@ -678,7 +679,7 @@ public class CertReqParser extends ReqParser { } int saCounter = 0; - Enumeration enum1 = req.getExtDataKeys(); + Enumeration<String> enum1 = req.getExtDataKeys(); // gross hack String prefix = "record."; @@ -692,16 +693,16 @@ public class CertReqParser extends ReqParser { if (mDetails) { // show all http parameters stored in request. if (name.equalsIgnoreCase(IRequest.HTTP_PARAMS)) { - Hashtable http_params = req.getExtDataInHashtable(name); + Hashtable<String, String> http_params = req.getExtDataInHashtable(name); // show certType specially - String certType = (String) http_params.get(IRequest.CERT_TYPE); + String certType = http_params.get(IRequest.CERT_TYPE); if (certType != null) { arg.addStringValue(IRequest.CERT_TYPE, certType); } // show all http parameters in request int counter = 0; - Enumeration elms = http_params.keys(); + Enumeration<String> elms = http_params.keys(); while (elms.hasMoreElements()) { String parami = @@ -719,15 +720,15 @@ public class CertReqParser extends ReqParser { } } // show all http headers stored in request. else if (name.equalsIgnoreCase(IRequest.HTTP_HEADERS)) { - Hashtable http_hdrs = req.getExtDataInHashtable(name); - Enumeration elms = http_hdrs.keys(); + Hashtable<String, String> http_hdrs = req.getExtDataInHashtable(name); + Enumeration<String> elms = http_hdrs.keys(); int counter = 0; while (elms.hasMoreElements()) { String parami = IRequest.HTTP_HEADERS + LB + String.valueOf(counter++) + RB; // hack - String n = (String) elms.nextElement(); + String n = elms.nextElement(); String rawJS = "new Object;\n\r" + prefix + parami + ".name=\"" + CMSTemplate.escapeJavaScriptString(n) + "\";\n\r" + @@ -740,7 +741,7 @@ public class CertReqParser extends ReqParser { } // show all auth token stored in request. else if (name.equalsIgnoreCase(IRequest.AUTH_TOKEN)) { IAuthToken auth_token = req.getExtDataInAuthToken(name); - Enumeration elms = auth_token.getElements(); + Enumeration<String> elms = auth_token.getElements(); int counter = 0; while (elms.hasMoreElements()) { @@ -801,7 +802,7 @@ public class CertReqParser extends ReqParser { } if (name.equalsIgnoreCase(IRequest.ERRORS)) { - Vector errorsVector = req.getExtDataInStringVector(name); + Vector<String> errorsVector = req.getExtDataInStringVector(name); if (errorsVector != null) { StringBuffer errInfo = new StringBuffer(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/request/CheckRequest.java b/pki/base/common/src/com/netscape/cms/servlet/request/CheckRequest.java index b0a70ffc1..1d04952d1 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/request/CheckRequest.java +++ b/pki/base/common/src/com/netscape/cms/servlet/request/CheckRequest.java @@ -502,7 +502,8 @@ public class CheckRequest extends CMSServlet { ByteArrayInputStream issuer1 = new ByteArrayInputStream(((X500Name) cert.getIssuerDN()).getEncoded()); Name issuer = (Name) Name.getTemplate().decode(issuer1); - IssuerAndSerialNumber ias = new + IssuerAndSerialNumber ias = + new IssuerAndSerialNumber(issuer, new INTEGER(cert.getSerialNumber() .toString())); SignerIdentifier si = new @@ -511,8 +512,8 @@ public class CheckRequest extends CMSServlet { // SHA1 is the default digest Alg for now. DigestAlgorithm digestAlg = null; SignatureAlgorithm signAlg = null; - org.mozilla.jss.crypto.PrivateKey privKey = CryptoManager.getInstance() - .findPrivKeyByCert(x509cert); + org.mozilla.jss.crypto.PrivateKey privKey = + CryptoManager.getInstance().findPrivKeyByCert(x509cert); org.mozilla.jss.crypto.PrivateKey.Type keyType = privKey.getType(); if (keyType.equals(org.mozilla.jss.crypto.PrivateKey.RSA)) @@ -557,7 +558,8 @@ public class CheckRequest extends CMSServlet { for (int j = 0; j < certsInChain.length; j++) { ByteArrayInputStream is = new ByteArrayInputStream(certsInChain[j].getEncoded()); - org.mozilla.jss.pkix.cert.Certificate certJss = (org.mozilla.jss.pkix.cert.Certificate) + org.mozilla.jss.pkix.cert.Certificate certJss = + (org.mozilla.jss.pkix.cert.Certificate) org.mozilla.jss.pkix.cert.Certificate.getTemplate().decode(is); jsscerts.addElement(certJss); @@ -566,7 +568,8 @@ public class CheckRequest extends CMSServlet { SignedData fResponse = new SignedData(digestAlgs, ci, jsscerts, null, signInfos); - org.mozilla.jss.pkix.cms.ContentInfo fullResponse = new + org.mozilla.jss.pkix.cms.ContentInfo fullResponse = + new org.mozilla.jss.pkix.cms.ContentInfo( org.mozilla.jss.pkix.cms.ContentInfo.SIGNED_DATA, fResponse); ByteArrayOutputStream ostream = new diff --git a/pki/base/common/src/com/netscape/cms/servlet/request/ProcessCertReq.java b/pki/base/common/src/com/netscape/cms/servlet/request/ProcessCertReq.java index cbed8ae6b..cbe73c79f 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/request/ProcessCertReq.java +++ b/pki/base/common/src/com/netscape/cms/servlet/request/ProcessCertReq.java @@ -615,7 +615,7 @@ public class ProcessCertReq extends CMSServlet { String addExts = req.getParameter("addExts"); if (addExts != null && !addExts.trim().equals("")) { - Vector extsToBeAdded = new Vector(); + Vector<Extension> extsToBeAdded = new Vector<Extension>(); byte[] b = (byte[]) (com.netscape.osutil.OSUtil.AtoB(addExts)); @@ -683,7 +683,8 @@ public class ProcessCertReq extends CMSServlet { new BasicConstraintsExtension(isCA.booleanValue(), pathLen); extensions.delete(BasicConstraintsExtension.NAME); - extensions.set(BasicConstraintsExtension.NAME, (Extension) bcExt0); + extensions.set(BasicConstraintsExtension.NAME, + (Extension) bcExt0); alterationCounter++; } } @@ -753,22 +754,24 @@ public class ProcessCertReq extends CMSServlet { } catch (Exception e1) { } // create extension - PresenceServerExtension pseExt = new PresenceServerExtension(Critical, Version, - StreetAddress, TelephoneNumber, RFC822Name, IMID, HostName, PortNumber, - MaxUsers, ServiceLevel); + PresenceServerExtension pseExt = + new PresenceServerExtension(Critical, Version, StreetAddress, + TelephoneNumber, RFC822Name, IMID, HostName, PortNumber, MaxUsers, + ServiceLevel); extensions.set(pseExt.getExtensionId().toString(), pseExt); } if (mExtraAgentParams) { - Enumeration extraparams = req.getParameterNames(); + @SuppressWarnings("unchecked") + Enumeration<String> extraparams = req.getParameterNames(); int l = IRequest.AGENT_PARAMS.length() + 1; int ap_counter = 0; - Hashtable agentparamsargblock = new Hashtable(); + Hashtable<String, String> agentparamsargblock = new Hashtable<String, String>(); if (extraparams != null) { while (extraparams.hasMoreElements()) { - String s = (String) extraparams.nextElement(); + String s = extraparams.nextElement(); if (s.startsWith(IRequest.AGENT_PARAMS)) { String param_value = req.getParameter(s); @@ -933,7 +936,8 @@ public class ProcessCertReq extends CMSServlet { authMgr, "completed", issuedCerts[i].getSubjectDN(), - "cert issued serial number: 0x" + + "cert issued serial number: 0x" + + issuedCerts[i].getSerialNumber().toString(16) + " time: " + (endTime - startTime) } ); diff --git a/pki/base/common/src/com/netscape/cms/servlet/tks/TokenServlet.java b/pki/base/common/src/com/netscape/cms/servlet/tks/TokenServlet.java index 715a2baf8..fc45395e9 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/tks/TokenServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/tks/TokenServlet.java @@ -396,10 +396,11 @@ public class TokenServlet extends CMSServlet { try { - byte macKeyArray[] = com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." - + keySet + ".mac_key")); - CMS.debug("TokenServlet about to try ComputeSessionKey selectedToken=" + selectedToken - + " keyNickName=" + keyNickName); + byte macKeyArray[] = + com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + + keySet + ".mac_key")); + CMS.debug("TokenServlet about to try ComputeSessionKey selectedToken=" + + selectedToken + " keyNickName=" + keyNickName); session_key = SessionKey.ComputeSessionKey( selectedToken, keyNickName, card_challenge, host_challenge, keyInfo, CUID, macKeyArray, useSoftToken_s, keySet, transportKeyName); @@ -410,8 +411,9 @@ public class TokenServlet extends CMSServlet { } - byte encKeyArray[] = com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." - + keySet + ".auth_key")); + byte encKeyArray[] = + com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + + keySet + ".auth_key")); enc_session_key = SessionKey.ComputeEncSessionKey( selectedToken, keyNickName, card_challenge, host_challenge, keyInfo, CUID, encKeyArray, useSoftToken_s, keySet); @@ -433,8 +435,9 @@ public class TokenServlet extends CMSServlet { **/ CMS.debug("TokenServlet: calling ComputeKekKey"); - byte kekKeyArray[] = com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." - + keySet + ".kek_key")); + byte kekKeyArray[] = + com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + + keySet + ".kek_key")); kek_key = SessionKey.ComputeKekKey( selectedToken, keyNickName, card_challenge, @@ -545,8 +548,9 @@ public class TokenServlet extends CMSServlet { } // if (serversideKeygen == true) - byte authKeyArray[] = com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." - + keySet + ".auth_key")); + byte authKeyArray[] = + com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + + keySet + ".auth_key")); host_cryptogram = SessionKey.ComputeCryptogram( selectedToken, keyNickName, card_challenge, host_challenge, keyInfo, CUID, 0, authKeyArray, useSoftToken_s, keySet); @@ -869,8 +873,8 @@ public class TokenServlet extends CMSServlet { " oldKeyNickName=" + oldKeyNickName + " newKeyNickName=" + newKeyNickName); - byte kekKeyArray[] = com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + keySet - + ".kek_key")); + byte kekKeyArray[] = + com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + keySet + ".kek_key")); KeySetData = SessionKey.DiversifyKey(oldSelectedToken, newSelectedToken, oldKeyNickName, newKeyNickName, rnewKeyInfo, CUID, kekKeyArray, useSoftToken_s, keySet); @@ -1074,8 +1078,8 @@ public class TokenServlet extends CMSServlet { keyNickName = st.nextToken(); } - byte kekKeyArray[] = com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + keySet - + ".kek_key")); + byte kekKeyArray[] = + com.netscape.cmsutil.util.Utils.SpecialDecode(sconfig.getString("tks." + keySet + ".kek_key")); encryptedData = SessionKey.EncryptData( selectedToken, keyNickName, data, keyInfo, CUID, kekKeyArray, useSoftToken_s, keySet); diff --git a/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java b/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java index 7f85b6040..384b4cd67 100644 --- a/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java +++ b/pki/base/common/src/com/netscape/cmscore/apps/CMSEngine.java @@ -118,6 +118,7 @@ import com.netscape.certsrv.ra.IRegistrationAuthority; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.IRequestQueue; import com.netscape.certsrv.request.RequestStatus; +import com.netscape.cms.servlet.common.CMSRequest; import com.netscape.cms.servlet.csadmin.LDAPSecurityDomainSessionTable; import com.netscape.cms.servlet.csadmin.SecurityDomainSessionTable; import com.netscape.cms.servlet.csadmin.SessionTimer; @@ -1521,7 +1522,7 @@ public class CMSEngine implements ICMSEngine { } public void terminateRequests() { - Enumeration e = CommandQueue.mCommandQueue.keys(); + Enumeration<CMSRequest> e = CommandQueue.mCommandQueue.keys(); while (e.hasMoreElements()) { Object thisRequest = e.nextElement(); @@ -1840,10 +1841,10 @@ public class CMSEngine implements ICMSEngine { RequestStatus status = checkRevReq.getRequestStatus(); if (status == RequestStatus.COMPLETE) { - Enumeration enum1 = checkRevReq.getExtDataKeys(); + Enumeration<String> enum1 = checkRevReq.getExtDataKeys(); while (enum1.hasMoreElements()) { - String name = (String) enum1.nextElement(); + String name = enum1.nextElement(); if (name.equals(IRequest.REVOKED_CERTS)) { revoked = true; @@ -1920,7 +1921,7 @@ class WarningListener implements ILogEventListener { * and from source "source". If the parameter is omitted. All entries * are sent back. */ - public synchronized NameValuePairs retrieveLogContent(Hashtable req) throws ServletException, + public synchronized NameValuePairs retrieveLogContent(Hashtable<String, String> req) throws ServletException, IOException, EBaseException { return null; } @@ -1928,7 +1929,7 @@ class WarningListener implements ILogEventListener { /** * Retrieve log file list. */ - public synchronized NameValuePairs retrieveLogList(Hashtable req) throws ServletException, + public synchronized NameValuePairs retrieveLogList(Hashtable<String, String> req) throws ServletException, IOException, EBaseException { return null; } @@ -1941,14 +1942,14 @@ class WarningListener implements ILogEventListener { return "ConsoleLog"; } - public Vector getDefaultParams() { - Vector v = new Vector(); + public Vector<String> getDefaultParams() { + Vector<String> v = new Vector<String>(); return v; } - public Vector getInstanceParams() { - Vector v = new Vector(); + public Vector<String> getInstanceParams() { + Vector<String> v = new Vector<String>(); return v; } diff --git a/pki/base/common/src/com/netscape/cmscore/apps/Setup.java b/pki/base/common/src/com/netscape/cmscore/apps/Setup.java index 5ce0c6d2d..3486ec40e 100644 --- a/pki/base/common/src/com/netscape/cmscore/apps/Setup.java +++ b/pki/base/common/src/com/netscape/cmscore/apps/Setup.java @@ -47,7 +47,7 @@ public class Setup { { "auths.impl.PortalEnroll.class", "com.netscape.cms.authentication.PortalEnroll" }, { "auths.revocationChecking.bufferSize", "50" }, - }; + }; public static void installAuthImpls(IConfigStore c) throws EBaseException { @@ -331,12 +331,18 @@ public class Setup { { "ca.publish.mapper.impl.LdapSubjAttrMap.class", "com.netscape.cms.publish.LdapCertSubjMap" }, { "ca.publish.mapper.impl.LdapDNExactMap.class", "com.netscape.cms.publish.LdapCertExactMap" }, //{"ca.publish.mapper.impl.LdapCrlIssuerCompsMap.class","com.netscape.cms.publish.LdapCrlIssuerCompsMap"}, - { "ca.publish.publisher.impl.LdapUserCertPublisher.class", "com.netscape.cms.publish.LdapUserCertPublisher" }, - { "ca.publish.publisher.impl.LdapCaCertPublisher.class", "com.netscape.cms.publish.LdapCaCertPublisher" }, + { + "ca.publish.publisher.impl.LdapUserCertPublisher.class", + "com.netscape.cms.publish.LdapUserCertPublisher" }, + { + "ca.publish.publisher.impl.LdapCaCertPublisher.class", + "com.netscape.cms.publish.LdapCaCertPublisher" }, { "ca.publish.publisher.impl.LdapCrlPublisher.class", "com.netscape.cms.publish.LdapCrlPublisher" }, - { "ca.publish.publisher.impl.FileBasedPublisher.class", "com.netscape.cms.publish.FileBasedPublisher" }, + { + "ca.publish.publisher.impl.FileBasedPublisher.class", + "com.netscape.cms.publish.FileBasedPublisher" }, { "ca.publish.publisher.impl.OCSPPublisher.class", "com.netscape.cms.publish.OCSPPublisher" }, { "ca.publish.rule.impl.Rule.class", "com.netscape.cmscore.ldap.LdapRule" }, - }; + }; } 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 ad5dd55ee..c66d8a71d 100644 --- a/pki/base/common/src/com/netscape/cmscore/cert/CertUtils.java +++ b/pki/base/common/src/com/netscape/cmscore/cert/CertUtils.java @@ -390,8 +390,8 @@ public class CertUtils { sb.append("\n"); sb.append("Encryption Certificate Serial No: " + encryptionCert.getSerialNumber().toString(16).toUpperCase()); sb.append("\n"); - sb.append("Validity: From: " + signingCert.getNotBefore().toString() + " To: " - + signingCert.getNotAfter().toString()); + sb.append("Validity: From: " + + signingCert.getNotBefore().toString() + " To: " + signingCert.getNotAfter().toString()); sb.append("\n"); return new String(sb); } @@ -919,8 +919,8 @@ public class CertUtils { } String certusage = config.getString(subsysType + ".cert." + tag + ".certusage", ""); if (certusage.equals("")) { - CMS.debug("CertUtils: verifySystemCertByTag() certusage for cert tag " + tag - + " undefined in CS.cfg, getting current certificate usage"); + CMS.debug("CertUtils: verifySystemCertByTag() certusage for cert tag " + + tag + " undefined in CS.cfg, getting current certificate usage"); } r = verifySystemCertByNickname(nickname, certusage); if (r == true) { @@ -1032,8 +1032,8 @@ public class CertUtils { } String certlist = config.getString(subsysType + ".cert.list", ""); if (certlist.equals("")) { - CMS.debug("CertUtils: verifySystemCerts() " + subsysType - + ".cert.list not defined in CS.cfg. System certificates verification not done"); + CMS.debug("CertUtils: verifySystemCerts() " + + subsysType + ".cert.list not defined in CS.cfg. System certificates verification not done"); auditMessage = CMS.getLogMessage( LOGGING_SIGNED_AUDIT_CIMC_CERT_VERIFICATION, ILogger.SYSTEM_UID, diff --git a/pki/base/common/src/com/netscape/cmscore/cert/CrlCachePrettyPrint.java b/pki/base/common/src/com/netscape/cmscore/cert/CrlCachePrettyPrint.java index 42ee8f7fd..6d838b70d 100644 --- a/pki/base/common/src/com/netscape/cmscore/cert/CrlCachePrettyPrint.java +++ b/pki/base/common/src/com/netscape/cmscore/cert/CrlCachePrettyPrint.java @@ -26,7 +26,7 @@ import java.util.TimeZone; import netscape.security.x509.CRLExtensions; import netscape.security.x509.Extension; -import netscape.security.x509.RevokedCertImpl; +import netscape.security.x509.RevokedCertificate; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.ICRLPrettyPrint; @@ -181,14 +181,15 @@ public class CrlCachePrettyPrint implements ICRLPrettyPrint { } sb.append("\n"); - Set revokedCerts = mIP.getRevokedCertificates((int) (pageStart - 1), (int) upperLimit); + Set<RevokedCertificate> revokedCerts = + mIP.getRevokedCertificates((int) (pageStart - 1), (int) upperLimit); if (revokedCerts != null) { - Iterator i = revokedCerts.iterator(); + Iterator<RevokedCertificate> i = revokedCerts.iterator(); long l = 1; while ((i.hasNext()) && ((crlSize == 0) || (upperLimit - pageStart + 1 >= l))) { - RevokedCertImpl revokedCert = (RevokedCertImpl) i.next(); + RevokedCertificate revokedCert = i.next(); if ((crlSize == 0) || (upperLimit - pageStart + 1 >= l)) { sb.append(pp.indent(16) + resource.getString( diff --git a/pki/base/common/src/com/netscape/cmscore/cert/OidLoaderSubsystem.java b/pki/base/common/src/com/netscape/cmscore/cert/OidLoaderSubsystem.java index 81d0da20e..dfd7dbab8 100644 --- a/pki/base/common/src/com/netscape/cmscore/cert/OidLoaderSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/cert/OidLoaderSubsystem.java @@ -133,7 +133,7 @@ public class OidLoaderSubsystem implements ISubsystem { } mConfig = config; - Enumeration names = mConfig.getSubStoreNames(); + Enumeration<String> names = mConfig.getSubStoreNames(); // load static (build-in) extensions diff --git a/pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java b/pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java index d32cf283c..af72fee45 100644 --- a/pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java +++ b/pki/base/common/src/com/netscape/cmscore/connector/HttpPKIMessage.java @@ -69,8 +69,8 @@ public class HttpPKIMessage implements IHttpPKIMessage { reqId = r.getRequestId().toString(); reqStatus = r.getRequestStatus().toString(); - CMS.debug("HttpPKIMessage.fromRequest: requestId=" + r.getRequestId().toString() + " requestStatus=" - + reqStatus + " instance=" + r); + CMS.debug("HttpPKIMessage.fromRequest: requestId=" + + r.getRequestId().toString() + " requestStatus=" + reqStatus + " instance=" + r); String attrs[] = RequestTransfer.getTransferAttributes(r); int len = attrs.length; @@ -114,7 +114,7 @@ public class HttpPKIMessage implements IHttpPKIMessage { if (value instanceof String) { r.setExtData(key, (String) value); } else if (value instanceof Hashtable) { - r.setExtData(key, (Hashtable) value); + r.setExtData(key, (Hashtable<String, String>) value); } else { CMS.debug("HttpPKIMessage.toRequest(): key: " + key + " has unexpected type " + value.getClass().toString()); 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 806ca57c3..5898e3228 100644 --- a/pki/base/common/src/com/netscape/cmscore/connector/LocalConnector.java +++ b/pki/base/common/src/com/netscape/cmscore/connector/LocalConnector.java @@ -59,8 +59,9 @@ public class LocalConnector implements IConnector { */ public boolean send(IRequest r) throws EBaseException { if (Debug.ON) { - Debug.print("send request type " + r.getRequestType() + " status=" + r.getRequestStatus() + " to " - + mDest.getId() + " id=" + r.getRequestId() + "\n"); + Debug.print("send request type " + + r.getRequestType() + " status=" + r.getRequestStatus() + " to " + mDest.getId() + " id=" + + r.getRequestId() + "\n"); } CMS.debug("send request type " + r.getRequestType() + " to " + mDest.getId()); 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 f80889d91..9ee5be524 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/CertificateRepository.java @@ -105,11 +105,11 @@ public class CertificateRepository extends Repository public BigInteger getLastSerialNumberInRange(BigInteger serial_low_bound, BigInteger serial_upper_bound) throws EBaseException { - CMS.debug("CertificateRepository: in getLastSerialNumberInRange: low " + serial_low_bound + " high " - + serial_upper_bound); + CMS.debug("CertificateRepository: in getLastSerialNumberInRange: low " + + serial_low_bound + " high " + serial_upper_bound); - if (serial_low_bound == null || serial_upper_bound == null - || serial_low_bound.compareTo(serial_upper_bound) >= 0) { + if (serial_low_bound == null + || serial_upper_bound == null || serial_low_bound.compareTo(serial_upper_bound) >= 0) { return null; } @@ -118,8 +118,8 @@ public class CertificateRepository extends Repository String[] attrs = null; - ICertRecordList recList = findCertRecordsInList(ldapfilter, attrs, serial_upper_bound.toString(10), "serialno", - 5 * -1); + ICertRecordList recList = + findCertRecordsInList(ldapfilter, attrs, serial_upper_bound.toString(10), "serialno", 5 * -1); int size = recList.getSize(); 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 b9cb2bdf2..269a94c9d 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/KeyRepository.java @@ -449,19 +449,20 @@ public class KeyRepository extends Repository implements IKeyRepository { public BigInteger getLastSerialNumberInRange(BigInteger serial_low_bound, BigInteger serial_upper_bound) throws EBaseException { - CMS.debug("KeyRepository: in getLastSerialNumberInRange: low " + serial_low_bound + " high " - + serial_upper_bound); + CMS.debug("KeyRepository: in getLastSerialNumberInRange: low " + + serial_low_bound + " high " + serial_upper_bound); - if (serial_low_bound == null || serial_upper_bound == null - || serial_low_bound.compareTo(serial_upper_bound) >= 0) { + if (serial_low_bound == null + || serial_upper_bound == null || serial_low_bound.compareTo(serial_upper_bound) >= 0) { return null; } String ldapfilter = "(" + "serialno" + "=*" + ")"; String[] attrs = null; - KeyRecordList recList = (KeyRecordList) findKeyRecordsInList(ldapfilter, attrs, - serial_upper_bound.toString(10), "serialno", 5 * -1); + KeyRecordList recList = + (KeyRecordList) findKeyRecordsInList(ldapfilter, attrs, serial_upper_bound.toString(10), "serialno", + 5 * -1); int size = recList.getSize(); diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/ReplicaIDRepository.java b/pki/base/common/src/com/netscape/cmscore/dbs/ReplicaIDRepository.java index 87f962faa..46ab07385 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/ReplicaIDRepository.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/ReplicaIDRepository.java @@ -54,10 +54,10 @@ public class ReplicaIDRepository extends Repository */ public BigInteger getLastSerialNumberInRange(BigInteger serial_low_bound, BigInteger serial_upper_bound) throws EBaseException { - CMS.debug("ReplicaIDReposoitory: in getLastSerialNumberInRange: low " + serial_low_bound + " high " - + serial_upper_bound); - if (serial_low_bound == null || serial_upper_bound == null - || serial_low_bound.compareTo(serial_upper_bound) >= 0) { + CMS.debug("ReplicaIDReposoitory: in getLastSerialNumberInRange: low " + + serial_low_bound + " high " + serial_upper_bound); + if (serial_low_bound == null + || serial_upper_bound == null || serial_low_bound.compareTo(serial_upper_bound) >= 0) { return null; } BigInteger ret = new BigInteger(getMinSerial()); diff --git a/pki/base/common/src/com/netscape/cmscore/dbs/RevocationInfoMapper.java b/pki/base/common/src/com/netscape/cmscore/dbs/RevocationInfoMapper.java index 06ea075e8..7cf39dcef 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/RevocationInfoMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/RevocationInfoMapper.java @@ -46,7 +46,7 @@ import com.netscape.cmscore.util.Debug; */ public class RevocationInfoMapper implements IDBAttrMapper { - protected static Vector mNames = new Vector(); + protected static Vector<String> mNames = new Vector<String>(); static { mNames.addElement(CertDBSchema.LDAP_ATTR_REVO_INFO); } @@ -57,7 +57,7 @@ public class RevocationInfoMapper implements IDBAttrMapper { public RevocationInfoMapper() { } - public Enumeration getSupportedLDAPAttributeNames() { + public Enumeration<String> getSupportedLDAPAttributeNames() { return mNames.elements(); } @@ -74,10 +74,10 @@ public class RevocationInfoMapper implements IDBAttrMapper { CRLExtensions exts = info.getCRLEntryExtensions(); // CRLExtension's DER encoding and decoding does not work! // That is why we need to do our own serialization. - Enumeration e = exts.getElements(); + Enumeration<Extension> e = exts.getElements(); while (e.hasMoreElements()) { - Extension ext = (Extension) e.nextElement(); + Extension ext = e.nextElement(); if (ext instanceof CRLReasonExtension) { RevocationReason reason = 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 ddbc2cd07..856a8c591 100644 --- a/pki/base/common/src/com/netscape/cmscore/dbs/X509CertImplMapper.java +++ b/pki/base/common/src/com/netscape/cmscore/dbs/X509CertImplMapper.java @@ -54,8 +54,8 @@ public class X509CertImplMapper implements IDBAttrMapper { public X509CertImplMapper() { } - public Enumeration getSupportedLDAPAttributeNames() { - Vector v = new Vector(); + public Enumeration<String> getSupportedLDAPAttributeNames() { + Vector<String> v = new Vector<String>(); v.addElement(CertDBSchema.LDAP_ATTR_NOT_BEFORE); v.addElement(CertDBSchema.LDAP_ATTR_NOT_AFTER); @@ -90,11 +90,11 @@ public class X509CertImplMapper implements IDBAttrMapper { cert.getSubjectDN().getName())); attrs.add(new LDAPAttribute(CertDBSchema.LDAP_ATTR_PUBLIC_KEY_DATA, cert.getPublicKey().getEncoded())); // make extension searchable - Set nonCritSet = cert.getNonCriticalExtensionOIDs(); + Set<String> nonCritSet = cert.getNonCriticalExtensionOIDs(); if (nonCritSet != null) { - for (Iterator i = nonCritSet.iterator(); i.hasNext();) { - String oid = (String) i.next(); + for (Iterator<String> i = nonCritSet.iterator(); i.hasNext();) { + String oid = i.next(); if (oid.equals("2.16.840.1.113730.1.1")) { String extVal = getCertTypeExtensionInfo(cert); @@ -113,11 +113,11 @@ public class X509CertImplMapper implements IDBAttrMapper { CertDBSchema.LDAP_ATTR_EXTENSION, oid)); } } - Set critSet = cert.getCriticalExtensionOIDs(); + Set<String> critSet = cert.getCriticalExtensionOIDs(); if (critSet != null) { - for (Iterator i = critSet.iterator(); i.hasNext();) { - String oid = (String) i.next(); + for (Iterator<String> i = critSet.iterator(); i.hasNext();) { + String oid = i.next(); if (oid.equals("2.16.840.1.113730.1.1")) { String extVal = getCertTypeExtensionInfo(cert); diff --git a/pki/base/common/src/com/netscape/cmscore/extensions/CMSExtensionsMap.java b/pki/base/common/src/com/netscape/cmscore/extensions/CMSExtensionsMap.java index f03b81f3d..213772882 100644 --- a/pki/base/common/src/com/netscape/cmscore/extensions/CMSExtensionsMap.java +++ b/pki/base/common/src/com/netscape/cmscore/extensions/CMSExtensionsMap.java @@ -47,8 +47,8 @@ public class CMSExtensionsMap implements ISubsystem { private static final String PROP_CLASS = "class"; - private Hashtable mName2Ext = new Hashtable(); - private Hashtable mOID2Ext = new Hashtable(); + private Hashtable<String, ICMSExtension> mName2Ext = new Hashtable<String, ICMSExtension>(); + private Hashtable<String, ICMSExtension> mOID2Ext = new Hashtable<String, ICMSExtension>(); private ISubsystem mOwner = null; private IConfigStore mConfig = null; @@ -62,7 +62,7 @@ public class CMSExtensionsMap implements ISubsystem { mOwner = owner; mConfig = config; - Enumeration sstores = mConfig.getSubStoreNames(); + Enumeration<String> sstores = mConfig.getSubStoreNames(); while (sstores.hasMoreElements()) { String name = (String) sstores.nextElement(); diff --git a/pki/base/common/src/com/netscape/cmscore/jobs/JobCron.java b/pki/base/common/src/com/netscape/cmscore/jobs/JobCron.java index 0fca2ba9c..164c1250e 100644 --- a/pki/base/common/src/com/netscape/cmscore/jobs/JobCron.java +++ b/pki/base/common/src/com/netscape/cmscore/jobs/JobCron.java @@ -135,16 +135,16 @@ public class JobCron implements IJobCron { * the '*' one will remain empty (no elements) */ // day-of-week - if ((sDayOMonth != null) && sDayOMonth.equals(CronItem.ALL) && (sDayOWeek != null) - && !sDayOWeek.equals(CronItem.ALL)) { + if ((sDayOMonth != null) + && sDayOMonth.equals(CronItem.ALL) && (sDayOWeek != null) && !sDayOWeek.equals(CronItem.ALL)) { try { cDOW.set(sDayOWeek); } catch (EBaseException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_JOBS_INVALID_DAY_OF_WEEK", e.toString())); throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_JOB_CRON")); } - } else if ((sDayOMonth != null) && !sDayOMonth.equals(CronItem.ALL) && (sDayOWeek != null) - && sDayOWeek.equals(CronItem.ALL)) { + } else if ((sDayOMonth != null) + && !sDayOMonth.equals(CronItem.ALL) && (sDayOWeek != null) && sDayOWeek.equals(CronItem.ALL)) { try { cDOM.set(sDayOMonth); } catch (EBaseException e) { diff --git a/pki/base/common/src/com/netscape/cmscore/ldap/LdapRule.java b/pki/base/common/src/com/netscape/cmscore/ldap/LdapRule.java index f3d2bd17f..0f0c3a3b9 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldap/LdapRule.java +++ b/pki/base/common/src/com/netscape/cmscore/ldap/LdapRule.java @@ -83,13 +83,14 @@ public class LdapRule implements ILdapRule, IExtendedPluginInfo { } epi_params = new String[] { - "type;choice(cacert,crl, certs);The publishing object type", - "mapper;choice(" + map + ");Use the mapper to find the ldap dn \nto publish the certificate or crl", - "publisher;choice(" + publish - + ");Use the publisher to publish the certificate or crl a directory etc", - "enable;boolean;Enable this publishing rule", - "predicate;string;Filter describing when this publishing rule shoule be used" - }; + "type;choice(cacert,crl, certs);The publishing object type", + "mapper;choice(" + + map + ");Use the mapper to find the ldap dn \nto publish the certificate or crl", + "publisher;choice(" + + publish + ");Use the publisher to publish the certificate or crl a directory etc", + "enable;boolean;Enable this publishing rule", + "predicate;string;Filter describing when this publishing rule shoule be used" + }; // Read the predicate expression if any associated // with the rule @@ -115,12 +116,12 @@ public class LdapRule implements ILdapRule, IExtendedPluginInfo { mConfig = config; epi_params = new String[] { - "type;choice(cacert, crl, certs);The publishing object type", - "mapper;choice(null,LdapUserCertMap,LdapServerCertMap,LdapCrlMap,LdapCaCertMap);Use the mapper to find the ldap dn to publish the certificate or crl", - "publisher;choice(LdapUserCertPublisher,LdapServerCertPublisher,LdapCrlPublisher,LdapCaCertPublisher);Use the publisher to publish the certificate or crl a directory etc", - "enable;boolean;", - "predicate;string;" - }; + "type;choice(cacert, crl, certs);The publishing object type", + "mapper;choice(null,LdapUserCertMap,LdapServerCertMap,LdapCrlMap,LdapCaCertMap);Use the mapper to find the ldap dn to publish the certificate or crl", + "publisher;choice(LdapUserCertPublisher,LdapServerCertPublisher,LdapCrlPublisher,LdapCaCertPublisher);Use the publisher to publish the certificate or crl a directory etc", + "enable;boolean;", + "predicate;string;" + }; // Read the predicate expression if any associated // with the rule diff --git a/pki/base/common/src/com/netscape/cmscore/logging/LogSubsystem.java b/pki/base/common/src/com/netscape/cmscore/logging/LogSubsystem.java index 83cd0c99c..8ac304f8c 100644 --- a/pki/base/common/src/com/netscape/cmscore/logging/LogSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/logging/LogSubsystem.java @@ -139,8 +139,8 @@ public class LogSubsystem implements ILogSubsystem { throw new EBaseException(insName + ":Failed to instantiate class " + className); } catch (Throwable e) { e.printStackTrace(); - throw new EBaseException(insName + ":Failed to instantiate class " + className + " error: " - + e.getMessage()); + throw new EBaseException(insName + + ":Failed to instantiate class " + className + " error: " + e.getMessage()); } if (insName == null) { diff --git a/pki/base/common/src/com/netscape/cmscore/notification/ReqCertSANameEmailResolver.java b/pki/base/common/src/com/netscape/cmscore/notification/ReqCertSANameEmailResolver.java index 5bedafbe0..68556dfc0 100644 --- a/pki/base/common/src/com/netscape/cmscore/notification/ReqCertSANameEmailResolver.java +++ b/pki/base/common/src/com/netscape/cmscore/notification/ReqCertSANameEmailResolver.java @@ -24,7 +24,6 @@ import java.security.cert.X509Certificate; import java.util.Enumeration; import netscape.security.x509.CertificateExtensions; -import netscape.security.x509.GeneralName; import netscape.security.x509.GeneralNameInterface; import netscape.security.x509.GeneralNames; import netscape.security.x509.RevokedCertImpl; @@ -187,18 +186,15 @@ public class ReqCertSANameEmailResolver implements IEmailResolver { GeneralNames gn = (GeneralNames) ext.get(SubjectAlternativeNameExtension.SUBJECT_NAME); - Enumeration e = gn.elements(); + Enumeration<GeneralNameInterface> e = gn.elements(); while (e.hasMoreElements()) { - Object g = (Object) e.nextElement(); - - GeneralName gni = - (GeneralName) g; + GeneralNameInterface gni = e.nextElement(); if (gni.getType() == GeneralNameInterface.NAME_RFC822) { CMS.debug("got an subjectalternatename email"); - String nameString = g.toString(); + String nameString = gni.toString(); // "RFC822Name: " + name mEmail = diff --git a/pki/base/common/src/com/netscape/cmscore/registry/PluginRegistry.java b/pki/base/common/src/com/netscape/cmscore/registry/PluginRegistry.java index 936a466cc..42bb3e68e 100644 --- a/pki/base/common/src/com/netscape/cmscore/registry/PluginRegistry.java +++ b/pki/base/common/src/com/netscape/cmscore/registry/PluginRegistry.java @@ -42,7 +42,8 @@ public class PluginRegistry implements IPluginRegistry { private IConfigStore mConfig = null; private IConfigStore mFileConfig = null; private ISubsystem mOwner = null; - private Hashtable<String, Hashtable<String, IPluginInfo>> mTypes = new Hashtable<String, Hashtable<String, IPluginInfo>>(); + private Hashtable<String, Hashtable<String, IPluginInfo>> mTypes = + new Hashtable<String, Hashtable<String, IPluginInfo>>(); public PluginRegistry() { } 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 bd47f3ce6..82739debf 100644 --- a/pki/base/common/src/com/netscape/cmscore/request/ARequestQueue.java +++ b/pki/base/common/src/com/netscape/cmscore/request/ARequestQueue.java @@ -30,6 +30,7 @@ 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; @@ -168,7 +169,7 @@ public abstract class ARequestQueue * @return * an Enumeration that generates RequestId objects. */ - abstract protected Enumeration getRawList(); + abstract protected Enumeration<RequestId> getRawList(); /** * protected access for setting the current state of a request. @@ -435,7 +436,7 @@ public abstract class ARequestQueue throw new EBaseException("Missing agent information"); aas.addApproval(agentName); - r.setExtData(AgentApprovals.class.getName(), aas.toStringVector()); + r.setExtData(AgentApprovals.class.getName(), (Vector<?>) aas.toStringVector()); PolicyResult pr = mPolicy.apply(r); @@ -878,7 +879,9 @@ class Request if (!((key instanceof String) && isValidExtDataKey((String) key))) { return false; } - + /* + * TODO should the Value type be String? + */ Object value = hash.get(key); if (!(value instanceof String)) { return false; @@ -900,12 +903,13 @@ class Request return true; } - public boolean setExtData(String key, Hashtable value) { + @SuppressWarnings("unchecked") + public boolean setExtData(String key, Hashtable<String, String> value) { if (!(isValidExtDataKey(key) && isValidExtDataHashtableValue(value))) { return false; } - mExtData.put(key, new ExtDataHashtable(value)); + mExtData.put(key, new ExtDataHashtable<String>(value)); return true; } @@ -924,7 +928,7 @@ class Request return (String) value; } - public Hashtable getExtDataInHashtable(String key) { + public Hashtable<String, String> getExtDataInHashtable(String key) { Object value = mExtData.get(key); if (value == null) { return null; @@ -932,10 +936,10 @@ class Request if (!(value instanceof Hashtable)) { return null; } - return new ExtDataHashtable((Hashtable) value); + return new ExtDataHashtable<String>((Hashtable<String, String>) value); } - public Enumeration getExtDataKeys() { + public Enumeration<String> getExtDataKeys() { return mExtData.keys(); } @@ -954,9 +958,10 @@ class Request return false; } - Hashtable existingValue = (Hashtable) mExtData.get(key); + @SuppressWarnings("unchecked") + Hashtable<String, String> existingValue = (Hashtable<String, String>) mExtData.get(key); if (existingValue == null) { - existingValue = new ExtDataHashtable(); + existingValue = new ExtDataHashtable<String>(); mExtData.put(key, existingValue); } existingValue.put(subkey, value); @@ -964,11 +969,11 @@ class Request } public String getExtDataInString(String key, String subkey) { - Hashtable value = getExtDataInHashtable(key); + Hashtable<String, String> value = getExtDataInHashtable(key); if (value == null) { return null; } - return (String) value.get(subkey); + return value.get(subkey); } public boolean setExtData(String key, Integer value) { @@ -1226,7 +1231,7 @@ class Request return certArray; } - public boolean setExtData(String key, Vector stringVector) { + public boolean setExtData(String key, Vector<?> stringVector) { String[] stringArray; if (stringVector == null) { return false; @@ -1239,12 +1244,12 @@ class Request return setExtData(key, stringArray); } - public Vector getExtDataInStringVector(String key) { + public Vector<String> getExtDataInStringVector(String key) { String[] stringArray = getExtDataInStringArray(key); if (stringArray == null) { return null; } - return new Vector(Arrays.asList(stringArray)); + return new Vector<String>(Arrays.asList(stringArray)); } public boolean getExtDataInBoolean(String key, boolean defVal) { @@ -1265,11 +1270,11 @@ class Request if (data == null) { return false; } - Hashtable hash = new Hashtable(); - Enumeration keys = data.getElements(); + Hashtable<String, String> hash = new Hashtable<String, String>(); + Enumeration<String> keys = data.getElements(); while (keys.hasMoreElements()) { try { - String authKey = (String) keys.nextElement(); + String authKey = keys.nextElement(); hash.put(authKey, data.getInString(authKey)); } catch (ClassCastException e) { return false; @@ -1279,12 +1284,12 @@ class Request } public IAuthToken getExtDataInAuthToken(String key) { - Hashtable hash = getExtDataInHashtable(key); + Hashtable<String, String> hash = getExtDataInHashtable(key); if (hash == null) { return null; } AuthToken authToken = new AuthToken(null); - Enumeration keys = hash.keys(); + Enumeration<String> keys = hash.keys(); while (keys.hasMoreElements()) { try { String hashKey = (String) keys.nextElement(); @@ -1360,7 +1365,7 @@ class Request if (values == null) { return false; } - Hashtable hashValue = new Hashtable(); + Hashtable<String, String> hashValue = new Hashtable<String, String>(); for (int index = 0; index < values.length; index++) { hashValue.put(Integer.toString(index), values[index]); } @@ -1370,7 +1375,7 @@ class Request public String[] getExtDataInStringArray(String key) { int index; - Hashtable hashValue = getExtDataInHashtable(key); + Hashtable<String, String> hashValue = getExtDataInHashtable(key); if (hashValue == null) { String s = getExtDataInString(key); if (s == null) { @@ -1380,10 +1385,10 @@ class Request return sa; } } - Set arrayKeys = hashValue.keySet(); - Vector listValue = new Vector(arrayKeys.size()); - for (Iterator iter = arrayKeys.iterator(); iter.hasNext();) { - String arrayKey = (String) iter.next(); + Set<String> arrayKeys = hashValue.keySet(); + Vector<Object> listValue = new Vector<Object>(arrayKeys.size()); + for (Iterator<String> iter = arrayKeys.iterator(); iter.hasNext();) { + String arrayKey = iter.next(); try { index = Integer.parseInt(arrayKey); } catch (NumberFormatException e) { @@ -1395,7 +1400,7 @@ class Request listValue.set(index, hashValue.get(arrayKey)); } - return (String[]) listValue.toArray(new String[0]); + return listValue.toArray(new String[0]); } public IAttrSet asIAttrSet() { @@ -1415,7 +1420,7 @@ class Request protected String mOwner; protected String mRequestType; protected String mContext; // string for now. - protected ExtDataHashtable mExtData = new ExtDataHashtable(); + protected ExtDataHashtable<Object> mExtData = new ExtDataHashtable<Object>(); Date mCreationTime = CMS.getCurrentDate(); Date mModificationTime = CMS.getCurrentDate(); @@ -1448,7 +1453,7 @@ class RequestIAttrSetWrapper implements IAttrSet { mRequest.deleteExtData(name); } - public Enumeration getElements() { + public Enumeration<String> getElements() { return mRequest.getExtDataKeys(); } } @@ -1478,7 +1483,7 @@ class RequestListByStatus return null; } - public Object nextElement() { + public RequestId nextElement() { RequestId next = mNext; update(); @@ -1494,7 +1499,7 @@ class RequestListByStatus return next; } - public RequestListByStatus(Enumeration e, RequestStatus s, IRequestQueue q) { + public RequestListByStatus(Enumeration<RequestId> e, RequestStatus s, IRequestQueue q) { mEnumeration = e; mStatus = s; mQueue = q; @@ -1511,7 +1516,7 @@ class RequestListByStatus if (!mEnumeration.hasMoreElements()) break; - rId = (RequestId) mEnumeration.nextElement(); + rId = mEnumeration.nextElement(); try { IRequest r = mQueue.findRequest(rId); @@ -1527,7 +1532,7 @@ class RequestListByStatus protected RequestStatus mStatus; protected IRequestQueue mQueue; - protected Enumeration mEnumeration; + protected Enumeration<RequestId> mEnumeration; protected RequestId mNext; } @@ -1537,7 +1542,7 @@ class RequestList return mEnumeration.hasMoreElements(); } - public Object nextElement() { + public RequestId nextElement() { return mEnumeration.nextElement(); } @@ -1553,11 +1558,11 @@ class RequestList return null; } - public RequestList(Enumeration e) { + public RequestList(Enumeration<RequestId> e) { mEnumeration = e; } - protected Enumeration mEnumeration; + protected Enumeration<RequestId> mEnumeration; } class RecoverThread extends Thread { diff --git a/pki/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java b/pki/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java index f21503a21..86e6c0530 100644 --- a/pki/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java +++ b/pki/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java @@ -10,7 +10,7 @@ import java.util.Set; * purpose is to hide the fact that LDAP doesn't preserve the case of keys. * It does this by lowercasing all keys used to access the Hashtable. */ -public class ExtDataHashtable extends Hashtable { +public class ExtDataHashtable<V> extends Hashtable<String, V> { /** * @@ -29,7 +29,7 @@ public class ExtDataHashtable extends Hashtable { super(i, v); } - public ExtDataHashtable(Map map) { + public ExtDataHashtable(Map<? extends String, ? extends V> map) { // the super constructor seems to call putAll, but I can't // rely on that behaviour super(); @@ -44,7 +44,7 @@ public class ExtDataHashtable extends Hashtable { return super.containsKey(o); } - public Object get(Object o) { + public V get(Object o) { if (o instanceof String) { String key = (String) o; return super.get(key.toLowerCase()); @@ -52,7 +52,7 @@ public class ExtDataHashtable extends Hashtable { return super.get(o); } - public Object put(Object oKey, Object val) { + public V put(String oKey, V val) { if (oKey instanceof String) { String key = (String) oKey; return super.put(key.toLowerCase(), val); @@ -60,15 +60,15 @@ public class ExtDataHashtable extends Hashtable { return super.put(oKey, val); } - public void putAll(Map map) { - Set keys = map.keySet(); - for (Iterator i = keys.iterator(); i.hasNext();) { + public void putAll(Map<? extends String, ? extends V> map) { + Set<? extends String> keys = map.keySet(); + for (Iterator<? extends String> i = keys.iterator(); i.hasNext();) { Object key = i.next(); - put(key, map.get(key)); + put((String) key, map.get(key)); } } - public Object remove(Object o) { + public V remove(Object o) { if (o instanceof String) { String key = (String) o; return super.remove(key.toLowerCase()); diff --git a/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java b/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java index a3637758f..c7f8c493a 100644 --- a/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java +++ b/pki/base/common/src/com/netscape/cmscore/request/RequestRecord.java @@ -250,7 +250,7 @@ public class RequestRecord if (value instanceof String) { r.setExtData(key, (String) value); } else if (value instanceof Hashtable) { - r.setExtData(key, (Hashtable) value); + r.setExtData(key, (Hashtable<String, String>) value); } else { throw new EDBException("Illegal data value in RequestRecord: " + r.toString()); 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 aa80a3ceb..a4f6ee9a0 100644 --- a/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java @@ -127,8 +127,9 @@ public final class JssSubsystem implements ICryptoSubsystem { protected PasswordCallback mPWCB = null; private static JssSubsystem mInstance = new JssSubsystem(); - private Hashtable mNicknameMapCertsTable = new Hashtable(); - private Hashtable mNicknameMapUserCertsTable = new Hashtable(); + private Hashtable<String, X509Certificate[]> mNicknameMapCertsTable = new Hashtable<String, X509Certificate[]>(); + private Hashtable<String, X509Certificate[]> mNicknameMapUserCertsTable = + new Hashtable<String, X509Certificate[]>(); private FileInputStream devRandomInputStream = null; @@ -144,7 +145,7 @@ public final class JssSubsystem implements ICryptoSubsystem { private static final String PROP_SSL_CIPHERPREF = Constants.PR_CIPHER_PREF; private static final String PROP_SSL_ECTYPE = Constants.PR_ECTYPE; - private static Hashtable mCipherNames = new Hashtable(); + private static Hashtable<String, Integer> mCipherNames = new Hashtable<String, Integer>(); /* default sslv2 and sslv3 cipher suites(all), set if no prefs in config.*/ private static final String DEFAULT_CIPHERPREF = @@ -514,12 +515,13 @@ public final class JssSubsystem implements ICryptoSubsystem { public String getTokenList() throws EBaseException { String tokenList = ""; - Enumeration tokens = mCryptoManager.getExternalTokens(); + @SuppressWarnings("unchecked") + Enumeration<CryptoToken> tokens = mCryptoManager.getExternalTokens(); int num = 0; try { while (tokens.hasMoreElements()) { - CryptoToken c = (CryptoToken) tokens.nextElement(); + CryptoToken c = tokens.nextElement(); // skip builtin object token if (c.getName() != null && c.getName().equals("Builtin Object Token")) { @@ -603,10 +605,11 @@ public final class JssSubsystem implements ICryptoSubsystem { String certNames = ""; try { - Enumeration enums = mCryptoManager.getAllTokens(); + @SuppressWarnings("unchecked") + Enumeration<CryptoToken> enums = mCryptoManager.getAllTokens(); while (enums.hasMoreElements()) { - CryptoToken token = (CryptoToken) enums.nextElement(); + CryptoToken token = enums.nextElement(); CryptoStore store = token.getCryptoStore(); X509Certificate[] list = store.getCertificates(); @@ -1155,12 +1158,13 @@ public final class JssSubsystem implements ICryptoSubsystem { public NameValuePairs getRootCerts() throws EBaseException { NameValuePairs nvps = new NameValuePairs(); try { - Enumeration enums = mCryptoManager.getAllTokens(); + @SuppressWarnings("unchecked") + Enumeration<CryptoToken> enums = mCryptoManager.getAllTokens(); if (mNicknameMapCertsTable != null) mNicknameMapCertsTable.clear(); // a temp hashtable with vectors - Hashtable vecTable = new Hashtable(); + Hashtable<String, Vector<X509Certificate>> vecTable = new Hashtable<String, Vector<X509Certificate>>(); while (enums.hasMoreElements()) { CryptoToken token = (CryptoToken) enums.nextElement(); @@ -1183,11 +1187,11 @@ public final class JssSubsystem implements ICryptoSubsystem { X509CertImpl impl = null; try { - Vector v; + Vector<X509Certificate> v; if (vecTable.containsKey((Object) nickname) == true) { - v = (Vector) vecTable.get(nickname); + v = vecTable.get(nickname); } else { - v = new Vector(); + v = new Vector<X509Certificate>(); } v.addElement(list[i]); vecTable.put(nickname, v); @@ -1208,11 +1212,11 @@ public final class JssSubsystem implements ICryptoSubsystem { } } // convert hashtable of vectors to hashtable of arrays - Enumeration elms = vecTable.keys(); + Enumeration<String> elms = vecTable.keys(); while (elms.hasMoreElements()) { String key = (String) elms.nextElement(); - Vector v = (Vector) vecTable.get((Object) key); + Vector<X509Certificate> v = vecTable.get((Object) key); X509Certificate[] a = new X509Certificate[v.size()]; v.copyInto((Object[]) a); @@ -1231,7 +1235,8 @@ public final class JssSubsystem implements ICryptoSubsystem { public NameValuePairs getUserCerts() throws EBaseException { NameValuePairs nvps = new NameValuePairs(); try { - Enumeration enums = mCryptoManager.getAllTokens(); + @SuppressWarnings("unchecked") + Enumeration<CryptoToken> enums = mCryptoManager.getAllTokens(); while (enums.hasMoreElements()) { CryptoToken token = (CryptoToken) enums.nextElement(); @@ -1297,7 +1302,8 @@ public final class JssSubsystem implements ICryptoSubsystem { mNicknameMapUserCertsTable.clear(); try { - Enumeration enums = mCryptoManager.getAllTokens(); + @SuppressWarnings("unchecked") + Enumeration<CryptoToken> enums = mCryptoManager.getAllTokens(); while (enums.hasMoreElements()) { CryptoToken token = (CryptoToken) enums.nextElement(); @@ -1378,36 +1384,36 @@ public final class JssSubsystem implements ICryptoSubsystem { } // a temp hashtable with vectors - Hashtable vecTable = new Hashtable(); + Hashtable<String, Vector<X509Certificate>> vecTable = new Hashtable<String, Vector<X509Certificate>>(); for (int i = 0; i < certs.length; i++) { String nickname = certs[i].getNickname(); /* build a table of our own */ - Vector v; + Vector<X509Certificate> v; if (vecTable.containsKey((Object) nickname) == true) { - v = (Vector) vecTable.get(nickname); + v = vecTable.get(nickname); } else { - v = new Vector(); + v = new Vector<X509Certificate>(); } v.addElement(certs[i]); vecTable.put(nickname, v); } // convert hashtable of vectors to hashtable of arrays - Enumeration elms = vecTable.keys(); + Enumeration<String> elms = vecTable.keys(); while (elms.hasMoreElements()) { String key = (String) elms.nextElement(); - Vector v = (Vector) vecTable.get((Object) key); + Vector<X509Certificate> v = vecTable.get((Object) key); X509Certificate[] a = new X509Certificate[v.size()]; v.copyInto((Object[]) a); mNicknameMapCertsTable.put(key, a); } - Enumeration keys = mNicknameMapCertsTable.keys(); + Enumeration<String> keys = mNicknameMapCertsTable.keys(); while (keys.hasMoreElements()) { String nickname = (String) keys.nextElement(); diff --git a/pki/base/common/src/com/netscape/cmscore/security/KeyCertUtil.java b/pki/base/common/src/com/netscape/cmscore/security/KeyCertUtil.java index 6d7d71b0e..1d03911b4 100644 --- a/pki/base/common/src/com/netscape/cmscore/security/KeyCertUtil.java +++ b/pki/base/common/src/com/netscape/cmscore/security/KeyCertUtil.java @@ -156,7 +156,8 @@ public class KeyCertUtil { public static String getTokenNames(CryptoManager manager) throws TokenException { String tokenList = ""; - Enumeration tokens = manager.getExternalTokens(); + @SuppressWarnings("unchecked") + Enumeration<CryptoToken> tokens = manager.getExternalTokens(); int num = 0; while (tokens.hasMoreElements()) { @@ -981,7 +982,7 @@ public class KeyCertUtil { String signing = properties.getOCSPSigning(); if ((signing != null) && (signing.equals(Constants.TRUE))) { - Vector oidSet = new Vector(); + Vector<ObjectIdentifier> oidSet = new Vector<ObjectIdentifier>(); oidSet.addElement( ObjectIdentifier.getObjectIdentifier( ExtendedKeyUsageExtension.OID_OCSPSigning)); diff --git a/pki/base/common/src/com/netscape/cmscore/util/UtilResources.java b/pki/base/common/src/com/netscape/cmscore/util/UtilResources.java index e8f4d8478..6955dda50 100644 --- a/pki/base/common/src/com/netscape/cmscore/util/UtilResources.java +++ b/pki/base/common/src/com/netscape/cmscore/util/UtilResources.java @@ -70,5 +70,5 @@ public class UtilResources extends ListResourceBundle { { NO_UID_PERMISSION_2, "Can''t change process uid to {0}. Running as {1}" }, { SHUTDOWN_SIG, "Received shutdown signal" }, { RESTART_SIG, "Received restart signal" }, - }; + }; } diff --git a/pki/base/common/test/com/netscape/certsrv/app/CMSEngineDefaultStub.java b/pki/base/common/test/com/netscape/certsrv/app/CMSEngineDefaultStub.java index c5fb12e22..f27cabb2c 100644 --- a/pki/base/common/test/com/netscape/certsrv/app/CMSEngineDefaultStub.java +++ b/pki/base/common/test/com/netscape/certsrv/app/CMSEngineDefaultStub.java @@ -126,11 +126,11 @@ public class CMSEngineDefaultStub implements ICMSEngine { return false; } - public Enumeration getSubsystemNames() { + public Enumeration<String> getSubsystemNames() { return null; } - public Enumeration getSubsystems() { + public Enumeration<ISubsystem> getSubsystems() { return null; } @@ -465,18 +465,6 @@ public class CMSEngineDefaultStub implements ICMSEngine { return null; } - public void getGeneralNameConfigDefaultParams(String name, boolean isValueConfigured, Vector params) { - } - - public void getGeneralNamesConfigDefaultParams(String name, boolean isValueConfigured, Vector params) { - } - - public void getGeneralNameConfigExtendedPluginInfo(String name, boolean isValueConfigured, Vector info) { - } - - public void getGeneralNamesConfigExtendedPluginInfo(String name, boolean isValueConfigured, Vector info) { - } - public IGeneralNamesConfig createGeneralNamesConfig(String name, IConfigStore config, boolean isValueConfigured, boolean isPolicyEnabled) throws EBaseException { return null; @@ -492,12 +480,6 @@ public class CMSEngineDefaultStub implements ICMSEngine { return null; } - public void getSubjAltNameConfigDefaultParams(String name, Vector params) { - } - - public void getSubjAltNameConfigExtendedPluginInfo(String name, Vector params) { - } - public ISubjAltNameConfig createSubjAltNameConfig(String name, IConfigStore config, boolean isValueConfigured) throws EBaseException { return null; @@ -537,14 +519,6 @@ public class CMSEngineDefaultStub implements ICMSEngine { return null; } - public IArgBlock createArgBlock(String realm, Hashtable httpReq) { - return null; - } - - public IArgBlock createArgBlock(Hashtable httpReq) { - return null; - } - public boolean isRevoked(X509Certificate[] certificates) { return false; } @@ -600,4 +574,59 @@ public class CMSEngineDefaultStub implements ICMSEngine { // TODO Auto-generated method stub return null; } + + @Override + public void getGeneralNameConfigDefaultParams(String name, + boolean isValueConfigured, Vector<String> params) { + // TODO Auto-generated method stub + + } + + @Override + public void getGeneralNamesConfigDefaultParams(String name, + boolean isValueConfigured, Vector<String> params) { + // TODO Auto-generated method stub + + } + + @Override + public void getGeneralNameConfigExtendedPluginInfo(String name, + boolean isValueConfigured, Vector<String> info) { + // TODO Auto-generated method stub + + } + + @Override + public void getGeneralNamesConfigExtendedPluginInfo(String name, + boolean isValueConfigured, Vector<String> info) { + // TODO Auto-generated method stub + + } + + @Override + public void getSubjAltNameConfigDefaultParams(String name, + Vector<String> params) { + // TODO Auto-generated method stub + + } + + @Override + public void getSubjAltNameConfigExtendedPluginInfo(String name, + Vector<String> params) { + // TODO Auto-generated method stub + + } + + @Override + public IArgBlock createArgBlock(String realm, + Hashtable<String, String> httpReq) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IArgBlock createArgBlock(Hashtable<String, String> httpReq) { + // TODO Auto-generated method stub + return null; + } } diff --git a/pki/base/common/test/com/netscape/cmscore/request/ExtDataHashtableTest.java b/pki/base/common/test/com/netscape/cmscore/request/ExtDataHashtableTest.java index 7569ff20a..c349b73d0 100644 --- a/pki/base/common/test/com/netscape/cmscore/request/ExtDataHashtableTest.java +++ b/pki/base/common/test/com/netscape/cmscore/request/ExtDataHashtableTest.java @@ -9,14 +9,14 @@ import com.netscape.cmscore.test.CMSBaseTestCase; public class ExtDataHashtableTest extends CMSBaseTestCase { - ExtDataHashtable hash; + ExtDataHashtable<String> hash; public ExtDataHashtableTest(String name) { super(name); } public void cmsTestSetUp() { - hash = new ExtDataHashtable(); + hash = new ExtDataHashtable<String>(); } public void cmsTestTearDown() { @@ -46,7 +46,7 @@ public class ExtDataHashtableTest extends CMSBaseTestCase { } public void testPutAll() { - Hashtable hash2 = new Hashtable(); + Hashtable<String, String> hash2 = new Hashtable<String, String>(); hash2.put("KEY1", "VAL1"); hash2.put("KEY2", "val2"); @@ -67,11 +67,11 @@ public class ExtDataHashtableTest extends CMSBaseTestCase { } public void testMapConstructor() { - Hashtable hash2 = new Hashtable(); + Hashtable<String, String> hash2 = new Hashtable<String, String>(); hash2.put("KEY1", "VAL1"); hash2.put("KEY2", "val2"); - hash = new ExtDataHashtable(hash2); + hash = new ExtDataHashtable<String>(hash2); assertTrue(hash.containsKey("key1")); assertEquals("VAL1", hash.get("key1")); diff --git a/pki/base/common/test/com/netscape/cmscore/request/RequestDefaultStub.java b/pki/base/common/test/com/netscape/cmscore/request/RequestDefaultStub.java index f00eb8a74..fd53c2ea9 100644 --- a/pki/base/common/test/com/netscape/cmscore/request/RequestDefaultStub.java +++ b/pki/base/common/test/com/netscape/cmscore/request/RequestDefaultStub.java @@ -71,7 +71,7 @@ public class RequestDefaultStub implements IRequest { return null; } - public Enumeration getAttrNames() { + public Enumeration<String> getAttrNames() { return null; } @@ -103,7 +103,7 @@ public class RequestDefaultStub implements IRequest { return false; } - public boolean setExtData(String key, Hashtable value) { + public boolean setExtData(String key, Hashtable<String, String> value) { return false; } @@ -115,11 +115,11 @@ public class RequestDefaultStub implements IRequest { return null; } - public Hashtable getExtDataInHashtable(String key) { + public Hashtable<String, String> getExtDataInHashtable(String key) { return null; } - public Enumeration getExtDataKeys() { + public Enumeration<String> getExtDataKeys() { return null; } @@ -223,11 +223,11 @@ public class RequestDefaultStub implements IRequest { return new RevokedCertImpl[0]; } - public boolean setExtData(String key, Vector data) { + public boolean setExtData(String key, Vector<?> data) { return false; } - public Vector getExtDataInStringVector(String key) { + public Vector<String> getExtDataInStringVector(String key) { return null; } diff --git a/pki/base/common/test/com/netscape/cmscore/request/RequestRecordTest.java b/pki/base/common/test/com/netscape/cmscore/request/RequestRecordTest.java index efdbfc20a..457f91d9b 100644 --- a/pki/base/common/test/com/netscape/cmscore/request/RequestRecordTest.java +++ b/pki/base/common/test/com/netscape/cmscore/request/RequestRecordTest.java @@ -62,7 +62,7 @@ public class RequestRecordTest extends CMSBaseTestCase { public void testAddExtData() throws EBaseException { request.setExtData("foo", "bar"); - Hashtable requestHashValue = new Hashtable(); + Hashtable<String, String> requestHashValue = new Hashtable<String, String>(); requestHashValue.put("red", "rum"); requestHashValue.put("blue", "gin"); request.setExtData("hashkey", requestHashValue); @@ -74,9 +74,9 @@ public class RequestRecordTest extends CMSBaseTestCase { } public void testReadExtData() throws EBaseException { - Hashtable extData = new Hashtable(); + Hashtable<String, Object> extData = new Hashtable<String, Object>(); extData.put("foo", "bar"); - Hashtable extDataHashValue = new Hashtable(); + Hashtable<String, String> extDataHashValue = new Hashtable<String, String>(); extDataHashValue.put("red", "rum"); extDataHashValue.put("blue", "gin"); extData.put("hashkey", extDataHashValue); diff --git a/pki/base/common/test/com/netscape/cmscore/request/RequestTest.java b/pki/base/common/test/com/netscape/cmscore/request/RequestTest.java index 2251cc8c8..3ca589280 100644 --- a/pki/base/common/test/com/netscape/cmscore/request/RequestTest.java +++ b/pki/base/common/test/com/netscape/cmscore/request/RequestTest.java @@ -69,7 +69,7 @@ public class RequestTest extends CMSBaseTestCase { public void testIsSimpleExtDataValue() { request.mExtData.put("simple1", "foo"); - request.mExtData.put("complex1", new Hashtable()); + request.mExtData.put("complex1", new Hashtable<String, Object>()); assertTrue(request.isSimpleExtDataValue("simple1")); assertFalse(request.isSimpleExtDataValue("complex1")); @@ -91,8 +91,9 @@ public class RequestTest extends CMSBaseTestCase { assertFalse(request.setExtData("key", (String) null)); } + @SuppressWarnings({ "rawtypes", "unchecked" }) public void testVerifyValidExtDataHashtable() { - Hashtable valueHash = new Hashtable(); + Hashtable<String, String> valueHash = new Hashtable<String, String>(); valueHash.put("key1", "val1"); valueHash.put("key;2", "val2"); @@ -101,26 +102,18 @@ public class RequestTest extends CMSBaseTestCase { valueHash.clear(); valueHash.put("", "bar"); assertFalse(request.isValidExtDataHashtableValue(valueHash)); - - valueHash.clear(); - valueHash.put(new Integer("0"), "bar"); - assertFalse(request.isValidExtDataHashtableValue(valueHash)); - - valueHash.clear(); - valueHash.put("okay", new Integer(5)); - assertFalse(request.isValidExtDataHashtableValue(valueHash)); - } + @SuppressWarnings({ "unchecked", "rawtypes" }) public void testSetExtHashtableData() { - Hashtable valueHash = new Hashtable(); + Hashtable<String, String> valueHash = new Hashtable<String, String>(); valueHash.put("key1", "val1"); valueHash.put("KEY2", "val2"); request.setExtData("TOPKEY", valueHash); - Hashtable out = request.getExtDataInHashtable("topkey"); + Hashtable<String, String> out = request.getExtDataInHashtable("topkey"); assertNotNull(out); assertTrue(out.containsKey("key1")); @@ -137,7 +130,7 @@ public class RequestTest extends CMSBaseTestCase { public void testGetExtDataInString() { request.mExtData.put("strkey", "strval"); - Hashtable hashValue = new Hashtable(); + Hashtable<String, String> hashValue = new Hashtable<String, String>(); hashValue.put("uh", "oh"); request.mExtData.put("hashkey", hashValue); @@ -150,11 +143,11 @@ public class RequestTest extends CMSBaseTestCase { public void testGetExtDataInHashtable() { request.mExtData.put("strkey", "strval"); - Hashtable hashValue = new Hashtable(); + Hashtable<String, String> hashValue = new Hashtable<String, String>(); hashValue.put("uh", "oh"); request.mExtData.put("hashkey", hashValue); - Hashtable out = request.getExtDataInHashtable("HASHKEY"); + Hashtable<String, String> out = request.getExtDataInHashtable("HASHKEY"); assertNotNull(out); assertNull(request.getExtDataInHashtable("notfound")); assertNull(request.getExtDataInHashtable("strkey")); @@ -171,7 +164,7 @@ public class RequestTest extends CMSBaseTestCase { public void testGetExtDataKeys() { request.setExtData("FOO", "val1"); - request.setExtData("bar", new Hashtable()); + request.setExtData("bar", new Hashtable<String, String>()); assertTrue(TestHelper.enumerationContains(request.getExtDataKeys(), "foo")); assertTrue(TestHelper.enumerationContains(request.getExtDataKeys(), "bar")); @@ -181,14 +174,14 @@ public class RequestTest extends CMSBaseTestCase { // creates hashtable first time assertNull(request.getExtDataInHashtable("topkey")); request.setExtData("TOPKEY", "SUBKEY", "value"); - Hashtable value = request.getExtDataInHashtable("topkey"); + Hashtable<String, String> value = request.getExtDataInHashtable("topkey"); assertNotNull(value); assertTrue(value.containsKey("subkey")); assertEquals("value", value.get("subkey")); // adds to existing hashtable assertNull(request.getExtDataInHashtable("topkey2")); - value = new Hashtable(); + value = new Hashtable<String, String>(); value.put("subkey2", "value2"); request.setExtData("topkey2", value); request.setExtData("TOPKEY2", "subkey3", "value3"); @@ -219,7 +212,7 @@ public class RequestTest extends CMSBaseTestCase { } public void testGetExtDataSubkeyValue() { - Hashtable value = new Hashtable(); + Hashtable<String, String> value = new Hashtable<String, String>(); value.put("subkey", "value"); request.setExtData("topkey", value); @@ -259,7 +252,7 @@ public class RequestTest extends CMSBaseTestCase { assertEquals(data[2], retval[2]); // invalid conversion - Hashtable hashValue = new Hashtable(); + Hashtable<String, String> hashValue = new Hashtable<String, String>(); hashValue.put("0", "5"); hashValue.put("1", "bar"); request.setExtData("topkey2", hashValue); @@ -298,7 +291,7 @@ public class RequestTest extends CMSBaseTestCase { assertEquals(data[2], retval[2]); // invalid conversion - Hashtable hashValue = new Hashtable(); + Hashtable<String, String> hashValue = new Hashtable<String, String>(); hashValue.put("0", "5"); hashValue.put("1", "bar"); request.setExtData("topkey2", hashValue); @@ -357,7 +350,7 @@ public class RequestTest extends CMSBaseTestCase { }; assertTrue(request.setExtData("key", vals)); - Hashtable hashVals = (Hashtable) request.mExtData.get("key"); + Hashtable<?, ?> hashVals = (Hashtable<?, ?>) request.mExtData.get("key"); assertEquals(2, hashVals.keySet().size()); assertFalse(cmsStub.aToBCalled); @@ -376,7 +369,8 @@ public class RequestTest extends CMSBaseTestCase { assertTrue(request.setExtData("key", value)); assertTrue(request.mExtData.containsKey("key")); - Hashtable hashValue = (Hashtable) request.mExtData.get("key"); + @SuppressWarnings("unchecked") + Hashtable<String, String> hashValue = (Hashtable<String, String>) request.mExtData.get("key"); assertTrue(hashValue.containsKey("0")); assertTrue(hashValue.containsKey("1")); assertTrue(hashValue.containsKey("2")); @@ -394,7 +388,7 @@ public class RequestTest extends CMSBaseTestCase { assertEquals("orange", retval[3]); // Try with sparse input - hashValue = new Hashtable(); + hashValue = new Hashtable<String, String>(); hashValue.put("0", "square"); hashValue.put("4", "triangle"); hashValue.put("6", "octogon"); @@ -411,7 +405,7 @@ public class RequestTest extends CMSBaseTestCase { assertEquals("octogon", retval[6]); // invalid conversion - hashValue = new Hashtable(); + hashValue = new Hashtable<String, String>(); hashValue.put("0", "foo"); hashValue.put("badkey", "bar"); request.setExtData("cory", hashValue); @@ -422,7 +416,7 @@ public class RequestTest extends CMSBaseTestCase { } public void testGetSetStringVector() { - Vector stringVector = new Vector(); + Vector<String> stringVector = new Vector<String>(); stringVector.add("blue"); stringVector.add("green"); stringVector.add("red"); @@ -431,7 +425,8 @@ public class RequestTest extends CMSBaseTestCase { assertTrue(request.setExtData("key", stringVector)); assertTrue(request.mExtData.containsKey("key")); - Hashtable hashValue = (Hashtable) request.mExtData.get("key"); + @SuppressWarnings("unchecked") + Hashtable<String, String> hashValue = (Hashtable<String, String>) request.mExtData.get("key"); assertTrue(hashValue.containsKey("0")); assertTrue(hashValue.containsKey("1")); assertTrue(hashValue.containsKey("2")); @@ -441,7 +436,7 @@ public class RequestTest extends CMSBaseTestCase { assertEquals("red", hashValue.get("2")); assertEquals("orange", hashValue.get("3")); - Vector retval = request.getExtDataInStringVector("key"); + Vector<String> retval = request.getExtDataInStringVector("key"); assertEquals(4, retval.size()); assertEquals("blue", retval.elementAt(0)); assertEquals("green", retval.elementAt(1)); @@ -449,13 +444,13 @@ public class RequestTest extends CMSBaseTestCase { assertEquals("orange", retval.elementAt(3)); // invalid conversion - hashValue = new Hashtable(); + hashValue = new Hashtable<String, String>(); hashValue.put("0", "foo"); hashValue.put("badkey", "bar"); request.setExtData("cory", hashValue); assertNull(request.getExtDataInStringVector("cory")); - assertFalse(request.setExtData("key", (Vector) null)); + assertFalse(request.setExtData("key", (Vector<?>) null)); } public void testGetSetCertInfo() { @@ -482,7 +477,7 @@ public class RequestTest extends CMSBaseTestCase { }; assertTrue(request.setExtData("key", vals)); - Hashtable hashVals = (Hashtable) request.mExtData.get("key"); + Hashtable<?, ?> hashVals = (Hashtable<?, ?>) request.mExtData.get("key"); assertEquals(2, hashVals.keySet().size()); assertFalse(cmsStub.aToBCalled); @@ -493,7 +488,7 @@ public class RequestTest extends CMSBaseTestCase { } public void testGetBoolean() { - Hashtable hashValue = new Hashtable(); + Hashtable<String, String> hashValue = new Hashtable<String, String>(); hashValue.put("one", "false"); hashValue.put("two", "true"); hashValue.put("three", "on"); @@ -532,7 +527,7 @@ public class RequestTest extends CMSBaseTestCase { }; assertTrue(request.setExtData("key", vals)); - Hashtable hashVals = (Hashtable) request.mExtData.get("key"); + Hashtable<?, ?> hashVals = (Hashtable<?, ?>) request.mExtData.get("key"); assertEquals(2, hashVals.keySet().size()); assertFalse(cmsStub.aToBCalled); diff --git a/pki/base/java-tools/src/com/netscape/cmstools/CMCEnroll.java b/pki/base/java-tools/src/com/netscape/cmstools/CMCEnroll.java index b7e6502ee..18bfb51fc 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/CMCEnroll.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/CMCEnroll.java @@ -237,8 +237,8 @@ public class CMCEnroll { // SHA1 is the default digest Alg for now. DigestAlgorithm digestAlg = null; SignatureAlgorithm signAlg = SignatureAlgorithm.RSASignatureWithSHA1Digest; - org.mozilla.jss.crypto.PrivateKey.Type signingKeyType = ((org.mozilla.jss.crypto.PrivateKey) privKey) - .getType(); + org.mozilla.jss.crypto.PrivateKey.Type signingKeyType = + ((org.mozilla.jss.crypto.PrivateKey) privKey).getType(); if (signingKeyType.equals(org.mozilla.jss.crypto.PrivateKey.Type.DSA)) signAlg = SignatureAlgorithm.DSASignatureWithSHA1Digest; diff --git a/pki/base/java-tools/src/com/netscape/cmstools/CMCRequest.java b/pki/base/java-tools/src/com/netscape/cmstools/CMCRequest.java index 00ca4709e..197f29e15 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/CMCRequest.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/CMCRequest.java @@ -246,8 +246,8 @@ public class CMCRequest { // SHA1 is the default digest Alg for now. DigestAlgorithm digestAlg = null; SignatureAlgorithm signAlg = SignatureAlgorithm.RSASignatureWithSHA1Digest; - org.mozilla.jss.crypto.PrivateKey.Type signingKeyType = ((org.mozilla.jss.crypto.PrivateKey) privKey) - .getType(); + org.mozilla.jss.crypto.PrivateKey.Type signingKeyType = + ((org.mozilla.jss.crypto.PrivateKey) privKey).getType(); if (signingKeyType.equals(org.mozilla.jss.crypto.PrivateKey.Type.DSA)) signAlg = SignatureAlgorithm.DSASignatureWithSHA1Digest; diff --git a/pki/base/java-tools/src/com/netscape/cmstools/CMCRevoke.java b/pki/base/java-tools/src/com/netscape/cmstools/CMCRevoke.java index bab8b84fd..3be8167a1 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/CMCRevoke.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/CMCRevoke.java @@ -145,8 +145,8 @@ public class CMCRevoke { // optional parameter if (cValue == null) cValue = new String(); - if (dValue == null || nValue == null || iValue == null || sValue == null || mValue == null - || hValue == null) + if (dValue == null + || nValue == null || iValue == null || sValue == null || mValue == null || hValue == null) bWrongParam = true; else if (dValue.length() == 0 || nValue.length() == 0 || iValue.length() == 0 || sValue.length() == 0 || mValue.length() == 0 || hValue.length() == 0) @@ -331,23 +331,23 @@ public class CMCRevoke { } String sn = com.netscape.osutil.OSUtil.BtoA(dig); - TaggedAttribute senderNonce = new TaggedAttribute(new INTEGER(bpid++), - OBJECT_IDENTIFIER.id_cmc_senderNonce, - new OCTET_STRING(sn.getBytes())); + TaggedAttribute senderNonce = + new TaggedAttribute(new INTEGER(bpid++), OBJECT_IDENTIFIER.id_cmc_senderNonce, + new OCTET_STRING(sn.getBytes())); controlSeq.addElement(senderNonce); Name subjectName = new Name(); subjectName.addCommonName(iValue); - org.mozilla.jss.pkix.cmmf.RevRequest lRevokeRequest = new org.mozilla.jss.pkix.cmmf.RevRequest(new ANY( - (new X500Name(iValue)).getEncoded()), - new INTEGER(sValue), - //org.mozilla.jss.pkix.cmmf.RevRequest.unspecified, - new ENUMERATED((new Integer(mValue)).longValue()), - //new GeneralizedTime(new Date(lValue)), - new OCTET_STRING(hValue.getBytes()), - new UTF8String(cValue.toCharArray())); + org.mozilla.jss.pkix.cmmf.RevRequest lRevokeRequest = + new org.mozilla.jss.pkix.cmmf.RevRequest(new ANY((new X500Name(iValue)).getEncoded()), + new INTEGER(sValue), + //org.mozilla.jss.pkix.cmmf.RevRequest.unspecified, + new ENUMERATED((new Integer(mValue)).longValue()), + //new GeneralizedTime(new Date(lValue)), + new OCTET_STRING(hValue.getBytes()), + new UTF8String(cValue.toCharArray())); //byte[] encoded = ASN1Util.encode(lRevokeRequest); //org.mozilla.jss.asn1.ASN1Template template = new org.mozilla.jss.pkix.cmmf.RevRequest.Template(); //org.mozilla.jss.pkix.cmmf.RevRequest revRequest = (org.mozilla.jss.pkix.cmmf.RevRequest) @@ -356,9 +356,9 @@ public class CMCRevoke { ByteArrayOutputStream os = new ByteArrayOutputStream(); //lRevokeRequest.encode(os); // khai - TaggedAttribute revokeRequestTag = new TaggedAttribute(new INTEGER(bpid++), - OBJECT_IDENTIFIER.id_cmc_revokeRequest, - lRevokeRequest); + TaggedAttribute revokeRequestTag = + new TaggedAttribute(new INTEGER(bpid++), OBJECT_IDENTIFIER.id_cmc_revokeRequest, + lRevokeRequest); controlSeq.addElement(revokeRequestTag); PKIData pkidata = new PKIData(controlSeq, new SEQUENCE(), new SEQUENCE(), new SEQUENCE()); @@ -367,8 +367,8 @@ public class CMCRevoke { // SHA1 is the default digest Alg for now. DigestAlgorithm digestAlg = null; SignatureAlgorithm signAlg = SignatureAlgorithm.RSASignatureWithSHA1Digest; - org.mozilla.jss.crypto.PrivateKey.Type signingKeyType = ((org.mozilla.jss.crypto.PrivateKey) privKey) - .getType(); + org.mozilla.jss.crypto.PrivateKey.Type signingKeyType = + ((org.mozilla.jss.crypto.PrivateKey) privKey).getType(); if (signingKeyType.equals(org.mozilla.jss.crypto.PrivateKey.Type.DSA)) signAlg = SignatureAlgorithm.DSASignatureWithSHA1Digest; diff --git a/pki/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java b/pki/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java index a38ff8b96..73c56ffea 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java @@ -370,10 +370,11 @@ public class CRMFPopClient { certTemplate.setPublicKey(new SubjectPublicKeyInfo(pair.getPublic())); // set extension - AlgorithmIdentifier algS = new AlgorithmIdentifier(new OBJECT_IDENTIFIER("1.2.840.113549.3.7"), - new OCTET_STRING(iv)); - EncryptedValue encValue = new EncryptedValue(null, algS, new BIT_STRING(session_data, 0), null, null, - new BIT_STRING(key_data, 0)); + AlgorithmIdentifier algS = + new AlgorithmIdentifier(new OBJECT_IDENTIFIER("1.2.840.113549.3.7"), new OCTET_STRING(iv)); + EncryptedValue encValue = + new EncryptedValue(null, algS, new BIT_STRING(session_data, 0), null, null, new BIT_STRING( + key_data, 0)); EncryptedKey key = new EncryptedKey(encValue); PKIArchiveOptions opt = new PKIArchiveOptions(key); SEQUENCE seq = new SEQUENCE(); @@ -493,10 +494,12 @@ public class CRMFPopClient { // post PKCS10 - url = new URL("http://" + HOST + ":" + PORT - + "/ca/ee/ca/profileSubmit?cert_request_type=crmf&cert_request=" + Req + "&renewal=false&uid=" - + USER_NAME + "&xmlOutput=false&&profileId=" + profileName + "&sn_uid=" + USER_NAME - + "&SubId=profile&requestor_name=" + REQUESTOR_NAME); + url = + new URL("http://" + + HOST + ":" + PORT + "/ca/ee/ca/profileSubmit?cert_request_type=crmf&cert_request=" + + Req + "&renewal=false&uid=" + USER_NAME + "&xmlOutput=false&&profileId=" + + profileName + "&sn_uid=" + USER_NAME + "&SubId=profile&requestor_name=" + + REQUESTOR_NAME); //System.out.println("Posting " + url); System.out.println(""); diff --git a/pki/base/java-tools/src/com/netscape/cmstools/GenExtKeyUsage.java b/pki/base/java-tools/src/com/netscape/cmstools/GenExtKeyUsage.java index c2d4e869b..fc3511f27 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/GenExtKeyUsage.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/GenExtKeyUsage.java @@ -54,7 +54,7 @@ public class GenExtKeyUsage { } // Generate vector of object identifiers from command line - Vector oids = new Vector(); + Vector<ObjectIdentifier> oids = new Vector<ObjectIdentifier>(); for (int i = 1; i < args.length; i++) { ObjectIdentifier oid = new ObjectIdentifier(args[i]); @@ -66,7 +66,7 @@ public class GenExtKeyUsage { DerOutputStream contents = new DerOutputStream(); for (int i = 0; i < oids.size(); i++) { - contents.putOID((ObjectIdentifier) oids.elementAt(i)); + contents.putOID(oids.elementAt(i)); } // stuff the object identifiers into a SEQUENCE diff --git a/pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java b/pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java index 671a175f7..9d9142927 100644 --- a/pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java +++ b/pki/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java @@ -190,7 +190,7 @@ public class PrettyPrintCert { CertificateSubjectName csn = (CertificateSubjectName) certinfo.get(X509CertInfo.SUBJECT); - Enumeration en = csn.getElements(); + Enumeration<String> en = csn.getAttributeNames(); X500Name dname = (X500Name) csn.get(CertificateSubjectName.DN_NAME); diff --git a/pki/base/kra/src/com/netscape/kra/EnrollmentService.java b/pki/base/kra/src/com/netscape/kra/EnrollmentService.java index 39a5d14b6..b9df360b0 100644 --- a/pki/base/kra/src/com/netscape/kra/EnrollmentService.java +++ b/pki/base/kra/src/com/netscape/kra/EnrollmentService.java @@ -522,14 +522,14 @@ public class EnrollmentService implements IService { BigInt privateKeyExponent = privateKeyDerIn.getInteger(); if (!publicKeyModulus.equals(privateKeyModulus)) { - CMS.debug("verifyKeyPair modulus mismatch publicKeyModulus=" + publicKeyModulus + " privateKeyModulus=" - + privateKeyModulus); + CMS.debug("verifyKeyPair modulus mismatch publicKeyModulus=" + + publicKeyModulus + " privateKeyModulus=" + privateKeyModulus); return false; } if (!publicKeyExponent.equals(privateKeyExponent)) { - CMS.debug("verifyKeyPair exponent mismatch publicKeyExponent=" + publicKeyExponent - + " privateKeyExponent=" + privateKeyExponent); + CMS.debug("verifyKeyPair exponent mismatch publicKeyExponent=" + + publicKeyExponent + " privateKeyExponent=" + privateKeyExponent); return false; } @@ -679,8 +679,8 @@ public class EnrollmentService implements IService { } catch (IOException e) { mKRA.log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_KRA_GET_PUBLIC_KEY", e.toString())); - throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTRIBUTE", "[" + CertificateX509Key.KEY - + "]" + e.toString())); + throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTRIBUTE", "[" + + CertificateX509Key.KEY + "]" + e.toString())); } return pKey; } @@ -715,13 +715,13 @@ public class EnrollmentService implements IService { } catch (IOException e) { mKRA.log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_KRA_GET_OWNER_NAME", e.toString())); - throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTRIBUTE", "[" + X509CertInfo.SUBJECT + "]" - + e.toString())); + throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTRIBUTE", "[" + + X509CertInfo.SUBJECT + "]" + e.toString())); } catch (CertificateException e) { mKRA.log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_KRA_GET_OWNER_NAME", e.toString())); - throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTRIBUTE", "[" + X509CertInfo.SUBJECT + "]" - + e.toString())); + throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTRIBUTE", "[" + + X509CertInfo.SUBJECT + "]" + e.toString())); } String owner = pSub.toString(); @@ -905,8 +905,9 @@ class ArchiveOptions { EncryptedContentInfo eCI = env_data.getEncryptedContentInfo(); symmAlg = eCI.getContentEncryptionAlgorithm(); mSymmAlgOID = symmAlg.getOID().toString(); - mSymmAlgParams = ((OCTET_STRING) ((ANY) symmAlg.getParameters()).decodeWith(OCTET_STRING.getTemplate())) - .toByteArray(); + mSymmAlgParams = + ((OCTET_STRING) ((ANY) symmAlg.getParameters()).decodeWith(OCTET_STRING.getTemplate())) + .toByteArray(); SET recipients = env_data.getRecipientInfos(); if (recipients.size() <= 0) { @@ -931,8 +932,9 @@ class ArchiveOptions { val = key.getEncryptedValue(); symmAlg = val.getSymmAlg(); mSymmAlgOID = symmAlg.getOID().toString(); - mSymmAlgParams = ((OCTET_STRING) ((ANY) symmAlg.getParameters()).decodeWith(OCTET_STRING.getTemplate())) - .toByteArray(); + mSymmAlgParams = + ((OCTET_STRING) ((ANY) symmAlg.getParameters()).decodeWith(OCTET_STRING.getTemplate())) + .toByteArray(); BIT_STRING encSymmKey = val.getEncSymmKey(); mEncSymmKey = encSymmKey.getBits(); diff --git a/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java b/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java index 7f523f339..4e35d982c 100644 --- a/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java +++ b/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java @@ -119,7 +119,8 @@ public class KeyRecoveryAuthority implements IAuthority, IKeyService, IKeyRecove protected IRequestNotifier mPNotify = null; protected ISubsystem mOwner = null; protected int mRecoveryIDCounter = 0; - protected Hashtable<String, Hashtable<String, Object>> mRecoveryParams = new Hashtable<String, Hashtable<String, Object>>(); + protected Hashtable<String, Hashtable<String, Object>> mRecoveryParams = + new Hashtable<String, Hashtable<String, Object>>(); protected org.mozilla.jss.crypto.X509Certificate mJssCert = null; protected CryptoToken mKeygenToken = null; @@ -1427,8 +1428,9 @@ public class KeyRecoveryAuthority implements IAuthority, IKeyService, IKeyRecove IConfigStore rq = nc.getSubStore(PROP_REQ_IN_Q_SUBSTORE); IAuthority cSub = (IAuthority) this; - String requestInQListenerClassName = nc.getString("certificateIssuedListenerClassName", - "com.netscape.cms.listeners.RequestInQListener"); + String requestInQListenerClassName = + nc.getString("certificateIssuedListenerClassName", + "com.netscape.cms.listeners.RequestInQListener"); try { mReqInQListener = (IRequestListener) Class.forName(requestInQListenerClassName).newInstance(); @@ -1481,7 +1483,8 @@ public class KeyRecoveryAuthority implements IAuthority, IKeyService, IKeyRecove } */ - public Hashtable<String, Hashtable<String, Object>> mVolatileRequests = new Hashtable<String, Hashtable<String, Object>>(); + public Hashtable<String, Hashtable<String, Object>> mVolatileRequests = + new Hashtable<String, Hashtable<String, Object>>(); /** * Creates a request object to store attributes that diff --git a/pki/base/kra/src/com/netscape/kra/RecoveryService.java b/pki/base/kra/src/com/netscape/kra/RecoveryService.java index 719a55d30..8958695c1 100644 --- a/pki/base/kra/src/com/netscape/kra/RecoveryService.java +++ b/pki/base/kra/src/com/netscape/kra/RecoveryService.java @@ -350,14 +350,14 @@ public class RecoveryService implements IService { BigInt privateKeyExponent = privateKeyDerIn.getInteger(); if (!publicKeyModulus.equals(privateKeyModulus)) { - CMS.debug("verifyKeyPair modulus mismatch publicKeyModulus=" + publicKeyModulus + " privateKeyModulus=" - + privateKeyModulus); + CMS.debug("verifyKeyPair modulus mismatch publicKeyModulus=" + + publicKeyModulus + " privateKeyModulus=" + privateKeyModulus); return false; } if (!publicKeyExponent.equals(privateKeyExponent)) { - CMS.debug("verifyKeyPair exponent mismatch publicKeyExponent=" + publicKeyExponent - + " privateKeyExponent=" + privateKeyExponent); + CMS.debug("verifyKeyPair exponent mismatch publicKeyExponent=" + + publicKeyExponent + " privateKeyExponent=" + privateKeyExponent); return false; } diff --git a/pki/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java b/pki/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java index 667bb8987..0b84926d1 100644 --- a/pki/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java +++ b/pki/base/kra/src/com/netscape/kra/TokenKeyRecoveryService.java @@ -558,14 +558,14 @@ public class TokenKeyRecoveryService implements IService { BigInt privateKeyExponent = privateKeyDerIn.getInteger(); if (!publicKeyModulus.equals(privateKeyModulus)) { - CMS.debug("verifyKeyPair modulus mismatch publicKeyModulus=" + publicKeyModulus + " privateKeyModulus=" - + privateKeyModulus); + CMS.debug("verifyKeyPair modulus mismatch publicKeyModulus=" + + publicKeyModulus + " privateKeyModulus=" + privateKeyModulus); return false; } if (!publicKeyExponent.equals(privateKeyExponent)) { - CMS.debug("verifyKeyPair exponent mismatch publicKeyExponent=" + publicKeyExponent - + " privateKeyExponent=" + privateKeyExponent); + CMS.debug("verifyKeyPair exponent mismatch publicKeyExponent=" + + publicKeyExponent + " privateKeyExponent=" + privateKeyExponent); return false; } diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java b/pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java index 3fd9100ba..d0222897d 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java @@ -464,7 +464,8 @@ public class CMSLDAP { public boolean TurnOnSSL(String certPrefix, String certName, String sslport) { String dn; - String CIPHERS = "-rsa_null_md5,+rsa_fips_3des_sha,+rsa_fips_des_sha,+rsa_3des_sha,+rsa_rc4_128_md5,+rsa_des_sha,+rsa_rc2_40_md5,+rsa_rc4_40_md5"; + String CIPHERS = + "-rsa_null_md5,+rsa_fips_3des_sha,+rsa_fips_des_sha,+rsa_3des_sha,+rsa_rc4_128_md5,+rsa_des_sha,+rsa_rc2_40_md5,+rsa_rc4_40_md5"; try { boolean found = false; @@ -558,7 +559,8 @@ public class CMSLDAP { String PASSWORD = args[3]; String BASEDN = args[4]; - String s = "MIICFzCCAYCgAwIBAgIBBjANBgkqhkiG9w0BAQQFADBDMRswGQYDVQQKExJhY2NlcHRhY25ldGVz\ndDEwMjQxFzAVBgNVBAsTDmFjY2VwdGFuY2V0ZXN0MQswCQYDVQQDEwJjYTAeFw0wMzA0MTEyMTUx\nMzZaFw0wNDA0MTAwOTQ2NTVaMFwxCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNTU0wxHTAbBgNVBAsT\nFHNzbHRlc3QxMDUwMDk3ODkzNzQ1MSAwHgYDVQQDExdqdXBpdGVyMi5uc2NwLmFvbHR3Lm5ldDBc\nMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDCsCTIIQ+bJMfPHi6kwa7HF+/xSTVHcpZ5zsodXsNWjPlD\noRu/5KAO8NotfwGnYmALWdYnqXCF0q0gkaJQalQTAgMBAAGjRjBEMA4GA1UdDwEB/wQEAwIFoDAR\nBglghkgBhvhCAQEEBAMCBkAwHwYDVR0jBBgwFoAUzxZkSySZT/Y3SxGMEiNyHnLUOPAwDQYJKoZI\nhvcNAQEEBQADgYEALtpqMOtZt6j5KlghDFgdg/dvf36nWiZwC1ap6+ka22shLkA/RjmOix97btzT\nQ+8LcmdkAW5iap4YbtrCu0wdN6IbIEXoQI1QGZBoKO2o02utssXANmTnRCyH/GX2KefQlp1NSRj9\nZNZ+GRT2Qk/8G5Ds9vVjm1I5+/AkzI9jS14="; + String s = + "MIICFzCCAYCgAwIBAgIBBjANBgkqhkiG9w0BAQQFADBDMRswGQYDVQQKExJhY2NlcHRhY25ldGVz\ndDEwMjQxFzAVBgNVBAsTDmFjY2VwdGFuY2V0ZXN0MQswCQYDVQQDEwJjYTAeFw0wMzA0MTEyMTUx\nMzZaFw0wNDA0MTAwOTQ2NTVaMFwxCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNTU0wxHTAbBgNVBAsT\nFHNzbHRlc3QxMDUwMDk3ODkzNzQ1MSAwHgYDVQQDExdqdXBpdGVyMi5uc2NwLmFvbHR3Lm5ldDBc\nMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDCsCTIIQ+bJMfPHi6kwa7HF+/xSTVHcpZ5zsodXsNWjPlD\noRu/5KAO8NotfwGnYmALWdYnqXCF0q0gkaJQalQTAgMBAAGjRjBEMA4GA1UdDwEB/wQEAwIFoDAR\nBglghkgBhvhCAQEEBAMCBkAwHwYDVR0jBBgwFoAUzxZkSySZT/Y3SxGMEiNyHnLUOPAwDQYJKoZI\nhvcNAQEEBQADgYEALtpqMOtZt6j5KlghDFgdg/dvf36nWiZwC1ap6+ka22shLkA/RjmOix97btzT\nQ+8LcmdkAW5iap4YbtrCu0wdN6IbIEXoQI1QGZBoKO2o02utssXANmTnRCyH/GX2KefQlp1NSRj9\nZNZ+GRT2Qk/8G5Ds9vVjm1I5+/AkzI9jS14="; s = "-----BEGIN CERTIFICATE-----" + "\n" + s + "\n" + "-----END CERTIFICATE-----\n"; diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/Request.java b/pki/base/silent/src/com/netscape/pkisilent/common/Request.java index 9b5a88b15..9ee700013 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/Request.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/Request.java @@ -476,7 +476,10 @@ public class Request extends TestClient { } // System.out.println("Debug : Retrieving cert details "); - sslclient = clientcert = servercert = emailcert = objectsigningcert = sslcacert = objectsigningcacert = emailcacert = "false"; + sslclient = + clientcert = + servercert = + emailcert = objectsigningcert = sslcacert = objectsigningcacert = emailcacert = "false"; ret = res.indexOf("header.sslclient ="); if (ret > 0) { sslclient = res.substring(ret + "header.sslclient = ".length() + 1, diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/TestClient.java b/pki/base/silent/src/com/netscape/pkisilent/common/TestClient.java index c5744fe6e..87161d689 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/TestClient.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/TestClient.java @@ -756,7 +756,8 @@ public class TestClient implements SSLCertificateApprovalCallback { ************************************************************* */ - String TransportCert = "MIICJTCCAY6gAwIBAgIBBTANBgkqhkiG9w0BAQQFADBDMRswGQYDVQQKExJhY2NlcHRhY25ldGVzdDEwMjQxFzAVBgNVBAsTDmFjY2VwdGFuY2V0ZXN0MQswCQYDVQQDEwJjYTAeFw0wMzA0MTgyMjMwMDhaFw0wNDA0MTcxMDI2MDhaMDkxETAPBgNVBAoTCHRlc3QxMDI0MRcwFQYDVQQLEw5hY2NlcHRhbmNldGVzdDELMAkGA1UEAxMCcmEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAN6sQ3mSU8mL6i6gTZIXDLzOZPhYOkQLpnJjit5hcPZ0JMn0CQVXo4QjKN1xvuZv8qVlZoQw9czmzp/knTa0sCDgFKd0r+u0TnLeZkJMSimgFnma9CnChlaDHnBd8Beu4vyaHmo7rJ0xA4etn7HjhmKbaQZOcv/aP0SW9JXRga7ZAgMBAAGjMzAxMA4GA1UdDwEB/wQEAwIFIDAfBgNVHSMEGDAWgBSC3fsQHb7fddr2vL0UdkM2dAmUWzANBgkqhkiG9w0BAQQFAAOBgQBkAGbgd9HIqwoLKAr+V6bj9oWesDmDH80gPPxj10qyWSQYIs8PofOs/75yGS9nxhydtgSMFoBgCPdroUI31kZQQlFzxtudGoKD+5MWSXho79XzPwpjheOBYgpX6ch+L4tMLFDpqeraB1yZESO5EEeKm20DGVBOKVWxHhddO1BenA=="; + String TransportCert = + "MIICJTCCAY6gAwIBAgIBBTANBgkqhkiG9w0BAQQFADBDMRswGQYDVQQKExJhY2NlcHRhY25ldGVzdDEwMjQxFzAVBgNVBAsTDmFjY2VwdGFuY2V0ZXN0MQswCQYDVQQDEwJjYTAeFw0wMzA0MTgyMjMwMDhaFw0wNDA0MTcxMDI2MDhaMDkxETAPBgNVBAoTCHRlc3QxMDI0MRcwFQYDVQQLEw5hY2NlcHRhbmNldGVzdDELMAkGA1UEAxMCcmEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAN6sQ3mSU8mL6i6gTZIXDLzOZPhYOkQLpnJjit5hcPZ0JMn0CQVXo4QjKN1xvuZv8qVlZoQw9czmzp/knTa0sCDgFKd0r+u0TnLeZkJMSimgFnma9CnChlaDHnBd8Beu4vyaHmo7rJ0xA4etn7HjhmKbaQZOcv/aP0SW9JXRga7ZAgMBAAGjMzAxMA4GA1UdDwEB/wQEAwIFIDAfBgNVHSMEGDAWgBSC3fsQHb7fddr2vL0UdkM2dAmUWzANBgkqhkiG9w0BAQQFAAOBgQBkAGbgd9HIqwoLKAr+V6bj9oWesDmDH80gPPxj10qyWSQYIs8PofOs/75yGS9nxhydtgSMFoBgCPdroUI31kZQQlFzxtudGoKD+5MWSXho79XzPwpjheOBYgpX6ch+L4tMLFDpqeraB1yZESO5EEeKm20DGVBOKVWxHhddO1BenA=="; /* CRMFClient CrmfClient = new CRMFClient(s.GetHostName(),s.GetEEPort()); diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java b/pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java index 75f94261c..9aaf6c4d9 100644 --- a/pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java +++ b/pki/base/silent/src/com/netscape/pkisilent/common/Utilities.java @@ -20,7 +20,6 @@ package com.netscape.pkisilent.common; import java.io.DataInputStream; import java.io.FileInputStream; -import java.util.Enumeration; import netscape.security.x509.CertificateSerialNumber; import netscape.security.x509.CertificateSubjectName; @@ -33,10 +32,6 @@ import netscape.security.x509.X509CertInfo; import com.netscape.osutil.OSUtil; public class Utilities { - private static final String keyValueSeparators = "=: \t\r\n\f"; - private static final String strictKeyValueSeparators = "=:"; - private static final String specialSaveChars = " \t\r\n\f"; - private static final String whiteSpaceChars = " \t\r\n\f"; public Utilities() {// Do nothing } @@ -328,9 +323,6 @@ public class Utilities { CertificateSubjectName csn1 = (CertificateSubjectName) certinfo.get(X509CertInfo.SUBJECT); - @SuppressWarnings("unchecked") - Enumeration<String> en = csn1.getElements(); - X500Name dname = (X500Name) csn1.get(CertificateSubjectName.DN_NAME); String pp = ""; 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 e2d5d156a..cad7d0ae3 100644 --- a/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java +++ b/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java @@ -945,10 +945,11 @@ public class CryptoUtil { throws CryptoManager.NotInitializedException, TokenException { CryptoManager cm = CryptoManager.getInstance(); - Enumeration enums = cm.getAllTokens(); + @SuppressWarnings("unchecked") + Enumeration<CryptoToken> enums = cm.getAllTokens(); while (enums.hasMoreElements()) { - CryptoToken token = (CryptoToken) enums.nextElement(); + CryptoToken token = enums.nextElement(); String tokenName = token.getName(); CryptoStore store = token.getCryptoStore(); PrivateKey keys[] = store.getPrivateKeys(); @@ -970,9 +971,10 @@ public class CryptoUtil { public static X509CertImpl[] getAllUserCerts() throws CryptoManager.NotInitializedException, TokenException { - Vector certs = new Vector(); + Vector<X509CertImpl> certs = new Vector<X509CertImpl>(); CryptoManager cm = CryptoManager.getInstance(); - Enumeration enums = cm.getAllTokens(); + @SuppressWarnings("unchecked") + Enumeration<CryptoToken> enums = cm.getAllTokens(); while (enums.hasMoreElements()) { CryptoToken token = (CryptoToken) enums.nextElement(); diff --git a/pki/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java b/pki/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java index 2971706fa..a5dd108ae 100644 --- a/pki/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java +++ b/pki/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java @@ -25,6 +25,8 @@ import java.security.PublicKey; import java.util.Arrays; import java.util.Hashtable; +import netscape.security.pkcs.PKCS10; + import org.mozilla.jss.asn1.ANY; import org.mozilla.jss.asn1.ASN1Util; import org.mozilla.jss.asn1.INTEGER; @@ -191,16 +193,16 @@ public class CRSPKIMessage { private int rsdVersion; private byte[] rsdCert; // certificate to send in response - private Object myP10; + private PKCS10 myP10; - private Hashtable attrs; // miscellanous + private Hashtable<String, Object> attrs; // miscellanous // *** END *** // public void debug() { } - public void put(Object a, Object b) { + public void put(String a, Object b) { attrs.put(a, b); } @@ -475,7 +477,7 @@ public class CRSPKIMessage { certs, null, // no CRL's new SET() // empty SignerInfos - ); + ); ContentInfo wrap = new ContentInfo(ContentInfo.SIGNED_DATA, crsd); @@ -606,11 +608,11 @@ public class CRSPKIMessage { return aa_digest.toByteArray(); } - public Object getP10() { + public PKCS10 getP10() { return myP10; } - public void setP10(Object p10) { + public void setP10(PKCS10 p10) { myP10 = p10; } @@ -717,11 +719,11 @@ public class CRSPKIMessage { } public CRSPKIMessage() { - attrs = new Hashtable(); + attrs = new Hashtable<String, Object>(); } public CRSPKIMessage(ByteArrayInputStream bais) throws InvalidBERException, Exception { - attrs = new Hashtable(); + attrs = new Hashtable<String, Object>(); decodeCRSPKIMessage(bais); } diff --git a/pki/base/util/src/netscape/security/extensions/AuthInfoAccessExtension.java b/pki/base/util/src/netscape/security/extensions/AuthInfoAccessExtension.java index 1f5aa4e65..0bafcedd0 100644 --- a/pki/base/util/src/netscape/security/extensions/AuthInfoAccessExtension.java +++ b/pki/base/util/src/netscape/security/extensions/AuthInfoAccessExtension.java @@ -62,9 +62,6 @@ import netscape.security.x509.URIName; * @version $Revision$, $Date$ */ public class AuthInfoAccessExtension extends Extension implements CertAttrSet { - /** - * - */ private static final long serialVersionUID = 7373316523212538446L; public static final String NAME = "AuthInfoAccessExtension"; public static final String NAME2 = "AuthorityInformationAccess"; @@ -80,7 +77,7 @@ public class AuthInfoAccessExtension extends Extension implements CertAttrSet { public static final int OID[] = { 1, 3, 6, 1, 5, 5, 7, 1, 1 }; public static final ObjectIdentifier ID = new ObjectIdentifier(OID); - private Vector mDesc = new Vector(); + private Vector<AccessDescription> mDesc = new Vector<AccessDescription>(); /** * Create the extension from the passed DER encoded value of the same. @@ -136,7 +133,7 @@ public class AuthInfoAccessExtension extends Extension implements CertAttrSet { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration getElements() { + public Enumeration<String> getAttributeNames() { // NOT USED return null; } @@ -159,7 +156,7 @@ public class AuthInfoAccessExtension extends Extension implements CertAttrSet { } public AccessDescription getAccessDescription(int pos) { - return (AccessDescription) mDesc.elementAt(pos); + return mDesc.elementAt(pos); } /** @@ -190,7 +187,7 @@ public class AuthInfoAccessExtension extends Extension implements CertAttrSet { for (int i = 0; i < mDesc.size(); i++) { DerOutputStream tmp0 = new DerOutputStream(); - AccessDescription ad = (AccessDescription) mDesc.elementAt(i); + AccessDescription ad = mDesc.elementAt(i); tmp0.putOID(ad.getMethod()); ad.getLocation().encode(tmp0); @@ -223,7 +220,7 @@ public class AuthInfoAccessExtension extends Extension implements CertAttrSet { String s = super.toString() + "AuthInfoAccess [\n"; for (int i = 0; i < mDesc.size(); i++) { - AccessDescription ad = (AccessDescription) mDesc.elementAt(i); + AccessDescription ad = mDesc.elementAt(i); s += "(" + i + ")"; s += " "; diff --git a/pki/base/util/src/netscape/security/extensions/CertificateRenewalWindowExtension.java b/pki/base/util/src/netscape/security/extensions/CertificateRenewalWindowExtension.java index 2f402ce2f..018fd71c8 100644 --- a/pki/base/util/src/netscape/security/extensions/CertificateRenewalWindowExtension.java +++ b/pki/base/util/src/netscape/security/extensions/CertificateRenewalWindowExtension.java @@ -43,9 +43,6 @@ import netscape.security.x509.Extension; */ public class CertificateRenewalWindowExtension extends Extension implements CertAttrSet { - /** - * - */ private static final long serialVersionUID = 4470220533545299271L; public static final String NAME = "CertificateRenewalWindow"; public static final int OID[] = { 2, 16, 840, 1, 113730, 1, 15 }; @@ -114,7 +111,7 @@ public class CertificateRenewalWindowExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration getElements() { + public Enumeration<String> getAttributeNames() { // NOT USED return null; } diff --git a/pki/base/util/src/netscape/security/extensions/CertificateScopeOfUseExtension.java b/pki/base/util/src/netscape/security/extensions/CertificateScopeOfUseExtension.java index b31bd9985..16641f36b 100644 --- a/pki/base/util/src/netscape/security/extensions/CertificateScopeOfUseExtension.java +++ b/pki/base/util/src/netscape/security/extensions/CertificateScopeOfUseExtension.java @@ -54,7 +54,7 @@ public class CertificateScopeOfUseExtension extends Extension public static final int OID[] = { 2, 16, 840, 1, 113730, 1, 17 }; public static final ObjectIdentifier ID = new ObjectIdentifier(OID); - private Vector mEntries = null; + private Vector<CertificateScopeEntry> mEntries = null; static { try { @@ -64,7 +64,7 @@ public class CertificateScopeOfUseExtension extends Extension } } - public CertificateScopeOfUseExtension(boolean critical, Vector scopeEntries) + public CertificateScopeOfUseExtension(boolean critical, Vector<CertificateScopeEntry> scopeEntries) throws IOException { this.extensionId = ID; this.critical = critical; @@ -91,7 +91,7 @@ public class CertificateScopeOfUseExtension extends Extension return NAME; } - public Vector getCertificateScopeEntries() { + public Vector<CertificateScopeEntry> getCertificateScopeEntries() { return mEntries; } @@ -128,7 +128,7 @@ public class CertificateScopeOfUseExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration getElements() { + public Enumeration<String> getAttributeNames() { // NOT USED return null; } @@ -139,7 +139,7 @@ public class CertificateScopeOfUseExtension extends Extension if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding of CertificateWindow extension"); } - mEntries = new Vector(); + mEntries = new Vector<CertificateScopeEntry>(); while (val.data.available() != 0) { mEntries.addElement(new CertificateScopeEntry( val.data.getDerValue())); diff --git a/pki/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java b/pki/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java index 5b3f06e91..939da036f 100644 --- a/pki/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java +++ b/pki/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java @@ -55,13 +55,13 @@ public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet public static final ObjectIdentifier OID_CODE_SIGNING = new ObjectIdentifier(OID_OCSP_SIGNING_STR); - private Vector oidSet = null; + private Vector<ObjectIdentifier> oidSet = null; private byte mCached[] = null; static { try { OIDMap.addAttribute(ExtendedKeyUsageExtension.class.getName(), - OID, NAME); + OID, ExtendedKeyUsageExtension.NAME); } catch (CertificateException e) { } } @@ -70,7 +70,7 @@ public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet this(false, null); } - public ExtendedKeyUsageExtension(boolean crit, Vector oids) { + public ExtendedKeyUsageExtension(boolean crit, Vector<ObjectIdentifier> oids) { try { extensionId = ObjectIdentifier.getObjectIdentifier(OID); } catch (IOException e) { @@ -78,9 +78,9 @@ public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet } critical = crit; if (oids != null) { - oidSet = (Vector) oids.clone(); + oidSet = new Vector<ObjectIdentifier>(oids); } else { - oidSet = new Vector(); + oidSet = new Vector<ObjectIdentifier>(); } encodeExtValue(); } @@ -100,7 +100,7 @@ public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet } } - public Enumeration getOIDs() { + public Enumeration<ObjectIdentifier> getOIDs() { if (oidSet == null) return null; return oidSet.elements(); @@ -114,7 +114,7 @@ public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet public void addOID(ObjectIdentifier oid) { if (oidSet == null) { - oidSet = new Vector(); + oidSet = new Vector<ObjectIdentifier>(); } if (oidSet.contains(oid)) @@ -172,7 +172,7 @@ public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet return null; } - public Enumeration getElements() { + public Enumeration<String> getAttributeNames() { return null; } @@ -192,7 +192,7 @@ public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet throw new IOException("Invalid encoding of AuthInfoAccess extension"); } if (oidSet == null) - oidSet = new Vector(); + oidSet = new Vector<ObjectIdentifier>(); while (val.data.available() != 0) { DerValue oidVal = val.data.getDerValue(); @@ -205,7 +205,7 @@ public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet DerOutputStream temp = new DerOutputStream(); if (!oidSet.isEmpty()) { - Enumeration oidList = oidSet.elements(); + Enumeration<ObjectIdentifier> oidList = oidSet.elements(); try { while (oidList.hasMoreElements()) { diff --git a/pki/base/util/src/netscape/security/extensions/GenericASN1Extension.java b/pki/base/util/src/netscape/security/extensions/GenericASN1Extension.java index 617ebacd8..6e28b4a0e 100644 --- a/pki/base/util/src/netscape/security/extensions/GenericASN1Extension.java +++ b/pki/base/util/src/netscape/security/extensions/GenericASN1Extension.java @@ -34,7 +34,6 @@ import netscape.security.util.BigInt; import netscape.security.util.DerOutputStream; import netscape.security.util.DerValue; import netscape.security.util.ObjectIdentifier; - import netscape.security.x509.CertAttrSet; import netscape.security.x509.Extension; import netscape.security.x509.OIDMap; @@ -73,9 +72,9 @@ public class GenericASN1Extension extends Extension * Identifier for this attribute, to be used with the * get, set, delete methods of Certificate, x509 type. */ - public static String NAME = null; + private String name; public static String OID = null; - public static Hashtable mConfig = null; + public static Hashtable<String, String> mConfig = null; public static String pattern = null; private int index = 0; @@ -177,10 +176,11 @@ public class GenericASN1Extension extends Extension * * @param the values to be set for the extension. */ - public GenericASN1Extension(String name, String oid, String pattern, boolean critical, Hashtable config) + public GenericASN1Extension(String name, String oid, String pattern, boolean critical, + Hashtable<String, String> config) throws IOException, ParseException { ObjectIdentifier tmpid = new ObjectIdentifier(oid); - NAME = name; + this.name = name; OID = oid; mConfig = config; this.pattern = pattern; @@ -202,17 +202,17 @@ public class GenericASN1Extension extends Extension * * @param the values to be set for the extension. */ - public GenericASN1Extension(Hashtable config) + public GenericASN1Extension(Hashtable<String, String> config) throws IOException, ParseException { mConfig = config; ObjectIdentifier tmpid = new ObjectIdentifier((String) mConfig.get(PROP_OID)); - NAME = (String) mConfig.get(PROP_NAME); + name = (String) mConfig.get(PROP_NAME); OID = (String) mConfig.get(PROP_OID); pattern = (String) mConfig.get(PROP_PATTERN); try { if (OIDMap.getName(tmpid) == null) - OIDMap.addAttribute("GenericASN1Extension", OID, NAME); + OIDMap.addAttribute("GenericASN1Extension", OID, name); } catch (CertificateException e) { } @@ -311,14 +311,14 @@ public class GenericASN1Extension extends Extension * Return the name of this attribute. */ public String getName() { - return (NAME); + return name; } /** * Set the name of this attribute. */ public void setName(String name) { - NAME = name; + this.name = name; } /** @@ -339,7 +339,7 @@ public class GenericASN1Extension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement("octet"); diff --git a/pki/base/util/src/netscape/security/extensions/InhibitAnyPolicyExtension.java b/pki/base/util/src/netscape/security/extensions/InhibitAnyPolicyExtension.java index a09e089c3..81b8cf5b5 100644 --- a/pki/base/util/src/netscape/security/extensions/InhibitAnyPolicyExtension.java +++ b/pki/base/util/src/netscape/security/extensions/InhibitAnyPolicyExtension.java @@ -131,7 +131,7 @@ public class InhibitAnyPolicyExtension return null; } - public Enumeration getElements() { + public Enumeration<String> getAttributeNames() { return null; } diff --git a/pki/base/util/src/netscape/security/extensions/KerberosName.java b/pki/base/util/src/netscape/security/extensions/KerberosName.java index 269775d31..0a6a6e213 100644 --- a/pki/base/util/src/netscape/security/extensions/KerberosName.java +++ b/pki/base/util/src/netscape/security/extensions/KerberosName.java @@ -53,9 +53,9 @@ public class KerberosName { private String m_realm = null; private int m_name_type = 0; - private Vector m_name_strings = null; + private Vector<String> m_name_strings = null; - public KerberosName(String realm, int name_type, Vector name_strings) { + public KerberosName(String realm, int name_type, Vector<String> name_strings) { m_realm = realm; m_name_type = name_type; m_name_strings = name_strings; @@ -119,7 +119,7 @@ public class KerberosName { } public static void main(String[] argv) { - Vector strings = new Vector(); + Vector<String> strings = new Vector<String>(); strings.addElement("name"); KerberosName k = new KerberosName("realm", 0, strings); diff --git a/pki/base/util/src/netscape/security/extensions/NSCertTypeExtension.java b/pki/base/util/src/netscape/security/extensions/NSCertTypeExtension.java index 1415478bb..04b3038e5 100644 --- a/pki/base/util/src/netscape/security/extensions/NSCertTypeExtension.java +++ b/pki/base/util/src/netscape/security/extensions/NSCertTypeExtension.java @@ -114,7 +114,7 @@ public class NSCertTypeExtension extends Extension implements CertAttrSet { new MapEntry(OBJECT_SIGNING_CA, 7), }; - private static Vector mAttributeNames = new Vector(); + private static Vector<String> mAttributeNames = new Vector<String>(); static { for (int i = 0; i < mMapData.length; ++i) { @@ -361,7 +361,7 @@ public class NSCertTypeExtension extends Extension implements CertAttrSet { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration getElements() { + public Enumeration<String> getAttributeNames() { return mAttributeNames.elements(); } diff --git a/pki/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java b/pki/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java index 46abc3c1f..28da8085f 100644 --- a/pki/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java +++ b/pki/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java @@ -137,7 +137,7 @@ public class OCSPNoCheckExtension extends Extension implements CertAttrSet { return null; } - public Enumeration getElements() { + public Enumeration<String> getAttributeNames() { // NOT USED return null; } diff --git a/pki/base/util/src/netscape/security/extensions/PresenceServerExtension.java b/pki/base/util/src/netscape/security/extensions/PresenceServerExtension.java index 1dafed19a..a90abe7e3 100644 --- a/pki/base/util/src/netscape/security/extensions/PresenceServerExtension.java +++ b/pki/base/util/src/netscape/security/extensions/PresenceServerExtension.java @@ -230,7 +230,7 @@ public class PresenceServerExtension extends Extension implements CertAttrSet { throw new IOException("Method not to be called directly."); } - public Enumeration getElements() { + public Enumeration<String> getAttributeNames() { return null; } diff --git a/pki/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java b/pki/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java index 2e9d7935d..d78ad0344 100644 --- a/pki/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java +++ b/pki/base/util/src/netscape/security/extensions/SubjectInfoAccessExtension.java @@ -44,9 +44,6 @@ import netscape.security.x509.URIName; * @version $Revision$, $Date$ */ public class SubjectInfoAccessExtension extends Extension implements CertAttrSet { - /** - * - */ private static final long serialVersionUID = 7237321566602583325L; public static final String NAME = "SubjectInfoAccessExtension"; @@ -62,7 +59,7 @@ public class SubjectInfoAccessExtension extends Extension implements CertAttrSet public static final int OID[] = { 1, 3, 6, 1, 5, 5, 7, 1, 11 }; public static final ObjectIdentifier ID = new ObjectIdentifier(OID); - private Vector mDesc = new Vector(); + private Vector<AccessDescription> mDesc = new Vector<AccessDescription>(); /** * Create the extension from the passed DER encoded value of the same. @@ -118,7 +115,7 @@ public class SubjectInfoAccessExtension extends Extension implements CertAttrSet * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration getElements() { + public Enumeration<String> getAttributeNames() { // NOT USED return null; } @@ -141,7 +138,7 @@ public class SubjectInfoAccessExtension extends Extension implements CertAttrSet } public AccessDescription getAccessDescription(int pos) { - return (AccessDescription) mDesc.elementAt(pos); + return mDesc.elementAt(pos); } /** @@ -172,7 +169,7 @@ public class SubjectInfoAccessExtension extends Extension implements CertAttrSet for (int i = 0; i < mDesc.size(); i++) { DerOutputStream tmp0 = new DerOutputStream(); - AccessDescription ad = (AccessDescription) mDesc.elementAt(i); + AccessDescription ad = mDesc.elementAt(i); tmp0.putOID(ad.getMethod()); ad.getLocation().encode(tmp0); @@ -205,7 +202,7 @@ public class SubjectInfoAccessExtension extends Extension implements CertAttrSet String s = super.toString() + "AuthInfoAccess [\n"; for (int i = 0; i < mDesc.size(); i++) { - AccessDescription ad = (AccessDescription) mDesc.elementAt(i); + AccessDescription ad = mDesc.elementAt(i); s += "(" + i + ")"; s += " "; diff --git a/pki/base/util/src/netscape/security/pkcs/PKCS10Attribute.java b/pki/base/util/src/netscape/security/pkcs/PKCS10Attribute.java index 520b3e969..a649c395a 100644 --- a/pki/base/util/src/netscape/security/pkcs/PKCS10Attribute.java +++ b/pki/base/util/src/netscape/security/pkcs/PKCS10Attribute.java @@ -114,17 +114,18 @@ public class PKCS10Attribute implements DerEncoder, Serializable { } } byte[] val = inAttrValue.toByteArray(); - Class[] params = { Object.class }; + Class<?>[] params = { Object.class }; try { - Class extClass = OIDMap.getClass(attributeId); + @SuppressWarnings("unchecked") + Class<CertAttrSet> extClass = (Class<CertAttrSet>) OIDMap.getClass(attributeId); if (extClass != null) { - Constructor cons = extClass.getConstructor(params); + Constructor<CertAttrSet> cons = (Constructor<CertAttrSet>) extClass.getConstructor(params); Object value = Array.newInstance(byte.class, val.length); for (int i = 0; i < val.length; i++) { Array.setByte(value, i, val[i]); } Object[] passed = new Object[] { value }; - attributeValue = (CertAttrSet) cons.newInstance(passed); + attributeValue = cons.newInstance(passed); } else { // attribute classes are usable for PKCS10 attributes. // this is used where the attributes are not actual diff --git a/pki/base/util/src/netscape/security/pkcs/PKCS9Attribute.java b/pki/base/util/src/netscape/security/pkcs/PKCS9Attribute.java index ef0f6a481..6a6fd7dc9 100644 --- a/pki/base/util/src/netscape/security/pkcs/PKCS9Attribute.java +++ b/pki/base/util/src/netscape/security/pkcs/PKCS9Attribute.java @@ -100,7 +100,8 @@ public class PKCS9Attribute implements DerEncoder { * attributes to their OIDs. This table contains all name forms * that occur in PKCS9, in lower case. */ - private static final Hashtable NAME_OID_TABLE = new Hashtable(28); + private static final Hashtable<String, ObjectIdentifier> NAME_OID_TABLE = new Hashtable<String, ObjectIdentifier>( + 28); static { // static initializer for PCKS9_NAMES NAME_OID_TABLE.put("emailaddress", PKCS9_OIDS[1]); @@ -124,7 +125,8 @@ public class PKCS9Attribute implements DerEncoder { * Hashtable mapping attribute OIDs defined in PKCS9 to the * corresponding attribute value type. */ - private static final Hashtable OID_NAME_TABLE = new Hashtable(14); + private static final Hashtable<ObjectIdentifier, String> OID_NAME_TABLE = new Hashtable<ObjectIdentifier, String>( + 14); static { OID_NAME_TABLE.put(PKCS9_OIDS[1], EMAIL_ADDRESS_STR); OID_NAME_TABLE.put(PKCS9_OIDS[2], UNSTRUCTURED_NAME_STR); @@ -167,7 +169,7 @@ public class PKCS9Attribute implements DerEncoder { null, //PublicKey null, //SigningDescription { Byte.valueOf(DerValue.tag_Sequence) } //ExtensionRequest - }; + }; /** * Class types required for values for a given PKCS9 @@ -286,35 +288,25 @@ public class PKCS9Attribute implements DerEncoder { * * </TABLE> */ - private static final Class[] VALUE_CLASSES = new Class[15]; + private static final Class<?>[] VALUE_CLASSES = new Class[15]; static { - try { - Class str = Class.forName("[Ljava.lang.String;"); - - VALUE_CLASSES[0] = null; // not used - VALUE_CLASSES[1] = str; // EMailAddress - VALUE_CLASSES[2] = str; // UnstructuredName - VALUE_CLASSES[3] = // ContentType - Class.forName("netscape.security.util.ObjectIdentifier"); - VALUE_CLASSES[4] = Class.forName("[B"); // MessageDigest (byte[]) - VALUE_CLASSES[5] = Class.forName("java.util.Date"); // SigningTime - VALUE_CLASSES[6] = // Countersignature - Class.forName("[Lnetscape.security.pkcs.SignerInfo;"); - VALUE_CLASSES[7] = // ChallengePassword - Class.forName("java.lang.String"); - VALUE_CLASSES[8] = str; // UnstructuredAddress - VALUE_CLASSES[9] = null; // ExtendedCertificateAttributes - - VALUE_CLASSES[10] = null; // IssuerAndSerialNumber - VALUE_CLASSES[11] = null; // PasswordCheck - VALUE_CLASSES[12] = null; // PublicKey - VALUE_CLASSES[13] = null; // SigningDescription - VALUE_CLASSES[14] = // ExtensionRequest - Class.forName("netscape.security.x509.CertificateExtensions"); //xxxx - } catch (ClassNotFoundException e) { - throw new ExceptionInInitializerError(e.toString()); - } + VALUE_CLASSES[0] = null; // not used + VALUE_CLASSES[1] = String[].class; // EMailAddress + VALUE_CLASSES[2] = String[].class; // UnstructuredName + VALUE_CLASSES[3] = ObjectIdentifier.class; // ContentType + VALUE_CLASSES[4] = byte[].class; // MessageDigest (byte[]) + VALUE_CLASSES[5] = Date.class; // SigningTime + VALUE_CLASSES[6] = SignerInfo[].class; // Countersignature + VALUE_CLASSES[7] = String.class; // ChallengePassword + VALUE_CLASSES[8] = String[].class; // UnstructuredAddress + VALUE_CLASSES[9] = null; // ExtendedCertificateAttributes + + VALUE_CLASSES[10] = null; // IssuerAndSerialNumber + VALUE_CLASSES[11] = null; // PasswordCheck + VALUE_CLASSES[12] = null; // PublicKey + VALUE_CLASSES[13] = null; // SigningDescription + VALUE_CLASSES[14] = CertificateExtensions.class; // ExtensionRequest } /** diff --git a/pki/base/util/src/netscape/security/provider/X509CertificateFactory.java b/pki/base/util/src/netscape/security/provider/X509CertificateFactory.java index 4c5ab00d8..9780983a5 100644 --- a/pki/base/util/src/netscape/security/provider/X509CertificateFactory.java +++ b/pki/base/util/src/netscape/security/provider/X509CertificateFactory.java @@ -36,7 +36,7 @@ public class X509CertificateFactory extends CertificateFactorySpi { return new X509CertImpl(inStream); } - public Collection engineGenerateCertificates(InputStream inStream) + public Collection<Certificate> engineGenerateCertificates(InputStream inStream) throws CertificateException { return null; } @@ -53,7 +53,7 @@ public class X509CertificateFactory extends CertificateFactorySpi { return crl; } - public Collection engineGenerateCRLs(InputStream inStream) + public Collection<CRL> engineGenerateCRLs(InputStream inStream) throws CRLException { return null; } diff --git a/pki/base/util/src/netscape/security/util/CertPrettyPrint.java b/pki/base/util/src/netscape/security/util/CertPrettyPrint.java index 86449c232..3a8c65fd0 100644 --- a/pki/base/util/src/netscape/security/util/CertPrettyPrint.java +++ b/pki/base/util/src/netscape/security/util/CertPrettyPrint.java @@ -125,8 +125,8 @@ public class CertPrettyPrint { SET certs = sd.getCertificates(); for (int i = 0; i < certs.size(); i++) { - org.mozilla.jss.pkix.cert.Certificate cert = (org.mozilla.jss.pkix.cert.Certificate) certs - .elementAt(i); + org.mozilla.jss.pkix.cert.Certificate cert = + (org.mozilla.jss.pkix.cert.Certificate) certs.elementAt(i); X509CertImpl certImpl = null; try { certImpl = new X509CertImpl( diff --git a/pki/base/util/src/netscape/security/util/CrlPrettyPrint.java b/pki/base/util/src/netscape/security/util/CrlPrettyPrint.java index afb5d352a..edf1217ea 100644 --- a/pki/base/util/src/netscape/security/util/CrlPrettyPrint.java +++ b/pki/base/util/src/netscape/security/util/CrlPrettyPrint.java @@ -26,7 +26,7 @@ import java.util.TimeZone; import netscape.security.x509.CRLExtensions; import netscape.security.x509.Extension; -import netscape.security.x509.RevokedCertImpl; +import netscape.security.x509.RevokedCertificate; import netscape.security.x509.X509CRLImpl; /** @@ -174,15 +174,14 @@ public class CrlPrettyPrint { } sb.append("\n"); - Set revokedCerts = mCRL.getRevokedCertificates(); + Set<RevokedCertificate> revokedCerts = mCRL.getRevokedCertificates(); if (revokedCerts != null) { - Iterator i = revokedCerts.iterator(); + Iterator<RevokedCertificate> i = revokedCerts.iterator(); long l = 1; while ((i.hasNext()) && ((crlSize == 0) || (pageStart + pageSize > l))) { - RevokedCertImpl revokedCert = - (RevokedCertImpl) i.next(); + RevokedCertificate revokedCert = i.next(); if ((crlSize == 0) || ((pageStart <= l) && (pageStart + pageSize > l))) { sb.append(pp.indent(16) + resource.getString( diff --git a/pki/base/util/src/netscape/security/util/ExtPrettyPrint.java b/pki/base/util/src/netscape/security/util/ExtPrettyPrint.java index 51ddf2321..90d0d094f 100644 --- a/pki/base/util/src/netscape/security/util/ExtPrettyPrint.java +++ b/pki/base/util/src/netscape/security/util/ExtPrettyPrint.java @@ -504,7 +504,7 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 4) + mResource.getString( PrettyPrintResources.TOKEN_EXTENDED_KEY_USAGE) + "\n"); ExtendedKeyUsageExtension usage = (ExtendedKeyUsageExtension) mExt; - Enumeration e = usage.getOIDs(); + Enumeration<ObjectIdentifier> e = usage.getOIDs(); if (e != null) { while (e.hasMoreElements()) { @@ -589,8 +589,8 @@ public class ExtPrettyPrint { try { sb.append(pp.indent(mIndentSize) + mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER)); - sb.append(mResource.getString(PrettyPrintResources.TOKEN_CERT_TYPE) + "- " - + mExt.getExtensionId().toString() + "\n"); + sb.append(mResource.getString(PrettyPrintResources.TOKEN_CERT_TYPE) + + "- " + mExt.getExtensionId().toString() + "\n"); sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); @@ -619,8 +619,8 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 8) + mResource.getString(NSCertTypeExtension.EMAIL_CA) + "\n"); } if (((Boolean) type.get(NSCertTypeExtension.OBJECT_SIGNING_CA)).booleanValue()) { - sb.append(pp.indent(mIndentSize + 8) + mResource.getString(NSCertTypeExtension.OBJECT_SIGNING_CA) - + "\n"); + sb.append(pp.indent(mIndentSize + 8) + + mResource.getString(NSCertTypeExtension.OBJECT_SIGNING_CA) + "\n"); } return sb.toString(); } catch (Exception e) { @@ -637,8 +637,8 @@ public class ExtPrettyPrint { try { sb.append(pp.indent(mIndentSize) + mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER)); - sb.append(mResource.getString(PrettyPrintResources.TOKEN_SKI) + "- " + mExt.getExtensionId().toString() - + "\n"); + sb.append(mResource.getString(PrettyPrintResources.TOKEN_SKI) + + "- " + mExt.getExtensionId().toString() + "\n"); sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); @@ -666,8 +666,8 @@ public class ExtPrettyPrint { try { sb.append(pp.indent(mIndentSize) + mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER)); - sb.append(mResource.getString(PrettyPrintResources.TOKEN_AKI) + "- " + mExt.getExtensionId().toString() - + "\n"); + sb.append(mResource.getString(PrettyPrintResources.TOKEN_AKI) + + "- " + mExt.getExtensionId().toString() + "\n"); sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); @@ -973,12 +973,12 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL)); CertificateScopeOfUseExtension ext = (CertificateScopeOfUseExtension) mExt; - if (((Extension) mExt).isCritical()) { + if (mExt.isCritical()) { sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n"); } else { sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n"); } - Vector entries = ext.getCertificateScopeEntries(); + Vector<CertificateScopeEntry> entries = ext.getCertificateScopeEntries(); if (entries != null) { sb.append(pp.indent(mIndentSize + 4) + @@ -1474,7 +1474,7 @@ public class ExtPrettyPrint { } PolicyMappingsExtension ext = (PolicyMappingsExtension) mExt; - Enumeration maps = ext.getMappings(); + Enumeration<CertificatePolicyMap> maps = ext.getMappings(); sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_MAPPINGS)); @@ -1530,7 +1530,7 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_ATTRIBUTES)); - Enumeration attrs = ext.getAttributesList(); + Enumeration<Attribute> attrs = ext.getAttributesList(); if (attrs == null || !attrs.hasMoreElements()) { sb.append( @@ -1550,7 +1550,7 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 12) + mResource.getString( PrettyPrintResources.TOKEN_VALUES)); - Enumeration values = attr.getValues(); + Enumeration<String> values = attr.getValues(); if (values == null || !values.hasMoreElements()) { sb.append(mResource.getString( @@ -1593,15 +1593,16 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 4) + mResource.getString( PrettyPrintResources.TOKEN_CERT_POLICIES) + "\n"); CertificatePoliciesExtension cp = (CertificatePoliciesExtension) mExt; - Vector cpv = (Vector) cp.get("infos"); - Enumeration e = cpv.elements(); + @SuppressWarnings("unchecked") + Vector<CertificatePolicyInfo> cpv = (Vector<CertificatePolicyInfo>) cp.get("infos"); + Enumeration<CertificatePolicyInfo> e = cpv.elements(); if (e != null) { while (e.hasMoreElements()) { - CertificatePolicyInfo cpi = (CertificatePolicyInfo) e.nextElement(); + CertificatePolicyInfo cpi = e.nextElement(); - sb.append(pp.indent(mIndentSize + 8) + "Policy Identifier: " - + cpi.getPolicyIdentifier().getIdentifier().toString() + "\n"); + sb.append(pp.indent(mIndentSize + 8) + + "Policy Identifier: " + cpi.getPolicyIdentifier().getIdentifier().toString() + "\n"); PolicyQualifiers cpq = cpi.getPolicyQualifiers(); if (cpq != null) { for (int i = 0; i < cpq.size(); i++) { @@ -1611,8 +1612,8 @@ public class ExtPrettyPrint { sb.append(pp.indent(mIndentSize + 12) + "Policy Qualifier Identifier: CPS Pointer Qualifier - " + pq.getId() + "\n"); - sb.append(pp.indent(mIndentSize + 12) + "Policy Qualifier Data: " - + ((CPSuri) q).getURI() + "\n"); + sb.append(pp.indent(mIndentSize + 12) + + "Policy Qualifier Data: " + ((CPSuri) q).getURI() + "\n"); } else if (q instanceof UserNotice) { sb.append(pp.indent(mIndentSize + 12) + "Policy Qualifier Identifier: CPS User Notice Qualifier - " @@ -1621,8 +1622,8 @@ public class ExtPrettyPrint { DisplayText dt = ((UserNotice) q).getDisplayText(); sb.append(pp.indent(mIndentSize + 12) + "Policy Qualifier Data: \n"); if (nref != null) { - sb.append(pp.indent(mIndentSize + 16) + "Organization: " - + nref.getOrganization().toString() + "\n"); + sb.append(pp.indent(mIndentSize + 16) + + "Organization: " + nref.getOrganization().toString() + "\n"); sb.append(pp.indent(mIndentSize + 16) + "Notice Numbers: "); int[] nums = nref.getNumbers(); for (int k = 0; k < nums.length; k++) { diff --git a/pki/base/util/src/netscape/security/x509/ACertAttrSet.java b/pki/base/util/src/netscape/security/x509/ACertAttrSet.java index 57d9445c3..8a757d7f5 100755 --- a/pki/base/util/src/netscape/security/x509/ACertAttrSet.java +++ b/pki/base/util/src/netscape/security/x509/ACertAttrSet.java @@ -126,7 +126,7 @@ public class ACertAttrSet implements CertAttrSet { * * @return an enumeration of the attribute names. */ - public Enumeration getElements() { + public Enumeration<String> getAttributeNames() { return null; } diff --git a/pki/base/util/src/netscape/security/x509/AlgorithmId.java b/pki/base/util/src/netscape/security/x509/AlgorithmId.java index a30d45ca0..b0113af41 100644 --- a/pki/base/util/src/netscape/security/x509/AlgorithmId.java +++ b/pki/base/util/src/netscape/security/x509/AlgorithmId.java @@ -760,7 +760,8 @@ public class AlgorithmId implements Serializable, DerEncoder { * All supported signing algorithms. */ public static final String[] ALL_SIGNING_ALGORITHMS = new String[] - { "SHA1withRSA", "MD5withRSA", "MD2withRSA", "SHA1withDSA", "SHA256withRSA", "SHA512withRSA", "SHA1withEC", + { + "SHA1withRSA", "MD5withRSA", "MD2withRSA", "SHA1withDSA", "SHA256withRSA", "SHA512withRSA", "SHA1withEC", "SHA256withEC", "SHA384withEC", "SHA512withEC" }; } diff --git a/pki/base/util/src/netscape/security/x509/AuthorityKeyIdentifierExtension.java b/pki/base/util/src/netscape/security/x509/AuthorityKeyIdentifierExtension.java index b7f84f9f7..91b6c2598 100644 --- a/pki/base/util/src/netscape/security/x509/AuthorityKeyIdentifierExtension.java +++ b/pki/base/util/src/netscape/security/x509/AuthorityKeyIdentifierExtension.java @@ -322,7 +322,7 @@ public class AuthorityKeyIdentifierExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(KEY_ID); elements.addElement(AUTH_NAME); diff --git a/pki/base/util/src/netscape/security/x509/BasicConstraintsExtension.java b/pki/base/util/src/netscape/security/x509/BasicConstraintsExtension.java index 5846296d1..2688e961d 100644 --- a/pki/base/util/src/netscape/security/x509/BasicConstraintsExtension.java +++ b/pki/base/util/src/netscape/security/x509/BasicConstraintsExtension.java @@ -278,7 +278,7 @@ public class BasicConstraintsExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(IS_CA); elements.addElement(PATH_LEN); diff --git a/pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java b/pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java index a15c1099f..c939a7431 100644 --- a/pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java +++ b/pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java @@ -227,8 +227,11 @@ public class CRLDistributionPointsExtension extends Extension "CertAttrSet:CRLDistributionPointsExtension"); } - public Enumeration getElements() { - return (new Vector()).elements(); + /* + * TODO use an empty collection to generate these + */ + public Enumeration<String> getAttributeNames() { + return (new Vector<String>()).elements(); } public String getName() { diff --git a/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java b/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java index e3965753c..7c89b179f 100755 --- a/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java +++ b/pki/base/util/src/netscape/security/x509/CRLNumberExtension.java @@ -211,7 +211,7 @@ public class CRLNumberExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(NUMBER); return (elements.elements()); diff --git a/pki/base/util/src/netscape/security/x509/CRLReasonExtension.java b/pki/base/util/src/netscape/security/x509/CRLReasonExtension.java index 22fbe894f..3c11fc70b 100644 --- a/pki/base/util/src/netscape/security/x509/CRLReasonExtension.java +++ b/pki/base/util/src/netscape/security/x509/CRLReasonExtension.java @@ -207,7 +207,7 @@ public final class CRLReasonExtension extends Extension implements CertAttrSet { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(REASON); diff --git a/pki/base/util/src/netscape/security/x509/CertAttrSet.java b/pki/base/util/src/netscape/security/x509/CertAttrSet.java index 958432668..7e8d6db82 100755 --- a/pki/base/util/src/netscape/security/x509/CertAttrSet.java +++ b/pki/base/util/src/netscape/security/x509/CertAttrSet.java @@ -109,7 +109,7 @@ public interface CertAttrSet { * * @return an enumeration of the attribute names. */ - Enumeration getElements(); + Enumeration<String> getAttributeNames(); /** * Returns the name (identifier) of this CertAttrSet. diff --git a/pki/base/util/src/netscape/security/x509/CertificateAlgorithmId.java b/pki/base/util/src/netscape/security/x509/CertificateAlgorithmId.java index 1105dc4fd..41610844e 100644 --- a/pki/base/util/src/netscape/security/x509/CertificateAlgorithmId.java +++ b/pki/base/util/src/netscape/security/x509/CertificateAlgorithmId.java @@ -174,7 +174,7 @@ public class CertificateAlgorithmId implements CertAttrSet, Serializable { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(ALGORITHM); return (elements.elements()); diff --git a/pki/base/util/src/netscape/security/x509/CertificateExtensions.java b/pki/base/util/src/netscape/security/x509/CertificateExtensions.java index 7cd2b73c6..b9667d8f6 100644 --- a/pki/base/util/src/netscape/security/x509/CertificateExtensions.java +++ b/pki/base/util/src/netscape/security/x509/CertificateExtensions.java @@ -43,7 +43,7 @@ import netscape.security.util.DerValue; * @version 1.11 * @see CertAttrSet */ -public class CertificateExtensions extends Vector +public class CertificateExtensions extends Vector<Extension> implements CertAttrSet, Serializable { /** * @@ -59,12 +59,13 @@ public class CertificateExtensions extends Vector */ public static final String NAME = "extensions"; - private Hashtable<String, Object> map; + private Hashtable<String, Extension> map; // Parse the encoded extension public void parseExtension(Extension ext) throws IOException { try { - Class extClass = OIDMap.getClass(ext.getExtensionId()); + @SuppressWarnings("unchecked") + Class<CertAttrSet> extClass = (Class<CertAttrSet>) OIDMap.getClass(ext.getExtensionId()); if (extClass == null) { // Unsupported extension if (ext.isCritical()) { throw new IOException("Unsupported CRITICAL extension: " @@ -75,8 +76,8 @@ public class CertificateExtensions extends Vector return; } } - Class[] params = { Boolean.class, Object.class }; - Constructor cons = extClass.getConstructor(params); + Class<?>[] params = { Boolean.class, Object.class }; + Constructor<CertAttrSet> cons = extClass.getConstructor(params); byte[] extData = ext.getExtensionValue(); int extLen = extData.length; @@ -87,7 +88,7 @@ public class CertificateExtensions extends Vector } Object[] passed = new Object[] { new Boolean(ext.isCritical()), value }; - CertAttrSet certExt = (CertAttrSet) cons.newInstance(passed); + CertAttrSet certExt = cons.newInstance(passed); if (certExt != null && certExt.getName() != null) { map.put(certExt.getName(), (Extension) certExt); addElement((Extension) certExt); @@ -105,7 +106,7 @@ public class CertificateExtensions extends Vector * Default constructor for the certificate attribute. */ public CertificateExtensions() { - map = new Hashtable(); + map = new Hashtable<String, Extension>(); } /** @@ -117,7 +118,7 @@ public class CertificateExtensions extends Vector public CertificateExtensions(DerInputStream in) throws IOException { - map = new Hashtable(); + map = new Hashtable<String, Extension>(); DerValue[] exts = in.getSequence(5); for (int i = 0; i < exts.length; i++) { @@ -136,7 +137,7 @@ public class CertificateExtensions extends Vector DerValue val = new DerValue(in); DerInputStream str = val.toDerInputStream(); - map = new Hashtable(); + map = new Hashtable<String, Extension>(); DerValue[] exts = str.getSequence(5); for (int i = 0; i < exts.length; i++) { @@ -160,7 +161,7 @@ public class CertificateExtensions extends Vector str = val.toDerInputStream(); } - map = new Hashtable(); + map = new Hashtable<String, Extension>(); DerValue[] exts = str.getSequence(5); for (int i = 0; i < exts.length; i++) { @@ -217,8 +218,8 @@ public class CertificateExtensions extends Vector * @exception IOException if the object could not be cached. */ public void set(String name, Object obj) throws IOException { - map.put(name, obj); - addElement(obj); + map.put(name, (Extension) obj); + addElement((Extension) obj); } /** @@ -250,7 +251,7 @@ public class CertificateExtensions extends Vector removeElement(obj); } - public Enumeration getNames() { + public Enumeration<String> getNames() { return map.keys(); } @@ -258,10 +259,14 @@ public class CertificateExtensions extends Vector * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration getElements() { + public Enumeration<Extension> getAttributes() { return (map.elements()); } + public Enumeration<String> getAttributeNames() { + return (map.keys()); + } + /** * Return the name of this attribute. */ diff --git a/pki/base/util/src/netscape/security/x509/CertificateIssuerExtension.java b/pki/base/util/src/netscape/security/x509/CertificateIssuerExtension.java index 490c087bb..774116bcc 100644 --- a/pki/base/util/src/netscape/security/x509/CertificateIssuerExtension.java +++ b/pki/base/util/src/netscape/security/x509/CertificateIssuerExtension.java @@ -226,7 +226,7 @@ public class CertificateIssuerExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(CERTIFICATE_ISSUER); diff --git a/pki/base/util/src/netscape/security/x509/CertificateIssuerName.java b/pki/base/util/src/netscape/security/x509/CertificateIssuerName.java index 83bea856c..a2f9026c1 100644 --- a/pki/base/util/src/netscape/security/x509/CertificateIssuerName.java +++ b/pki/base/util/src/netscape/security/x509/CertificateIssuerName.java @@ -156,7 +156,7 @@ public class CertificateIssuerName implements CertAttrSet { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(DN_NAME); diff --git a/pki/base/util/src/netscape/security/x509/CertificateIssuerUniqueIdentity.java b/pki/base/util/src/netscape/security/x509/CertificateIssuerUniqueIdentity.java index f54b1e0b9..351116ffb 100644 --- a/pki/base/util/src/netscape/security/x509/CertificateIssuerUniqueIdentity.java +++ b/pki/base/util/src/netscape/security/x509/CertificateIssuerUniqueIdentity.java @@ -169,7 +169,7 @@ public class CertificateIssuerUniqueIdentity implements CertAttrSet { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(ID); diff --git a/pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java b/pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java index d4e1cf86a..1c72e7fa3 100644 --- a/pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java +++ b/pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java @@ -21,6 +21,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.Array; +import java.util.Arrays; +import java.util.Collections; import java.util.Enumeration; import java.util.Vector; @@ -221,15 +223,23 @@ public class CertificatePoliciesExtension extends Extension } /** - * Return an enumeration of names of attributes existing within this + * Return an enumeration of attributes existing within this * attribute. */ - public Enumeration<Vector<CertificatePolicyInfo>> getElements() { + public Enumeration<Vector<CertificatePolicyInfo>> getAttributes() { Vector<Vector<CertificatePolicyInfo>> elements = new Vector<Vector<CertificatePolicyInfo>>(); elements.addElement(mInfos); return (elements.elements()); } + private static final String[] NAMES = { INFOS }; + + @Override + public Enumeration<String> getAttributeNames() { + // TODO Auto-generated method stub + return Collections.enumeration(Arrays.asList(NAMES)); + } + /** * Return the name of this attribute. */ @@ -322,4 +332,5 @@ public class CertificatePoliciesExtension extends Extension System.out.println(e.toString()); } } + } diff --git a/pki/base/util/src/netscape/security/x509/CertificateSerialNumber.java b/pki/base/util/src/netscape/security/x509/CertificateSerialNumber.java index de1e794d5..e9655178f 100644 --- a/pki/base/util/src/netscape/security/x509/CertificateSerialNumber.java +++ b/pki/base/util/src/netscape/security/x509/CertificateSerialNumber.java @@ -175,7 +175,7 @@ public class CertificateSerialNumber implements CertAttrSet { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(NUMBER); diff --git a/pki/base/util/src/netscape/security/x509/CertificateSubjectName.java b/pki/base/util/src/netscape/security/x509/CertificateSubjectName.java index 227dc41e1..6159638b9 100644 --- a/pki/base/util/src/netscape/security/x509/CertificateSubjectName.java +++ b/pki/base/util/src/netscape/security/x509/CertificateSubjectName.java @@ -187,7 +187,7 @@ public class CertificateSubjectName implements CertAttrSet, Serializable { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(DN_NAME); diff --git a/pki/base/util/src/netscape/security/x509/CertificateSubjectUniqueIdentity.java b/pki/base/util/src/netscape/security/x509/CertificateSubjectUniqueIdentity.java index c8e06fb38..51687e86d 100644 --- a/pki/base/util/src/netscape/security/x509/CertificateSubjectUniqueIdentity.java +++ b/pki/base/util/src/netscape/security/x509/CertificateSubjectUniqueIdentity.java @@ -169,7 +169,7 @@ public class CertificateSubjectUniqueIdentity implements CertAttrSet { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(ID); diff --git a/pki/base/util/src/netscape/security/x509/CertificateValidity.java b/pki/base/util/src/netscape/security/x509/CertificateValidity.java index c54da58b2..0c2c841b0 100644 --- a/pki/base/util/src/netscape/security/x509/CertificateValidity.java +++ b/pki/base/util/src/netscape/security/x509/CertificateValidity.java @@ -247,7 +247,7 @@ public class CertificateValidity implements CertAttrSet, Serializable { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(NOT_BEFORE); elements.addElement(NOT_AFTER); diff --git a/pki/base/util/src/netscape/security/x509/CertificateVersion.java b/pki/base/util/src/netscape/security/x509/CertificateVersion.java index 9b976e202..d3659779f 100644 --- a/pki/base/util/src/netscape/security/x509/CertificateVersion.java +++ b/pki/base/util/src/netscape/security/x509/CertificateVersion.java @@ -224,7 +224,7 @@ public class CertificateVersion implements CertAttrSet { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(VERSION); diff --git a/pki/base/util/src/netscape/security/x509/CertificateX509Key.java b/pki/base/util/src/netscape/security/x509/CertificateX509Key.java index 58c18f084..c7003bb8e 100644 --- a/pki/base/util/src/netscape/security/x509/CertificateX509Key.java +++ b/pki/base/util/src/netscape/security/x509/CertificateX509Key.java @@ -174,7 +174,7 @@ public class CertificateX509Key implements CertAttrSet, Serializable { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(KEY); diff --git a/pki/base/util/src/netscape/security/x509/DeltaCRLIndicatorExtension.java b/pki/base/util/src/netscape/security/x509/DeltaCRLIndicatorExtension.java index 6e8f9fa02..da870f4fd 100755 --- a/pki/base/util/src/netscape/security/x509/DeltaCRLIndicatorExtension.java +++ b/pki/base/util/src/netscape/security/x509/DeltaCRLIndicatorExtension.java @@ -224,7 +224,7 @@ public class DeltaCRLIndicatorExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(NUMBER); return (elements.elements()); diff --git a/pki/base/util/src/netscape/security/x509/Extensions.java b/pki/base/util/src/netscape/security/x509/Extensions.java index 63856300e..622367ab6 100644 --- a/pki/base/util/src/netscape/security/x509/Extensions.java +++ b/pki/base/util/src/netscape/security/x509/Extensions.java @@ -40,7 +40,7 @@ import netscape.security.util.DerValue; * @version 1.11 * @see CertAttrSet */ -public class Extensions extends Vector +public class Extensions extends Vector<Extension> implements CertAttrSet { /** * @@ -56,12 +56,13 @@ public class Extensions extends Vector */ public static final String NAME = "extensions"; - private Hashtable map; + private Hashtable<String, Extension> map; // Parse the encoded extension public void parseExtension(Extension ext) throws IOException { try { - Class extClass = OIDMap.getClass(ext.getExtensionId()); + @SuppressWarnings("unchecked") + Class<CertAttrSet> extClass = (Class<CertAttrSet>) OIDMap.getClass(ext.getExtensionId()); if (extClass == null) { // Unsupported extension if (ext.isCritical()) { throw new IOException("Unsupported CRITICAL extension: " @@ -72,8 +73,8 @@ public class Extensions extends Vector return; } } - Class[] params = { Boolean.class, Object.class }; - Constructor cons = extClass.getConstructor(params); + Class<?>[] params = { Boolean.class, Object.class }; + Constructor<CertAttrSet> cons = extClass.getConstructor(params); byte[] extData = ext.getExtensionValue(); int extLen = extData.length; @@ -84,9 +85,9 @@ public class Extensions extends Vector } Object[] passed = new Object[] { new Boolean(ext.isCritical()), value }; - CertAttrSet certExt = (CertAttrSet) cons.newInstance(passed); - map.put(certExt.getName(), certExt); - addElement(certExt); + CertAttrSet certExt = cons.newInstance(passed); + map.put(certExt.getName(), (Extension) certExt); + addElement((Extension) certExt); } catch (NoSuchMethodException nosuch) { throw new IOException(nosuch.toString()); @@ -101,7 +102,7 @@ public class Extensions extends Vector * Default constructor for the certificate attribute. */ public Extensions() { - map = new Hashtable(); + map = new Hashtable<String, Extension>(); } /** @@ -113,7 +114,7 @@ public class Extensions extends Vector public Extensions(DerInputStream in) throws IOException { - map = new Hashtable(); + map = new Hashtable<String, Extension>(); DerValue[] exts = in.getSequence(5); for (int i = 0; i < exts.length; i++) { @@ -132,7 +133,7 @@ public class Extensions extends Vector DerValue val = new DerValue(in); DerInputStream str = val.toDerInputStream(); - map = new Hashtable(); + map = new Hashtable<String, Extension>(); DerValue[] exts = str.getSequence(5); for (int i = 0; i < exts.length; i++) { @@ -175,8 +176,8 @@ public class Extensions extends Vector * @exception IOException if the object could not be cached. */ public void set(String name, Object obj) throws IOException { - map.put(name, obj); - addElement(obj); + map.put(name, (Extension) obj); + addElement((Extension) obj); } /** @@ -212,8 +213,8 @@ public class Extensions extends Vector * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration getElements() { - return (map.elements()); + public Enumeration<String> getAttributeNames() { + return map.keys(); } /** diff --git a/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java b/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java index 5d7bd50b6..320bbf3df 100644 --- a/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java +++ b/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java @@ -233,8 +233,11 @@ public class FreshestCRLExtension extends Extension "CertAttrSet:FreshestCRLExtension"); } - public Enumeration getElements() { - return (new Vector()).elements(); + /* + * TODO replacewith empty collection + */ + public Enumeration<String> getAttributeNames() { + return (new Vector<String>()).elements(); } public String getName() { diff --git a/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java b/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java index 80324f8d8..b42bb6ac9 100644 --- a/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java +++ b/pki/base/util/src/netscape/security/x509/HoldInstructionExtension.java @@ -339,7 +339,7 @@ public class HoldInstructionExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(HOLD_INSTRUCTION); return (elements.elements()); diff --git a/pki/base/util/src/netscape/security/x509/InvalidityDateExtension.java b/pki/base/util/src/netscape/security/x509/InvalidityDateExtension.java index 73e76087f..44c76275f 100755 --- a/pki/base/util/src/netscape/security/x509/InvalidityDateExtension.java +++ b/pki/base/util/src/netscape/security/x509/InvalidityDateExtension.java @@ -226,7 +226,7 @@ public class InvalidityDateExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(INVALIDITY_DATE); return (elements.elements()); diff --git a/pki/base/util/src/netscape/security/x509/IssuerAlternativeNameExtension.java b/pki/base/util/src/netscape/security/x509/IssuerAlternativeNameExtension.java index a21d3ac32..df0289f9e 100644 --- a/pki/base/util/src/netscape/security/x509/IssuerAlternativeNameExtension.java +++ b/pki/base/util/src/netscape/security/x509/IssuerAlternativeNameExtension.java @@ -224,7 +224,7 @@ public class IssuerAlternativeNameExtension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(ISSUER_NAME); diff --git a/pki/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java b/pki/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java index 9eb9d14a9..fc7e837ce 100644 --- a/pki/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java +++ b/pki/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java @@ -340,7 +340,7 @@ public class IssuingDistributionPointExtension extends Extension } } - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(ISSUING_DISTRIBUTION_POINT); return (elements.elements()); diff --git a/pki/base/util/src/netscape/security/x509/KeyUsageExtension.java b/pki/base/util/src/netscape/security/x509/KeyUsageExtension.java index 043208806..56084dbcf 100644 --- a/pki/base/util/src/netscape/security/x509/KeyUsageExtension.java +++ b/pki/base/util/src/netscape/security/x509/KeyUsageExtension.java @@ -386,7 +386,7 @@ public class KeyUsageExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(DIGITAL_SIGNATURE); elements.addElement(NON_REPUDIATION); diff --git a/pki/base/util/src/netscape/security/x509/NSCCommentExtension.java b/pki/base/util/src/netscape/security/x509/NSCCommentExtension.java index 5ac3357ce..b24ce1158 100644 --- a/pki/base/util/src/netscape/security/x509/NSCCommentExtension.java +++ b/pki/base/util/src/netscape/security/x509/NSCCommentExtension.java @@ -58,7 +58,7 @@ public class NSCCommentExtension extends Extension public String mComment = null; // Private data members - private Vector mInfos; + private Vector<Object> mInfos; private PrettyPrintFormat pp = new PrettyPrintFormat(":"); @@ -90,7 +90,7 @@ public class NSCCommentExtension extends Extension public NSCCommentExtension(boolean critical) { this.extensionId = new ObjectIdentifier("2.16.840.1.113730.1.13"); this.critical = critical; - mInfos = new Vector(1, 1); + mInfos = new Vector<Object>(1, 1); } /** @@ -171,6 +171,7 @@ public class NSCCommentExtension extends Extension /** * Set the attribute value. */ + @SuppressWarnings("unchecked") public void set(String name, Object obj) throws IOException { clearValue(); if (name.equalsIgnoreCase(INFOS)) { @@ -178,7 +179,7 @@ public class NSCCommentExtension extends Extension throw new IOException("Attribute value should be of" + " type Vector."); } - mInfos = (Vector) obj; + mInfos = (Vector<Object>) obj; } else { throw new IOException("Attribute name not recognized by " + "CertAttrSet:NSCCommentExtension."); @@ -213,9 +214,9 @@ public class NSCCommentExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration getElements() { - Vector elements = new Vector(); - elements.addElement(mInfos); + public Enumeration<String> getAttributeNames() { + Vector<String> elements = new Vector<String>(); + elements.addElement(INFOS); return (elements.elements()); } diff --git a/pki/base/util/src/netscape/security/x509/NameConstraintsExtension.java b/pki/base/util/src/netscape/security/x509/NameConstraintsExtension.java index d3ca8c116..948d0d8c9 100644 --- a/pki/base/util/src/netscape/security/x509/NameConstraintsExtension.java +++ b/pki/base/util/src/netscape/security/x509/NameConstraintsExtension.java @@ -298,7 +298,7 @@ public class NameConstraintsExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(PERMITTED_SUBTREES); elements.addElement(EXCLUDED_SUBTREES); diff --git a/pki/base/util/src/netscape/security/x509/OIDMap.java b/pki/base/util/src/netscape/security/x509/OIDMap.java index d97d060ba..9c732d938 100644 --- a/pki/base/util/src/netscape/security/x509/OIDMap.java +++ b/pki/base/util/src/netscape/security/x509/OIDMap.java @@ -78,13 +78,13 @@ public class OIDMap { private static final String POLICY_CONSTRAINTS = ROOT + "." + PolicyConstraintsExtension.NAME; private static final String CERT_POLICIES = //ROOT + "." + - CertificatePoliciesExtension.NAME; + CertificatePoliciesExtension.NAME; private static final String SUBJ_DIR_ATTR = //ROOT + "." + - SubjectDirAttributesExtension.NAME; + SubjectDirAttributesExtension.NAME; public static final String EXT_KEY_USAGE_NAME = "ExtendedKeyUsageExtension"; public static final String EXT_INHIBIT_ANY_POLICY_NAME = "InhibitAnyPolicyExtension"; private static final String EXT_KEY_USAGE = //ROOT + "." + - EXT_KEY_USAGE_NAME; + EXT_KEY_USAGE_NAME; private static final String CRL_NUMBER = ROOT + "." + CRLNumberExtension.NAME; diff --git a/pki/base/util/src/netscape/security/x509/PolicyConstraintsExtension.java b/pki/base/util/src/netscape/security/x509/PolicyConstraintsExtension.java index 194903dd5..7d98b21ba 100644 --- a/pki/base/util/src/netscape/security/x509/PolicyConstraintsExtension.java +++ b/pki/base/util/src/netscape/security/x509/PolicyConstraintsExtension.java @@ -275,7 +275,7 @@ public class PolicyConstraintsExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(REQUIRE); elements.addElement(INHIBIT); diff --git a/pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java b/pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java index 6f2e583bc..9bdfb611b 100644 --- a/pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java +++ b/pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java @@ -190,6 +190,7 @@ public class PolicyMappingsExtension extends Extension /** * Set the attribute value. */ + @SuppressWarnings("unchecked") public void set(String name, Object obj) throws IOException { clearValue(); if (name.equalsIgnoreCase(MAP)) { @@ -232,7 +233,7 @@ public class PolicyMappingsExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(MAP); diff --git a/pki/base/util/src/netscape/security/x509/PrivateKeyUsageExtension.java b/pki/base/util/src/netscape/security/x509/PrivateKeyUsageExtension.java index a38443644..e3ecdb33d 100644 --- a/pki/base/util/src/netscape/security/x509/PrivateKeyUsageExtension.java +++ b/pki/base/util/src/netscape/security/x509/PrivateKeyUsageExtension.java @@ -322,7 +322,7 @@ public class PrivateKeyUsageExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(NOT_BEFORE); elements.addElement(NOT_AFTER); diff --git a/pki/base/util/src/netscape/security/x509/RevokedCertImpl.java b/pki/base/util/src/netscape/security/x509/RevokedCertImpl.java index 3271768f7..345694fb1 100755 --- a/pki/base/util/src/netscape/security/x509/RevokedCertImpl.java +++ b/pki/base/util/src/netscape/security/x509/RevokedCertImpl.java @@ -66,13 +66,13 @@ import netscape.security.util.ObjectIdentifier; * @version 1.6 97/12/10 */ -public class RevokedCertImpl extends RevokedCertificate - implements Serializable { +public class RevokedCertImpl extends RevokedCertificate implements Serializable { /** * */ private static final long serialVersionUID = -3449642360223397701L; + private SerialNumber serialNumber; private Date revocationDate; private CRLExtensions extensions = null; @@ -86,11 +86,13 @@ public class RevokedCertImpl extends RevokedCertificate } /** - * Constructs a revoked certificate entry using the - * serial number and revocation date. + * Constructs a revoked certificate entry using the serial number and + * revocation date. * - * @param num the serial number of the revoked certificate. - * @param date the Date on which revocation took place. + * @param num + * the serial number of the revoked certificate. + * @param date + * the Date on which revocation took place. */ public RevokedCertImpl(BigInteger num, Date date) { this.serialNumber = new SerialNumber(num); @@ -98,16 +100,17 @@ public class RevokedCertImpl extends RevokedCertificate } /** - * Constructs a revoked certificate entry using the - * serial number, revocation date and the entry - * extensions. + * Constructs a revoked certificate entry using the serial number, + * revocation date and the entry extensions. * - * @param num the serial number of the revoked certificate. - * @param date the Date on which revocation took place. - * @param crlEntryExts the extensions for this entry. + * @param num + * the serial number of the revoked certificate. + * @param date + * the Date on which revocation took place. + * @param crlEntryExts + * the extensions for this entry. */ - public RevokedCertImpl(BigInteger num, Date date, - CRLExtensions crlEntryExts) { + public RevokedCertImpl(BigInteger num, Date date, CRLExtensions crlEntryExts) { this.serialNumber = new SerialNumber(num); this.revocationDate = date; this.extensions = crlEntryExts; @@ -120,7 +123,7 @@ public class RevokedCertImpl extends RevokedCertificate try { encode(os); } catch (Exception e) { - // revokedCert = null; + // revokedCert = null; } revokedCert = os.toByteArray(); } @@ -135,7 +138,8 @@ public class RevokedCertImpl extends RevokedCertificate /** * Sets extensions for this impl. * - * @param crlEntryExts CRLExtensions + * @param crlEntryExts + * CRLExtensions */ public void setExtensions(CRLExtensions crlEntryExts) { this.extensions = crlEntryExts; @@ -144,12 +148,15 @@ public class RevokedCertImpl extends RevokedCertificate /** * Unmarshals a revoked certificate from its encoded form. * - * @param revokedCert the encoded bytes. - * @exception CRLException on parsing errors. - * @exception X509ExtensionException on extension handling errors. + * @param revokedCert + * the encoded bytes. + * @exception CRLException + * on parsing errors. + * @exception X509ExtensionException + * on extension handling errors. */ - public RevokedCertImpl(byte[] revokedCert) - throws CRLException, X509ExtensionException { + public RevokedCertImpl(byte[] revokedCert) throws CRLException, + X509ExtensionException { try { DerValue derValue = new DerValue(revokedCert); parse(derValue); @@ -161,21 +168,23 @@ public class RevokedCertImpl extends RevokedCertificate /** * Unmarshals a revoked certificate from its encoded form. * - * @param derValue the DER value containing the revoked certificate. - * @exception CRLException on parsing errors. - * @exception X509ExtensionException on extension handling errors. + * @param derValue + * the DER value containing the revoked certificate. + * @exception CRLException + * on parsing errors. + * @exception X509ExtensionException + * on extension handling errors. */ - public RevokedCertImpl(DerValue derValue) - throws CRLException, X509ExtensionException { + public RevokedCertImpl(DerValue derValue) throws CRLException, + X509ExtensionException { parse(derValue); } /** - * Returns true if this revoked certificate entry has - * extensions, otherwise false. + * Returns true if this revoked certificate entry has extensions, otherwise + * false. * - * @return true if this CRL entry has extensions, otherwise - * false. + * @return true if this CRL entry has extensions, otherwise false. */ public boolean hasExtensions() { if (extensions == null) @@ -187,13 +196,15 @@ public class RevokedCertImpl extends RevokedCertificate /** * Decode a revoked certificate from an input stream. * - * @param inStrm an input stream holding at least one revoked - * certificate - * @exception CRLException on parsing errors. - * @exception X509ExtensionException on extension handling errors. + * @param inStrm + * an input stream holding at least one revoked certificate + * @exception CRLException + * on parsing errors. + * @exception X509ExtensionException + * on extension handling errors. */ - public void decode(InputStream inStrm) - throws CRLException, X509ExtensionException { + public void decode(InputStream inStrm) throws CRLException, + X509ExtensionException { try { DerValue derValue = new DerValue(inStrm); parse(derValue); @@ -205,13 +216,16 @@ public class RevokedCertImpl extends RevokedCertificate /** * Encodes the revoked certificate to an output stream. * - * @param outStrm an output stream to which the encoded revoked - * certificate is written. - * @exception CRLException on encoding errors. - * @exception X509ExtensionException on extension handling errors. + * @param outStrm + * an output stream to which the encoded revoked certificate is + * written. + * @exception CRLException + * on encoding errors. + * @exception X509ExtensionException + * on extension handling errors. */ - public void encode(DerOutputStream outStrm) - throws CRLException, X509ExtensionException { + public void encode(DerOutputStream outStrm) throws CRLException, + X509ExtensionException { try { if (revokedCert == null) { DerOutputStream tmp = new DerOutputStream(); @@ -236,8 +250,7 @@ public class RevokedCertImpl extends RevokedCertificate } /** - * Gets the serial number for this RevokedCertificate, - * the <em>userCertificate</em>. + * Gets the serial number for this RevokedCertificate, the <em>userCertificate</em>. * * @return the serial number. */ @@ -246,8 +259,7 @@ public class RevokedCertImpl extends RevokedCertificate } /** - * Gets the revocation date for this RevokedCertificate, - * the <em>revocationDate</em>. + * Gets the revocation date for this RevokedCertificate, the <em>revocationDate</em>. * * @return the revocation date. */ @@ -277,8 +289,8 @@ public class RevokedCertImpl extends RevokedCertificate if (extensions != null) { sb.append("\n"); for (int i = 0; i < extensions.size(); i++) - sb.append("Entry Extension[" + i + "]: " + - ((Extension) (extensions.elementAt(i))).toString()); + sb.append("Entry Extension[" + i + "]: " + + ((Extension) (extensions.elementAt(i))).toString()); } sb.append("\n"); return (sb.toString()); @@ -299,7 +311,7 @@ public class RevokedCertImpl extends RevokedCertificate for (Enumeration<Extension> e = extensions.getElements(); e.hasMoreElements();) { ex = e.nextElement(); if (ex.isCritical()) - extSet.add(((ObjectIdentifier) ex.getExtensionId()).toString()); + extSet.add(ex.getExtensionId().toString()); } return extSet; } @@ -317,9 +329,9 @@ public class RevokedCertImpl extends RevokedCertificate Set<String> extSet = new LinkedHashSet<String>(); Extension ex; for (Enumeration<Extension> e = extensions.getElements(); e.hasMoreElements();) { - ex = (Extension) e.nextElement(); + ex = e.nextElement(); if (!ex.isCritical()) - extSet.add(((ObjectIdentifier) ex.getExtensionId()).toString()); + extSet.add(ex.getExtensionId().toString()); } return extSet; } @@ -348,7 +360,7 @@ public class RevokedCertImpl extends RevokedCertificate Extension ex = null; ObjectIdentifier inCertOID; for (Enumeration<Extension> e = extensions.getElements(); e.hasMoreElements();) { - ex = (Extension) e.nextElement(); + ex = e.nextElement(); inCertOID = ex.getExtensionId(); if (inCertOID.equals(findOID)) { crlExt = ex; @@ -419,10 +431,9 @@ public class RevokedCertImpl extends RevokedCertificate } /** - * Serialization write ... X.509 certificates serialize as - * themselves, and they're parsed when they get read back. - * (Actually they serialize as some type data from the - * serialization subsystem, then the cert data.) + * Serialization write ... X.509 certificates serialize as themselves, and + * they're parsed when they get read back. (Actually they serialize as some + * type data from the serialization subsystem, then the cert data.) */ private synchronized void writeObject(ObjectOutputStream stream) throws CRLException, X509ExtensionException, IOException { @@ -432,8 +443,8 @@ public class RevokedCertImpl extends RevokedCertificate } /** - * Serialization read ... X.509 certificates serialize as - * themselves, and they're parsed when they get read back. + * Serialization read ... X.509 certificates serialize as themselves, and + * they're parsed when they get read back. */ private synchronized void readObject(ObjectInputStream stream) throws CRLException, X509ExtensionException, IOException { diff --git a/pki/base/util/src/netscape/security/x509/RevokedCertificate.java b/pki/base/util/src/netscape/security/x509/RevokedCertificate.java index 64eed427e..2087d064a 100644 --- a/pki/base/util/src/netscape/security/x509/RevokedCertificate.java +++ b/pki/base/util/src/netscape/security/x509/RevokedCertificate.java @@ -89,4 +89,7 @@ public abstract class RevokedCertificate extends X509CRLEntry { * @return a string representation of this revoked certificate. */ public abstract String toString(); + + public abstract CRLExtensions getExtensions(); + } diff --git a/pki/base/util/src/netscape/security/x509/SubjectAlternativeNameExtension.java b/pki/base/util/src/netscape/security/x509/SubjectAlternativeNameExtension.java index 779503e60..c30ae1576 100644 --- a/pki/base/util/src/netscape/security/x509/SubjectAlternativeNameExtension.java +++ b/pki/base/util/src/netscape/security/x509/SubjectAlternativeNameExtension.java @@ -226,7 +226,7 @@ public class SubjectAlternativeNameExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(SUBJECT_NAME); diff --git a/pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java b/pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java index 40e7a3f0d..b249ef600 100644 --- a/pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java +++ b/pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java @@ -263,7 +263,7 @@ public class SubjectDirAttributesExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); return (elements.elements()); } diff --git a/pki/base/util/src/netscape/security/x509/SubjectKeyIdentifierExtension.java b/pki/base/util/src/netscape/security/x509/SubjectKeyIdentifierExtension.java index fd22b20f0..ea0ebae82 100644 --- a/pki/base/util/src/netscape/security/x509/SubjectKeyIdentifierExtension.java +++ b/pki/base/util/src/netscape/security/x509/SubjectKeyIdentifierExtension.java @@ -206,7 +206,7 @@ public class SubjectKeyIdentifierExtension extends Extension * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(KEY_ID); diff --git a/pki/base/util/src/netscape/security/x509/X500Name.java b/pki/base/util/src/netscape/security/x509/X500Name.java index 180ed9a5c..920b0e1e4 100644 --- a/pki/base/util/src/netscape/security/x509/X500Name.java +++ b/pki/base/util/src/netscape/security/x509/X500Name.java @@ -694,7 +694,7 @@ public class X500Name implements Principal, GeneralNameInterface { */ private static final int ipAddress_data[] = // SKIP - { 1, 3, 6, 1, 4, 1, 42, 2, 11, 2, 1 }; + { 1, 3, 6, 1, 4, 1, 42, 2, 11, 2, 1 }; /** OID for "IP=" IP address attributes, used with SKIP. */ public static final ObjectIdentifier ipAddress_oid = new ObjectIdentifier(ipAddress_data); diff --git a/pki/base/util/src/netscape/security/x509/X500NameAttrMap.java b/pki/base/util/src/netscape/security/x509/X500NameAttrMap.java index aac89e21a..1c87c79b8 100644 --- a/pki/base/util/src/netscape/security/x509/X500NameAttrMap.java +++ b/pki/base/util/src/netscape/security/x509/X500NameAttrMap.java @@ -206,7 +206,8 @@ public class X500NameAttrMap { Hashtable<String, ObjectIdentifier> name2OID = new Hashtable<String, ObjectIdentifier>(); Hashtable<ObjectIdentifier, String> oid2Name = new Hashtable<ObjectIdentifier, String>(); - Hashtable<ObjectIdentifier, AVAValueConverter> oid2ValueConverter = new Hashtable<ObjectIdentifier, AVAValueConverter>(); + Hashtable<ObjectIdentifier, AVAValueConverter> oid2ValueConverter = + new Hashtable<ObjectIdentifier, AVAValueConverter>(); // // global defaults. diff --git a/pki/base/util/src/netscape/security/x509/X509CertImpl.java b/pki/base/util/src/netscape/security/x509/X509CertImpl.java index 360028734..d2d77cb3a 100755 --- a/pki/base/util/src/netscape/security/x509/X509CertImpl.java +++ b/pki/base/util/src/netscape/security/x509/X509CertImpl.java @@ -912,8 +912,8 @@ public class X509CertImpl extends X509Certificate return null; Set<String> extSet = new LinkedHashSet<String>(); Extension ex; - for (Enumeration e = exts.getElements(); e.hasMoreElements();) { - ex = (Extension) e.nextElement(); + for (Enumeration<Extension> e = exts.getAttributes(); e.hasMoreElements();) { + ex = e.nextElement(); if (ex.isCritical()) extSet.add(((ObjectIdentifier) ex.getExtensionId()).toString()); } @@ -941,8 +941,8 @@ public class X509CertImpl extends X509Certificate Set<String> extSet = new LinkedHashSet<String>(); Extension ex; - for (Enumeration e = exts.getElements(); e.hasMoreElements();) { - ex = (Extension) e.nextElement(); + for (Enumeration<Extension> e = exts.getAttributes(); e.hasMoreElements();) { + ex = e.nextElement(); if (!ex.isCritical()) extSet.add(((ObjectIdentifier) ex.getExtensionId()).toString()); } @@ -962,8 +962,8 @@ public class X509CertImpl extends X509Certificate Extension ex = null; ; ObjectIdentifier inCertOID; - for (Enumeration e = exts.getElements(); e.hasMoreElements();) { - ex = (Extension) e.nextElement(); + for (Enumeration<Extension> e = exts.getAttributes(); e.hasMoreElements();) { + ex = e.nextElement(); inCertOID = ex.getExtensionId(); if (inCertOID.equals(findOID)) { return ex; @@ -996,8 +996,8 @@ public class X509CertImpl extends X509Certificate Extension ex = null; ; ObjectIdentifier inCertOID; - for (Enumeration e = exts.getElements(); e.hasMoreElements();) { - ex = (Extension) e.nextElement(); + for (Enumeration<Extension> e = exts.getAttributes(); e.hasMoreElements();) { + ex = e.nextElement(); inCertOID = ex.getExtensionId(); if (inCertOID.equals(findOID)) { certExt = ex; diff --git a/pki/base/util/src/netscape/security/x509/X509CertInfo.java b/pki/base/util/src/netscape/security/x509/X509CertInfo.java index 9dd43de3f..4777cd958 100644 --- a/pki/base/util/src/netscape/security/x509/X509CertInfo.java +++ b/pki/base/util/src/netscape/security/x509/X509CertInfo.java @@ -223,7 +223,7 @@ public class X509CertInfo implements CertAttrSet, Serializable { * Return an enumeration of names of attributes existing within this * attribute. */ - public Enumeration<String> getElements() { + public Enumeration<String> getAttributeNames() { Vector<String> elements = new Vector<String>(); elements.addElement(VERSION); elements.addElement(SERIAL_NUMBER); diff --git a/pki/base/util/test/com/netscape/security/extensions/GenericASN1ExtensionTest.java b/pki/base/util/test/com/netscape/security/extensions/GenericASN1ExtensionTest.java new file mode 100644 index 000000000..74d082f09 --- /dev/null +++ b/pki/base/util/test/com/netscape/security/extensions/GenericASN1ExtensionTest.java @@ -0,0 +1,72 @@ +package com.netscape.security.extensions; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.util.Hashtable; + +import netscape.security.extensions.GenericASN1Extension; +import netscape.security.x509.OIDMap; + +import org.junit.Assert; +import org.junit.Test; + +public class GenericASN1ExtensionTest { + + //@Test + public void testConstructorArgs() throws Exception { + String name1 = "testExtension1"; + String oid1 = "1.2.3.4"; + String pattern = ""; + Hashtable<String, String> config = new Hashtable<String, String>(); + GenericASN1Extension extension1 = new GenericASN1Extension(name1, oid1, + pattern, false, config); + Assert.assertEquals(name1, extension1.getName()); + Assert.assertNotNull(OIDMap.getClass(name1)); + + String name2 = "testExtension2"; + String oid2 = "2.4.6.8"; + GenericASN1Extension extension2 = new GenericASN1Extension(name2, oid2, + pattern, false, config); + Assert.assertEquals(name2, extension2.getName()); + Assert.assertNotNull(OIDMap.getClass(name2)); + } + + @Test + public void testConstructorJustConfig() throws Exception { + String name1 = "testExtension1"; + String oid1 = "1.2.3.4"; + String pattern = ""; + Hashtable<String, String> config = new Hashtable<String, String>(); + config.put("oid", oid1); + config.put("name", name1); + config.put("pattern", pattern); + config.put("critical", "true"); + + GenericASN1Extension extension1 = new GenericASN1Extension(config); + Assert.assertEquals(name1, extension1.getName()); + //Assert.assertNotNull(OIDMap.getClass(name1)); + + String name2 = "testExtension2"; + String oid2 = "2.4.6.8"; + config.put("oid", oid2); + config.put("name", name2); + + GenericASN1Extension extension2 = new GenericASN1Extension(config); + Assert.assertEquals(name2, extension2.getName()); + //Assert.assertNotNull(OIDMap.getClass(name2)); + OutputStream outputStream = new ByteArrayOutputStream(); + extension1.encode(outputStream); + extension2.encode(outputStream); + + } + + @Test + public void testConstructorDER() throws Exception { + byte[] value = new byte[0]; + GenericASN1Extension extension = new GenericASN1Extension(true, value); + + OutputStream outputStream = new ByteArrayOutputStream(); + extension.encode(outputStream); + + } +} |