diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-01-12 18:53:36 -0600 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-01-18 12:55:59 -0600 |
commit | 2a535f04f7b7bf670b19b95801e25178af5c91f9 (patch) | |
tree | 5e8356739fecf71d6b132e026d95ffb52bf2cdbf /pki/base/common/src/com/netscape/cms/profile | |
parent | 9115902d5d3ffa4ac905f5d1f9fbd18a8e99622c (diff) | |
download | pki-2a535f04f7b7bf670b19b95801e25178af5c91f9.tar.gz pki-2a535f04f7b7bf670b19b95801e25178af5c91f9.tar.xz pki-2a535f04f7b7bf670b19b95801e25178af5c91f9.zip |
Added generics (part 1).
This patch is based on Adam's patch. It brings down the warnings
from 6139 to 4648.
Ticket #2
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/profile')
18 files changed, 130 insertions, 122 deletions
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 " |