diff options
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/profile/def')
8 files changed, 118 insertions, 133 deletions
diff --git a/pki/base/common/src/com/netscape/cms/profile/def/AuthInfoAccessExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/AuthInfoAccessExtDefault.java index f23b7e24c..76ea4e143 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/AuthInfoAccessExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/AuthInfoAccessExtDefault.java @@ -225,7 +225,7 @@ public class AuthInfoAccessExtDefault extends EnrollExtDefault { } boolean critical = ext.isCritical(); - Vector v = parseRecords(value); + Vector<NameValuePairs> v = parseRecords(value); int size = v.size(); ext = new AuthInfoAccessExtension(critical); @@ -235,20 +235,18 @@ public class AuthInfoAccessExtDefault extends EnrollExtDefault { String enable = null; for (int i = 0; i < size; i++) { - NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration<String> names = nvps.getNames(); + NameValuePairs nvps = v.elementAt(i); - while (names.hasMoreElements()) { - String name1 = names.nextElement(); + for (String name1 : nvps.keySet()) { if (name1.equals(AD_METHOD)) { - method = nvps.getValue(name1); + method = nvps.get(name1); } else if (name1.equals(AD_LOCATION_TYPE)) { - locationType = nvps.getValue(name1); + locationType = nvps.get(name1); } else if (name1.equals(AD_LOCATION)) { - location = nvps.getValue(name1); + location = nvps.get(name1); } else if (name1.equals(AD_ENABLE)) { - enable = nvps.getValue(name1); + enable = nvps.get(name1); } } @@ -352,18 +350,18 @@ public class AuthInfoAccessExtDefault extends EnrollExtDefault { des = ext.getAccessDescription(i); } if (des == null) { - np.add(AD_METHOD, ""); - np.add(AD_LOCATION_TYPE, ""); - np.add(AD_LOCATION, ""); - np.add(AD_ENABLE, "false"); + np.put(AD_METHOD, ""); + np.put(AD_LOCATION_TYPE, ""); + np.put(AD_LOCATION, ""); + np.put(AD_ENABLE, "false"); } else { ObjectIdentifier methodOid = des.getMethod(); GeneralName gn = des.getLocation(); - np.add(AD_METHOD, methodOid.toString()); - np.add(AD_LOCATION_TYPE, getGeneralNameType(gn)); - np.add(AD_LOCATION, getGeneralNameValue(gn)); - np.add(AD_ENABLE, "true"); + np.put(AD_METHOD, methodOid.toString()); + np.put(AD_LOCATION_TYPE, getGeneralNameType(gn)); + np.put(AD_LOCATION, getGeneralNameValue(gn)); + np.put(AD_ENABLE, "true"); } recs.addElement(np); } 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 a95ec6b7d..c7a0f9abd 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 @@ -247,8 +247,7 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { int i = 0; for (; i < size; i++) { - NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration<String> names = nvps.getNames(); + NameValuePairs nvps = v.elementAt(i); String pointType = null; String pointValue = null; String issuerType = null; @@ -256,21 +255,20 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { String enable = null; CRLDistributionPoint cdp = new CRLDistributionPoint(); - while (names.hasMoreElements()) { - String name1 = (String) names.nextElement(); + for (String name1 : nvps.keySet()) { if (name1.equals(REASONS)) { - addReasons(locale, cdp, REASONS, nvps.getValue(name1)); + addReasons(locale, cdp, REASONS, nvps.get(name1)); } else if (name1.equals(POINT_TYPE)) { - pointType = nvps.getValue(name1); + pointType = nvps.get(name1); } else if (name1.equals(POINT_NAME)) { - pointValue = nvps.getValue(name1); + pointValue = nvps.get(name1); } else if (name1.equals(ISSUER_TYPE)) { - issuerType = nvps.getValue(name1); + issuerType = nvps.get(name1); } else if (name1.equals(ISSUER_NAME)) { - issuerValue = nvps.getValue(name1); + issuerValue = nvps.get(name1); } else if (name1.equals(ENABLE)) { - enable = nvps.getValue(name1); + enable = nvps.get(name1); } } @@ -466,12 +464,12 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { protected NameValuePairs buildEmptyGeneralNames() { NameValuePairs pairs = new NameValuePairs(); - pairs.add(POINT_TYPE, ""); - pairs.add(POINT_NAME, ""); - pairs.add(REASONS, ""); - pairs.add(ISSUER_TYPE, ""); - pairs.add(ISSUER_NAME, ""); - pairs.add(ENABLE, "false"); + pairs.put(POINT_TYPE, ""); + pairs.put(POINT_NAME, ""); + pairs.put(REASONS, ""); + pairs.put(ISSUER_TYPE, ""); + pairs.put(ISSUER_NAME, ""); + pairs.put(ENABLE, "false"); return pairs; } @@ -483,16 +481,16 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { RDN rdn = null; boolean hasFullName = false; - pairs.add(ENABLE, "true"); + pairs.put(ENABLE, "true"); if (gns == null) { rdn = p.getRelativeName(); if (rdn != null) { hasFullName = true; - pairs.add(POINT_TYPE, RELATIVETOISSUER); - pairs.add(POINT_NAME, rdn.toString()); + pairs.put(POINT_TYPE, RELATIVETOISSUER); + pairs.put(POINT_NAME, rdn.toString()); } else { - pairs.add(POINT_TYPE, ""); - pairs.add(POINT_NAME, ""); + pairs.put(POINT_TYPE, ""); + pairs.put(POINT_NAME, ""); } } else { GeneralName gn = (GeneralName) gns.elementAt(0); @@ -501,30 +499,30 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { hasFullName = true; int type = gn.getType(); - pairs.add(POINT_TYPE, getGeneralNameType(gn)); - pairs.add(POINT_NAME, getGeneralNameValue(gn)); + pairs.put(POINT_TYPE, getGeneralNameType(gn)); + pairs.put(POINT_NAME, getGeneralNameValue(gn)); } } if (!hasFullName) { - pairs.add(POINT_TYPE, GN_DIRECTORY_NAME); - pairs.add(POINT_NAME, ""); + pairs.put(POINT_TYPE, GN_DIRECTORY_NAME); + pairs.put(POINT_NAME, ""); } BitArray reasons = p.getReasons(); String s = convertBitArrayToReasonNames(reasons); if (s.length() > 0) { - pairs.add(REASONS, s); + pairs.put(REASONS, s); } else { - pairs.add(REASONS, ""); + pairs.put(REASONS, ""); } gns = p.getCRLIssuer(); if (gns == null) { - pairs.add(ISSUER_TYPE, GN_DIRECTORY_NAME); - pairs.add(ISSUER_NAME, ""); + pairs.put(ISSUER_TYPE, GN_DIRECTORY_NAME); + pairs.put(ISSUER_NAME, ""); } else { GeneralName gn = (GeneralName) gns.elementAt(0); @@ -532,8 +530,8 @@ public class CRLDistributionPointsExtDefault extends EnrollExtDefault { hasFullName = true; int type = gn.getType(); - pairs.add(ISSUER_TYPE, getGeneralNameType(gn)); - pairs.add(ISSUER_NAME, getGeneralNameValue(gn)); + pairs.put(ISSUER_TYPE, getGeneralNameType(gn)); + pairs.put(ISSUER_NAME, getGeneralNameValue(gn)); } } return pairs; 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 855cd92c7..5310986d5 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 @@ -641,11 +641,9 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe sb.append("Record #"); sb.append(i); sb.append("\r\n"); - Enumeration<String> e = pairs.getNames(); - while (e.hasMoreElements()) { - String key = e.nextElement(); - String val = pairs.getValue(key); + for (String key : pairs.keySet()) { + String val = pairs.get(key); sb.append(key); sb.append(":"); @@ -691,9 +689,9 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe throw new EPropertyException("Bad Input Format"); } else { if (pos == (token.length() - 1)) { - nvps.add(token.substring(0, pos), ""); + nvps.put(token.substring(0, pos), ""); } else { - nvps.add(token.substring(0, pos), token.substring(pos + 1)); + nvps.put(token.substring(0, pos), token.substring(pos + 1)); } } } 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 a2de3f491..739fd3448 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 @@ -230,8 +230,7 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { int i = 0; for (; i < size; i++) { - NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration<String> names = nvps.getNames(); + NameValuePairs nvps = v.elementAt(i); String pointType = null; String pointValue = null; String issuerType = null; @@ -239,19 +238,18 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { String enable = null; CRLDistributionPoint cdp = new CRLDistributionPoint(); - while (names.hasMoreElements()) { - String name1 = (String) names.nextElement(); + for (String name1 : nvps.keySet()) { if (name1.equals(POINT_TYPE)) { - pointType = nvps.getValue(name1); + pointType = nvps.get(name1); } else if (name1.equals(POINT_NAME)) { - pointValue = nvps.getValue(name1); + pointValue = nvps.get(name1); } else if (name1.equals(ISSUER_TYPE)) { - issuerType = nvps.getValue(name1); + issuerType = nvps.get(name1); } else if (name1.equals(ISSUER_NAME)) { - issuerValue = nvps.getValue(name1); + issuerValue = nvps.get(name1); } else if (name1.equals(ENABLE)) { - enable = nvps.getValue(name1); + enable = nvps.get(name1); } } @@ -409,11 +407,11 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { protected NameValuePairs buildEmptyGeneralNames() { NameValuePairs pairs = new NameValuePairs(); - pairs.add(POINT_TYPE, ""); - pairs.add(POINT_NAME, ""); - pairs.add(ISSUER_TYPE, ""); - pairs.add(ISSUER_NAME, ""); - pairs.add(ENABLE, "false"); + pairs.put(POINT_TYPE, ""); + pairs.put(POINT_NAME, ""); + pairs.put(ISSUER_TYPE, ""); + pairs.put(ISSUER_NAME, ""); + pairs.put(ENABLE, "false"); return pairs; } @@ -424,10 +422,10 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { boolean hasFullName = false; - pairs.add(ENABLE, "true"); + pairs.put(ENABLE, "true"); if (gns == null) { - pairs.add(POINT_TYPE, ""); - pairs.add(POINT_NAME, ""); + pairs.put(POINT_TYPE, ""); + pairs.put(POINT_NAME, ""); } else { GeneralName gn = (GeneralName) gns.elementAt(0); @@ -435,21 +433,21 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { hasFullName = true; int type = gn.getType(); - pairs.add(POINT_TYPE, getGeneralNameType(gn)); - pairs.add(POINT_NAME, getGeneralNameValue(gn)); + pairs.put(POINT_TYPE, getGeneralNameType(gn)); + pairs.put(POINT_NAME, getGeneralNameValue(gn)); } } if (!hasFullName) { - pairs.add(POINT_TYPE, GN_DIRECTORY_NAME); - pairs.add(POINT_NAME, ""); + pairs.put(POINT_TYPE, GN_DIRECTORY_NAME); + pairs.put(POINT_NAME, ""); } gns = p.getCRLIssuer(); if (gns == null) { - pairs.add(ISSUER_TYPE, GN_DIRECTORY_NAME); - pairs.add(ISSUER_NAME, ""); + pairs.put(ISSUER_TYPE, GN_DIRECTORY_NAME); + pairs.put(ISSUER_NAME, ""); } else { GeneralName gn = (GeneralName) gns.elementAt(0); @@ -457,8 +455,8 @@ public class FreshestCRLExtDefault extends EnrollExtDefault { hasFullName = true; int type = gn.getType(); - pairs.add(ISSUER_TYPE, getGeneralNameType(gn)); - pairs.add(ISSUER_NAME, getGeneralNameValue(gn)); + pairs.put(ISSUER_TYPE, getGeneralNameType(gn)); + pairs.put(ISSUER_NAME, getGeneralNameValue(gn)); } } return pairs; 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 c513c332b..e57d04067 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 @@ -366,20 +366,18 @@ public class NameConstraintsExtDefault extends EnrollExtDefault { Vector<GeneralSubtree> subtrees = new Vector<GeneralSubtree>(); for (int i = 0; i < size; i++) { - NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration<String> names = nvps.getNames(); + NameValuePairs nvps = v.elementAt(i); - while (names.hasMoreElements()) { - String name1 = (String) names.nextElement(); + for (String name1 : nvps.keySet()) { if (name1.equals(GENERAL_NAME_CHOICE)) { - choice = nvps.getValue(name1); + choice = nvps.get(name1); } else if (name1.equals(GENERAL_NAME_VALUE)) { - val = nvps.getValue(name1); + val = nvps.get(name1); } else if (name1.equals(MIN_VALUE)) { - minS = nvps.getValue(name1); + minS = nvps.get(name1); } else if (name1.equals(MAX_VALUE)) { - maxS = nvps.getValue(name1); + maxS = nvps.get(name1); } } @@ -527,11 +525,11 @@ public class NameConstraintsExtDefault extends EnrollExtDefault { NameValuePairs pairs = new NameValuePairs(); - pairs.add(GENERAL_NAME_CHOICE, type); - pairs.add(GENERAL_NAME_VALUE, getGeneralNameValue(gn)); - pairs.add(MIN_VALUE, Integer.toString(min)); - pairs.add(MAX_VALUE, Integer.toString(max)); - pairs.add(ENABLE, "true"); + pairs.put(GENERAL_NAME_CHOICE, type); + pairs.put(GENERAL_NAME_VALUE, getGeneralNameValue(gn)); + pairs.put(MIN_VALUE, Integer.toString(min)); + pairs.put(MAX_VALUE, Integer.toString(max)); + pairs.put(ENABLE, "true"); recs.addElement(pairs); } 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 183ef87bc..1f05fef3e 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 @@ -216,18 +216,16 @@ public class PolicyMappingsExtDefault extends EnrollExtDefault { Vector<CertificatePolicyMap> policyMaps = new Vector<CertificatePolicyMap>(); for (int i = 0; i < size; i++) { - NameValuePairs nvps = (NameValuePairs) v.elementAt(i); - Enumeration<String> names = nvps.getNames(); + NameValuePairs nvps = v.elementAt(i); - while (names.hasMoreElements()) { - String name1 = (String) names.nextElement(); + for (String name1 : nvps.keySet()) { if (name1.equals(ISSUER_POLICY_ID)) { - issuerPolicyId = nvps.getValue(name1); + issuerPolicyId = nvps.get(name1); } else if (name1.equals(SUBJECT_POLICY_ID)) { - subjectPolicyId = nvps.getValue(name1); + subjectPolicyId = nvps.get(name1); } else if (name1.equals(POLICY_ID_ENABLE)) { - enable = nvps.getValue(name1); + enable = nvps.get(name1); } } @@ -327,13 +325,13 @@ public class PolicyMappingsExtDefault extends EnrollExtDefault { CertificatePolicyId i1 = map.getIssuerIdentifier(); CertificatePolicyId s1 = map.getSubjectIdentifier(); - pairs.add(ISSUER_POLICY_ID, i1.getIdentifier().toString()); - pairs.add(SUBJECT_POLICY_ID, s1.getIdentifier().toString()); - pairs.add(POLICY_ID_ENABLE, "true"); + pairs.put(ISSUER_POLICY_ID, i1.getIdentifier().toString()); + pairs.put(SUBJECT_POLICY_ID, s1.getIdentifier().toString()); + pairs.put(POLICY_ID_ENABLE, "true"); } else { - pairs.add(ISSUER_POLICY_ID, ""); - pairs.add(SUBJECT_POLICY_ID, ""); - pairs.add(POLICY_ID_ENABLE, "false"); + pairs.put(ISSUER_POLICY_ID, ""); + pairs.put(SUBJECT_POLICY_ID, ""); + pairs.put(POLICY_ID_ENABLE, "false"); } recs.addElement(pairs); 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 a706fb4ad..cca5ab234 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 @@ -220,19 +220,18 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { Vector<Attribute> attrV = new Vector<Attribute>(); for (int i = 0; i < size; i++) { NameValuePairs nvps = v.elementAt(i); - Enumeration<String> names = nvps.getNames(); String attrName = null; String attrValue = null; String enable = "false"; - while (names.hasMoreElements()) { - String name1 = names.nextElement(); + + for (String name1 : nvps.keySet()) { if (name1.equals(ATTR_NAME)) { - attrName = nvps.getValue(name1); + attrName = nvps.get(name1); } else if (name1.equals(ATTR_VALUE)) { - attrValue = nvps.getValue(name1); + attrValue = nvps.get(name1); } else if (name1.equals(ENABLE)) { - enable = nvps.getValue(name1); + enable = nvps.get(name1); } } @@ -316,7 +315,7 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { while (e.hasMoreElements()) { NameValuePairs pairs = new NameValuePairs(); - pairs.add(ENABLE, "true"); + pairs.put(ENABLE, "true"); Attribute attr = e.nextElement(); CMS.debug("SubjectDirAttributesExtDefault: getValue: attribute=" + attr); ObjectIdentifier oid = attr.getOid(); @@ -325,9 +324,9 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { String vv = map.getName(oid); if (vv != null) - pairs.add(ATTR_NAME, vv); + pairs.put(ATTR_NAME, vv); else - pairs.add(ATTR_NAME, oid.toString()); + pairs.put(ATTR_NAME, oid.toString()); Enumeration<String> v = attr.getValues(); // just support single value for now @@ -341,16 +340,16 @@ public class SubjectDirAttributesExtDefault extends EnrollExtDefault { } } - pairs.add(ATTR_VALUE, ss.toString()); + pairs.put(ATTR_VALUE, ss.toString()); recs.addElement(pairs); i++; } for (; i < num; i++) { NameValuePairs pairs = new NameValuePairs(); - pairs.add(ENABLE, "false"); - pairs.add(ATTR_NAME, "GENERATIONQUALIFIER"); - pairs.add(ATTR_VALUE, ""); + pairs.put(ENABLE, "false"); + pairs.put(ATTR_NAME, "GENERATIONQUALIFIER"); + pairs.put(ATTR_VALUE, ""); recs.addElement(pairs); } diff --git a/pki/base/common/src/com/netscape/cms/profile/def/SubjectInfoAccessExtDefault.java b/pki/base/common/src/com/netscape/cms/profile/def/SubjectInfoAccessExtDefault.java index 670728e59..104b29a08 100644 --- a/pki/base/common/src/com/netscape/cms/profile/def/SubjectInfoAccessExtDefault.java +++ b/pki/base/common/src/com/netscape/cms/profile/def/SubjectInfoAccessExtDefault.java @@ -231,19 +231,17 @@ public class SubjectInfoAccessExtDefault extends EnrollExtDefault { for (int i = 0; i < size; i++) { NameValuePairs nvps = v.elementAt(i); - Enumeration<String> names = nvps.getNames(); - while (names.hasMoreElements()) { - String name1 = names.nextElement(); + for (String name1 : nvps.keySet()) { if (name1.equals(AD_METHOD)) { - method = nvps.getValue(name1); + method = nvps.get(name1); } else if (name1.equals(AD_LOCATION_TYPE)) { - locationType = nvps.getValue(name1); + locationType = nvps.get(name1); } else if (name1.equals(AD_LOCATION)) { - location = nvps.getValue(name1); + location = nvps.get(name1); } else if (name1.equals(AD_ENABLE)) { - enable = nvps.getValue(name1); + enable = nvps.get(name1); } } @@ -347,18 +345,18 @@ public class SubjectInfoAccessExtDefault extends EnrollExtDefault { des = ext.getAccessDescription(i); } if (des == null) { - np.add(AD_METHOD, ""); - np.add(AD_LOCATION_TYPE, ""); - np.add(AD_LOCATION, ""); - np.add(AD_ENABLE, "false"); + np.put(AD_METHOD, ""); + np.put(AD_LOCATION_TYPE, ""); + np.put(AD_LOCATION, ""); + np.put(AD_ENABLE, "false"); } else { ObjectIdentifier methodOid = des.getMethod(); GeneralName gn = des.getLocation(); - np.add(AD_METHOD, methodOid.toString()); - np.add(AD_LOCATION_TYPE, getGeneralNameType(gn)); - np.add(AD_LOCATION, getGeneralNameValue(gn)); - np.add(AD_ENABLE, "true"); + np.put(AD_METHOD, methodOid.toString()); + np.put(AD_LOCATION_TYPE, getGeneralNameType(gn)); + np.put(AD_LOCATION, getGeneralNameValue(gn)); + np.put(AD_ENABLE, "true"); } recs.addElement(np); } |