diff options
Diffstat (limited to 'pki/base/common')
38 files changed, 464 insertions, 680 deletions
diff --git a/pki/base/common/src/CMakeLists.txt b/pki/base/common/src/CMakeLists.txt index ed83bb68e..6dfd322a1 100644 --- a/pki/base/common/src/CMakeLists.txt +++ b/pki/base/common/src/CMakeLists.txt @@ -90,7 +90,6 @@ set(pki-certsrv_java_SRCS com/netscape/certsrv/common/ScopeDef.java com/netscape/certsrv/common/PrefixDef.java com/netscape/certsrv/common/ConfigConstants.java - com/netscape/certsrv/common/NameValuePair.java com/netscape/certsrv/common/OpDef.java com/netscape/certsrv/common/Constants.java com/netscape/certsrv/usrgrp/EUsrGrpException.java diff --git a/pki/base/common/src/com/netscape/certsrv/common/NameValuePair.java b/pki/base/common/src/com/netscape/certsrv/common/NameValuePair.java deleted file mode 100644 index ed1d06149..000000000 --- a/pki/base/common/src/com/netscape/certsrv/common/NameValuePair.java +++ /dev/null @@ -1,68 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.certsrv.common; - -/** - * A class represents a name value pair. A name value - * pair consists of a name and a value. - * - * @version $Revision$, $Date$ - */ -public class NameValuePair { - - private String mName = null; - private String mValue = null; - - /** - * Constructs value pair object. - * - * @param name name - * @param value value - */ - public NameValuePair(String name, String value) { - mName = name; - mValue = value; - } - - /** - * Retrieves the name. - * - * @return name - */ - public String getName() { - return mName; - } - - /** - * Retrieves the value. - * - * @return value - */ - public String getValue() { - return mValue; - } - - /** - * Sets the value - * - * @param value value - */ - public void setValue(String value) { - mValue = value; - } -} diff --git a/pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java b/pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java index 61d3cad62..0999db7bc 100644 --- a/pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java +++ b/pki/base/common/src/com/netscape/certsrv/common/NameValuePairs.java @@ -17,10 +17,8 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.common; -import java.util.Enumeration; -import java.util.Hashtable; +import java.util.LinkedHashMap; import java.util.StringTokenizer; -import java.util.Vector; /** * A class represents an ordered list of name @@ -28,13 +26,9 @@ import java.util.Vector; * * @version $Revision$, $Date$ */ -public class NameValuePairs { +public class NameValuePairs extends LinkedHashMap<String, String> { - private Vector<NameValuePair> mPairs = new Vector<NameValuePair>(); - - // an index to speed up searching - // The key is the name. The element is the NameValuePair. - private Hashtable<String, NameValuePair> index = new Hashtable<String, NameValuePair>(); + private static final long serialVersionUID = 1494507857048437440L; /** * Constructs name value pairs. @@ -43,97 +37,6 @@ public class NameValuePairs { } /** - * Adds a name value pair into this set. - * if the name already exist, the value will - * be replaced. - * - * @param name name - * @param value value - */ - public void add(String name, String value) { - NameValuePair pair = getPair(name); - - if (pair == null) { - pair = new NameValuePair(name, value); - mPairs.addElement(pair); - index.put(name, pair); - } else { - pair.setValue(value); - } - } - - /** - * Retrieves name value pair from this set. - * - * @param name name - * @return name value pair - */ - public NameValuePair getPair(String name) { - return (NameValuePair) index.get(name); - } - - /** - * Returns number of pairs in this set. - * - * @return size - */ - public int size() { - return mPairs.size(); - } - - /** - * Retrieves name value pairs in specific position. - * - * @param pos position of the value - * @return name value pair - */ - public NameValuePair elementAt(int pos) { - return (NameValuePair) mPairs.elementAt(pos); - } - - /** - * Removes all name value pairs in this set. - */ - public void removeAllPairs() { - mPairs.removeAllElements(); - index.clear(); - } - - /** - * Retrieves value of the name value pairs that matches - * the given name. - * - * @param name name - * @return value - */ - public String getValue(String name) { - NameValuePair p = getPair(name); - - if (p != null) { - return p.getValue(); - } - return null; - } - - /** - * Retrieves a list of names. - * - * @return a list of names - */ - public Enumeration<String> getNames() { - Vector<String> v = new Vector<String>(); - int size = mPairs.size(); - - for (int i = 0; i < size; i++) { - NameValuePair p = (NameValuePair) mPairs.elementAt(i); - - v.addElement(p.getName()); - } - //System.out.println("getNames: "+v.size()); - return v.elements(); - } - - /** * Show the content of this name value container as * string representation. * @@ -142,12 +45,13 @@ public class NameValuePairs { public String toString() { StringBuffer buf = new StringBuffer(); - for (int i = 0; i < mPairs.size(); i++) { - NameValuePair p = (NameValuePair) mPairs.elementAt(i); + for (String name : keySet()) { + String value = get(name); - buf.append(p.getName() + "=" + p.getValue()); + buf.append(name + "=" + value); buf.append("\n"); } + return buf.toString(); } @@ -171,17 +75,8 @@ public class NameValuePairs { String n = t.substring(0, i); String v = t.substring(i + 1); - nvp.add(n, v); + nvp.put(n, v); } return true; } - - /** - * Returns a list of name value pair object. - * - * @return name value objects - */ - public Enumeration<NameValuePair> elements() { - return mPairs.elements(); - } } diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSAuthInfoAccessExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSAuthInfoAccessExtension.java index d070cc6fd..d4cef0148 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSAuthInfoAccessExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSAuthInfoAccessExtension.java @@ -159,7 +159,7 @@ public class CMSAuthInfoAccessExtension } catch (EBaseException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_AIA_INVALID_NUM_ADS", e.toString())); } - nvp.add(PROP_NUM_ADS, String.valueOf(numberOfAccessDescriptions)); + nvp.put(PROP_NUM_ADS, String.valueOf(numberOfAccessDescriptions)); for (int i = 0; i < numberOfAccessDescriptions; i++) { String accessMethod = null; @@ -175,9 +175,9 @@ public class CMSAuthInfoAccessExtension } if (accessMethod != null && accessMethod.length() > 0) { - nvp.add(PROP_ACCESS_METHOD + i, accessMethod); + nvp.put(PROP_ACCESS_METHOD + i, accessMethod); } else { - nvp.add(PROP_ACCESS_METHOD + i, PROP_ACCESS_METHOD_CAISSUERS); + nvp.put(PROP_ACCESS_METHOD + i, PROP_ACCESS_METHOD_CAISSUERS); } try { @@ -189,9 +189,9 @@ public class CMSAuthInfoAccessExtension } if (accessLocationType != null && accessLocationType.length() > 0) { - nvp.add(PROP_ACCESS_LOCATION_TYPE + i, accessLocationType); + nvp.put(PROP_ACCESS_LOCATION_TYPE + i, accessLocationType); } else { - nvp.add(PROP_ACCESS_LOCATION_TYPE + i, PROP_URINAME); + nvp.put(PROP_ACCESS_LOCATION_TYPE + i, PROP_URINAME); } try { @@ -203,14 +203,14 @@ public class CMSAuthInfoAccessExtension } if (accessLocation != null && accessLocation.length() > 0) { - nvp.add(PROP_ACCESS_LOCATION + i, accessLocation); + nvp.put(PROP_ACCESS_LOCATION + i, accessLocation); } else { String hostname = CMS.getEENonSSLHost(); String port = CMS.getEENonSSLPort(); if (hostname != null && port != null) { accessLocation = "http://" + hostname + ":" + port + "/ca/ee/ca/getCAChain?op=downloadBIN"; } - nvp.add(PROP_ACCESS_LOCATION + i, accessLocation); + nvp.put(PROP_ACCESS_LOCATION + i, accessLocation); } } } diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java index 67f4736c7..b0bf20856 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSCertificateIssuerExtension.java @@ -149,7 +149,7 @@ public class CMSCertificateIssuerExtension } catch (EBaseException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_INVALID_NUM_NAMES", e.toString())); } - nvp.add("numNames", String.valueOf(numNames)); + nvp.put("numNames", String.valueOf(numNames)); for (int i = 0; i < numNames; i++) { String nameType = null; @@ -164,9 +164,9 @@ public class CMSCertificateIssuerExtension } if (nameType != null && nameType.length() > 0) { - nvp.add("nameType" + i, nameType); + nvp.put("nameType" + i, nameType); } else { - nvp.add("nameType" + i, ""); + nvp.put("nameType" + i, ""); } String name = null; @@ -181,16 +181,16 @@ public class CMSCertificateIssuerExtension } if (name != null && name.length() > 0) { - nvp.add("name" + i, name); + nvp.put("name" + i, name); } else { - nvp.add("name" + i, ""); + nvp.put("name" + i, ""); } } if (numNames < 3) { for (int i = numNames; i < 3; i++) { - nvp.add("nameType" + i, ""); - nvp.add("name" + i, ""); + nvp.put("nameType" + i, ""); + nvp.put("name" + i, ""); } } } diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSFreshestCRLExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSFreshestCRLExtension.java index edb6494af..72dbe5502 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSFreshestCRLExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSFreshestCRLExtension.java @@ -157,7 +157,7 @@ public class CMSFreshestCRLExtension log(ILogger.LL_FAILURE, "Invalid numPoints property for CRL " + "Freshest CRL extension - " + e); } - nvp.add(PROP_NUM_POINTS, String.valueOf(numPoints)); + nvp.put(PROP_NUM_POINTS, String.valueOf(numPoints)); for (int i = 0; i < numPoints; i++) { String pointType = null; @@ -171,9 +171,9 @@ public class CMSFreshestCRLExtension } if (pointType != null && pointType.length() > 0) { - nvp.add(PROP_POINTTYPE + i, pointType); + nvp.put(PROP_POINTTYPE + i, pointType); } else { - nvp.add(PROP_POINTTYPE + i, ""); + nvp.put(PROP_POINTTYPE + i, ""); } String pointName = null; @@ -187,9 +187,9 @@ public class CMSFreshestCRLExtension } if (pointName != null && pointName.length() > 0) { - nvp.add(PROP_POINTNAME + i, pointName); + nvp.put(PROP_POINTNAME + i, pointName); } else { - nvp.add(PROP_POINTNAME + i, ""); + nvp.put(PROP_POINTNAME + i, ""); } } } diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSHoldInstructionExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSHoldInstructionExtension.java index df8d058ce..4023e3b2f 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSHoldInstructionExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSHoldInstructionExtension.java @@ -123,7 +123,7 @@ public class CMSHoldInstructionExtension } else { instruction = PROP_INSTR_NONE; } - nvp.add(PROP_INSTR, instruction); + nvp.put(PROP_INSTR, instruction); } public String[] getExtendedPluginInfo(Locale locale) { diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSIssuerAlternativeNameExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSIssuerAlternativeNameExtension.java index ee656a199..64252a0b9 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSIssuerAlternativeNameExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSIssuerAlternativeNameExtension.java @@ -200,7 +200,7 @@ public class CMSIssuerAlternativeNameExtension log(ILogger.LL_FAILURE, "Invalid numNames property for CRL " + "IssuerAlternativeName extension - " + e); } - nvp.add("numNames", String.valueOf(numNames)); + nvp.put("numNames", String.valueOf(numNames)); for (int i = 0; i < numNames; i++) { String nameType = null; @@ -216,9 +216,9 @@ public class CMSIssuerAlternativeNameExtension } if (nameType != null && nameType.length() > 0) { - nvp.add("nameType" + i, nameType); + nvp.put("nameType" + i, nameType); } else { - nvp.add("nameType" + i, ""); + nvp.put("nameType" + i, ""); } String name = null; @@ -234,16 +234,16 @@ public class CMSIssuerAlternativeNameExtension } if (name != null && name.length() > 0) { - nvp.add("name" + i, name); + nvp.put("name" + i, name); } else { - nvp.add("name" + i, ""); + nvp.put("name" + i, ""); } } if (numNames < 3) { for (int i = numNames; i < 3; i++) { - nvp.add("nameType" + i, ""); - nvp.add("name" + i, ""); + nvp.put("nameType" + i, ""); + nvp.put("name" + i, ""); } } } diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java index 21bd86b0a..4253584ce 100644 --- a/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java +++ b/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java @@ -229,9 +229,9 @@ public class CMSIssuingDistributionPointExtension log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", e.toString())); } if (pointType != null && pointType.length() > 0) { - nvp.add("pointType", pointType); + nvp.put("pointType", pointType); } else { - nvp.add("pointType", ""); + nvp.put("pointType", ""); } String pointName = null; @@ -244,9 +244,9 @@ public class CMSIssuingDistributionPointExtension log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", e.toString())); } if (pointName != null && pointName.length() > 0) { - nvp.add("pointName", pointName); + nvp.put("pointName", pointName); } else { - nvp.add("pointName", ""); + nvp.put("pointName", ""); } String reasons = null; @@ -257,17 +257,17 @@ public class CMSIssuingDistributionPointExtension log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", PROP_REASONS, e.toString())); } if (reasons != null && reasons.length() > 0) { - nvp.add(PROP_REASONS, reasons); + nvp.put(PROP_REASONS, reasons); } else { - nvp.add(PROP_REASONS, ""); + nvp.put(PROP_REASONS, ""); } try { boolean caCertsOnly = config.getBoolean(PROP_CACERTS, false); - nvp.add(PROP_CACERTS, String.valueOf(caCertsOnly)); + nvp.put(PROP_CACERTS, String.valueOf(caCertsOnly)); } catch (EBaseException e) { - nvp.add(PROP_CACERTS, "false"); + nvp.put(PROP_CACERTS, "false"); log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "caCertsOnly", e.toString())); } // Disable these for now unitl we support them fully diff --git a/pki/base/common/src/com/netscape/cms/logging/LogFile.java b/pki/base/common/src/com/netscape/cms/logging/LogFile.java index 0a5f18579..5144bf16d 100644 --- a/pki/base/common/src/com/netscape/cms/logging/LogFile.java +++ b/pki/base/common/src/com/netscape/cms/logging/LogFile.java @@ -1340,7 +1340,7 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo { try { entries = readEntry(maxLine, level, source, fName); for (int i = 0; i < entries.size(); i++) { - params.add(Integer.toString(i) + + params.put(Integer.toString(i) + ((LogEntry) entries.elementAt(i)).getEntry(), ""); } } catch (Exception e) { diff --git a/pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java b/pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java index e085937e5..93455e9fe 100644 --- a/pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java +++ b/pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java @@ -524,7 +524,7 @@ public class RollingLogFile extends LogFile { files = fileList(); for (int i = 0; i < files.length; i++) { - params.add(files[i], ""); + params.put(files[i], ""); } return params; } 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 d3b5d545e..2482d69af 100644 --- a/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java +++ b/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java @@ -798,13 +798,13 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { try { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_OCSPSTORE_IMPL_NAME, + params.put(Constants.PR_OCSPSTORE_IMPL_NAME, mConfig.getString("class")); - params.add(PROP_NOT_FOUND_GOOD, + params.put(PROP_NOT_FOUND_GOOD, mConfig.getString(PROP_NOT_FOUND_GOOD, "true")); - params.add(PROP_BY_NAME, + params.put(PROP_BY_NAME, mConfig.getString(PROP_BY_NAME, "true")); - params.add(PROP_INCLUDE_NEXT_UPDATE, + params.put(PROP_INCLUDE_NEXT_UPDATE, mConfig.getString(PROP_INCLUDE_NEXT_UPDATE, "false")); return params; } catch (Exception e) { @@ -814,12 +814,9 @@ public class DefStore implements IDefStore, IExtendedPluginInfo { public void setConfigParameters(NameValuePairs pairs) throws EBaseException { - Enumeration<String> k = pairs.getNames(); - while (k.hasMoreElements()) { - String key = (String) k.nextElement(); - - mConfig.put(key, pairs.getValue(key)); + for (String key : pairs.keySet()) { + mConfig.put(key, pairs.get(key)); } } 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 697d1bb40..11e91fdeb 100644 --- a/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java +++ b/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java @@ -531,34 +531,34 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { try { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_OCSPSTORE_IMPL_NAME, + params.put(Constants.PR_OCSPSTORE_IMPL_NAME, mConfig.getString("class")); int num = mConfig.getInteger(PROP_NUM_CONNS, 0); - params.add(PROP_NUM_CONNS, Integer.toString(num)); + params.put(PROP_NUM_CONNS, Integer.toString(num)); for (int i = 0; i < num; i++) { - params.add(PROP_HOST + Integer.toString(i), + params.put(PROP_HOST + Integer.toString(i), mConfig.getString(PROP_HOST + Integer.toString(i), "")); - params.add(PROP_PORT + Integer.toString(i), + params.put(PROP_PORT + Integer.toString(i), mConfig.getString(PROP_PORT + Integer.toString(i), "389")); - params.add(PROP_BASE_DN + Integer.toString(i), + params.put(PROP_BASE_DN + Integer.toString(i), mConfig.getString(PROP_BASE_DN + Integer.toString(i), "")); - params.add(PROP_REFRESH_IN_SEC + Integer.toString(i), + params.put(PROP_REFRESH_IN_SEC + Integer.toString(i), mConfig.getString(PROP_REFRESH_IN_SEC + Integer.toString(i), Integer.toString(DEF_REFRESH_IN_SEC))); } - params.add(PROP_BY_NAME, + params.put(PROP_BY_NAME, mConfig.getString(PROP_BY_NAME, "true")); - params.add(PROP_CA_CERT_ATTR, + params.put(PROP_CA_CERT_ATTR, mConfig.getString(PROP_CA_CERT_ATTR, DEF_CA_CERT_ATTR)); - params.add(PROP_CRL_ATTR, + params.put(PROP_CRL_ATTR, mConfig.getString(PROP_CRL_ATTR, DEF_CRL_ATTR)); - params.add(PROP_NOT_FOUND_GOOD, + params.put(PROP_NOT_FOUND_GOOD, mConfig.getString(PROP_NOT_FOUND_GOOD, "true")); - params.add(PROP_INCLUDE_NEXT_UPDATE, + params.put(PROP_INCLUDE_NEXT_UPDATE, mConfig.getString(PROP_INCLUDE_NEXT_UPDATE, "false")); return params; } catch (Exception e) { @@ -568,12 +568,9 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo { public void setConfigParameters(NameValuePairs pairs) throws EBaseException { - Enumeration<String> k = pairs.getNames(); - while (k.hasMoreElements()) { - String key = k.nextElement(); - - mConfig.put(key, pairs.getValue(key)); + for (String key : pairs.keySet()) { + mConfig.put(key, pairs.get(key)); } } } 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 cab594188..7f624cb8b 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 @@ -615,15 +615,12 @@ public abstract class BasicProfile implements IProfile { outputInfo.getName(Locale.getDefault())); outputStore.putString(prefix + "class_id", outputId); - Enumeration<String> enum1 = nvps.getNames(); + for (String name : nvps.keySet()) { - while (enum1.hasMoreElements()) { - String name = enum1.nextElement(); - - outputStore.putString(prefix + "params." + name, nvps.getValue(name)); + outputStore.putString(prefix + "params." + name, nvps.get(name)); try { if (output != null) { - output.setConfig(name, nvps.getValue(name)); + output.setConfig(name, nvps.get(name)); } } catch (EBaseException e) { CMS.debug(e.toString()); @@ -718,15 +715,12 @@ public abstract class BasicProfile implements IProfile { inputInfo.getName(Locale.getDefault())); inputStore.putString(prefix + "class_id", inputId); - Enumeration<String> enum1 = nvps.getNames(); - - while (enum1.hasMoreElements()) { - String name = enum1.nextElement(); + for (String name : nvps.keySet()) { - inputStore.putString(prefix + "params." + name, nvps.getValue(name)); + inputStore.putString(prefix + "params." + name, nvps.get(name)); try { if (input != null) { - input.setConfig(name, nvps.getValue(name)); + input.setConfig(name, nvps.get(name)); } } catch (EBaseException e) { CMS.debug(e.toString()); 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); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java index 29088fc2d..bde075334 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/ACLAdminServlet.java @@ -260,9 +260,9 @@ public class ACLAdminServlet extends AdminServlet { String desc = acl.getDescription(); if (desc == null) - params.add(acl.getName(), ""); + params.put(acl.getName(), ""); else - params.add(acl.getName(), desc); + params.put(acl.getName(), desc); } sendResponse(SUCCESS, null, params, resp); @@ -305,7 +305,7 @@ public class ACLAdminServlet extends AdminServlet { } } - params.add(Constants.PR_ACL_OPS, rights.toString()); + params.put(Constants.PR_ACL_OPS, rights.toString()); Enumeration<ACLEntry> aclEntryEnum; aclEntryEnum = acl.entries(); @@ -323,7 +323,7 @@ public class ACLAdminServlet extends AdminServlet { } } - params.add(Constants.PR_ACI, acis); + params.put(Constants.PR_ACI, acis); sendResponse(SUCCESS, null, params, resp); return; @@ -472,7 +472,7 @@ public class ACLAdminServlet extends AdminServlet { IAccessEvaluator evaluator = res.nextElement(); // params.add(evaluator.getType(), evaluator.getDescription()); - params.add(evaluator.getType(), evaluator.getClass().getName()); + params.put(evaluator.getType(), evaluator.getClass().getName()); } sendResponse(SUCCESS, null, params, resp); @@ -495,7 +495,7 @@ public class ACLAdminServlet extends AdminServlet { str.append(operators[i]); } - params.add(evaluator.getType(), str.toString()); + params.put(evaluator.getType(), str.toString()); } sendResponse(SUCCESS, null, params, resp); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java index 0e3d2c228..c7d7d619e 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java @@ -21,7 +21,9 @@ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import java.security.cert.X509Certificate; +import java.util.Collection; import java.util.Enumeration; +import java.util.Iterator; import java.util.Locale; import java.util.StringTokenizer; @@ -794,17 +796,17 @@ public class AdminServlet extends HttpServlet { StringBuffer buf = new StringBuffer(); if (params != null) { - Enumeration<String> e = params.getNames(); + Collection<String> names = params.keySet(); - if (e.hasMoreElements()) { - while (e.hasMoreElements()) { - String name = e.nextElement(); - String value = java.net.URLEncoder.encode((String) - params.getValue(name)); + if (!names.isEmpty()) { + for (Iterator<String> i = names.iterator(); i.hasNext(); ) { + String name = i.next(); + String value = java.net.URLEncoder.encode( + params.get(name)); buf.append(java.net.URLEncoder.encode(name) + "=" + value); - if (e.hasMoreElements()) + if (i.hasNext()) buf.append("&"); } byte content[] = buf.toString().getBytes(); @@ -875,7 +877,7 @@ public class AdminServlet extends HttpServlet { //System.out.println(name); //System.out.println(name+","+config.getString(name)); - params.add(name, config.getString(name)); + params.put(name, config.getString(name)); } sendResponse(SUCCESS, null, params, resp); } @@ -925,7 +927,7 @@ public class AdminServlet extends HttpServlet { while (e.hasMoreElements()) { String s = e.nextElement(); - params.add(s, config.getString(s)); + params.put(s, config.getString(s)); } sendResponse(SUCCESS, null, params, resp); } @@ -1275,7 +1277,7 @@ public class AdminServlet extends HttpServlet { String paramName = s[i].substring(0, j); String args = s[i].substring(j + 1); - nvps.add(paramName, args); + nvps.put(paramName, args); } return nvps; diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java index 6a7ad9599..cacd0b5d0 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/AuthAdminServlet.java @@ -168,7 +168,7 @@ public class AuthAdminServlet extends AdminServlet { // no need to authenticate this. if we're alive, return true. NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_PING, Constants.TRUE); + params.put(Constants.PR_PING, Constants.TRUE); sendResponse(SUCCESS, null, params, resp); return; } else { @@ -188,7 +188,7 @@ public class AuthAdminServlet extends AdminServlet { String val = configStore.getString("authType", "pwd"); NameValuePairs params = new NameValuePairs(); - params.add("authType", val); + params.put("authType", val); sendResponse(SUCCESS, null, params, resp); return; } @@ -856,7 +856,7 @@ public class AuthAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_AUTH_IMPL_NAME, implname); + params.put(Constants.PR_AUTH_IMPL_NAME, implname); // store a message in the signed audit log file auditMessage = CMS.getLogMessage( @@ -921,7 +921,7 @@ public class AuthAdminServlet extends AdminServlet { mAuths.getPlugins().get(name); if (value.isVisible()) { - params.add(name, value.getClassPath() + EDIT); + params.put(name, value.getClassPath() + EDIT); } } sendResponse(SUCCESS, null, params, resp); @@ -948,9 +948,9 @@ public class AuthAdminServlet extends AdminServlet { mAuths.getPlugins().get(value.getImplName()); if (!amgrplugin.isVisible()) { - params.add(name, value.getImplName() + ";invisible;" + enableStr); + params.put(name, value.getImplName() + ";invisible;" + enableStr); } else { - params.add(name, value.getImplName() + ";visible;" + enableStr); + params.put(name, value.getImplName() + ";visible;" + enableStr); } } sendResponse(SUCCESS, null, params, resp); @@ -1316,10 +1316,10 @@ public class AuthAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); // implName is always required so always send it. - params.add(Constants.PR_AUTH_IMPL_NAME, ""); + params.put(Constants.PR_AUTH_IMPL_NAME, ""); if (configParams != null) { for (int i = 0; i < configParams.length; i++) { - params.add(configParams[i], ""); + params.put(configParams[i], ""); } } sendResponse(0, null, params, resp); @@ -1355,7 +1355,7 @@ public class AuthAdminServlet extends AdminServlet { String[] configParams = mgrInst.getConfigParams(); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_AUTH_IMPL_NAME, mgrInst.getImplName()); + params.put(Constants.PR_AUTH_IMPL_NAME, mgrInst.getImplName()); // implName is always required so always send it. if (configParams != null) { for (int i = 0; i < configParams.length; i++) { @@ -1363,9 +1363,9 @@ public class AuthAdminServlet extends AdminServlet { String val = (String) config.get(key); if (val != null) { - params.add(key, val); + params.put(key, val); } else { - params.add(key, ""); + params.put(key, ""); } } } @@ -1501,7 +1501,7 @@ public class AuthAdminServlet extends AdminServlet { NameValuePairs saveParams = new NameValuePairs(); // implName is always required so always include it it. - saveParams.add(IAuthSubsystem.PROP_PLUGIN, + saveParams.put(IAuthSubsystem.PROP_PLUGIN, (String) oldConfig.get(IAuthSubsystem.PROP_PLUGIN)); if (oldConfigParms != null) { for (int i = 0; i < oldConfigParms.length; i++) { @@ -1509,7 +1509,7 @@ public class AuthAdminServlet extends AdminServlet { Object val = oldConfig.get(key); if (val != null) { - saveParams.add(key, (String) val); + saveParams.put(key, (String) val); } } } @@ -1711,11 +1711,8 @@ public class AuthAdminServlet extends AdminServlet { store.removeSubStore(id); IConfigStore rstore = store.makeSubStore(id); - Enumeration<String> keys = saveParams.getNames(); - - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - String value = saveParams.getValue(key); + for (String key : saveParams.keySet()) { + String value = saveParams.get(key); if (value != null) rstore.put(key, value); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java index 5bcaa46d2..e7b32e844 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/CAAdminServlet.java @@ -243,10 +243,10 @@ public class CAAdminServlet extends AdminServlet { continue; if (name.equals(Constants.PR_ENABLE)) continue; - params.add(name, rc.getString(name, "")); + params.put(name, rc.getString(name, "")); } - params.add(Constants.PR_ENABLE, + params.put(Constants.PR_ENABLE, rc.getString(PROP_ENABLED, Constants.FALSE)); sendResponse(SUCCESS, null, params, resp); } @@ -304,10 +304,10 @@ public class CAAdminServlet extends AdminServlet { continue; if (name.equals(Constants.PR_ENABLE)) continue; - params.add(name, riq.getString(name, "")); + params.put(name, riq.getString(name, "")); } - params.add(Constants.PR_ENABLE, + params.put(Constants.PR_ENABLE, riq.getString(PROP_ENABLED, Constants.FALSE)); sendResponse(SUCCESS, null, params, resp); } @@ -462,8 +462,8 @@ public class CAAdminServlet extends AdminServlet { String ipId = ip.getId(); if (ipId != null && ipId.length() > 0) - params.add(ipId, ip.getDescription()); - params.add(ipId + "." + Constants.PR_ENABLED, + params.put(ipId, ip.getDescription()); + params.put(ipId + "." + Constants.PR_ENABLED, (Boolean.valueOf(ip.isCRLIssuingPointEnabled())).toString()); } } @@ -504,7 +504,7 @@ public class CAAdminServlet extends AdminServlet { if (name.equals(Constants.PR_CLASS)) value = ip.getClass().getName(); - params.add(name, value); + params.put(name, value); } } } @@ -552,7 +552,7 @@ public class CAAdminServlet extends AdminServlet { sendResponse(ERROR, "Missing CRL IP name", null, resp); return; } - params.add(Constants.PR_ID, ipId); + params.put(Constants.PR_ID, ipId); String desc = req.getParameter(Constants.PR_DESCRIPTION); @@ -569,7 +569,7 @@ public class CAAdminServlet extends AdminServlet { sendResponse(ERROR, "Missing CRL IP description", null, resp); return; } - params.add(Constants.PR_DESCRIPTION, desc); + params.put(Constants.PR_DESCRIPTION, desc); String sEnable = req.getParameter(Constants.PR_ENABLED); boolean enable = true; @@ -577,9 +577,9 @@ public class CAAdminServlet extends AdminServlet { if (sEnable != null && sEnable.length() > 0 && sEnable.equalsIgnoreCase(Constants.FALSE)) { enable = false; - params.add(Constants.PR_ENABLED, Constants.FALSE); + params.put(Constants.PR_ENABLED, Constants.FALSE); } else { - params.add(Constants.PR_ENABLED, Constants.TRUE); + params.put(Constants.PR_ENABLED, Constants.TRUE); } IConfigStore crlSubStore = @@ -708,7 +708,7 @@ public class CAAdminServlet extends AdminServlet { sendResponse(ERROR, "Missing CRL IP name", null, resp); return; } - params.add(Constants.PR_ID, ipId); + params.put(Constants.PR_ID, ipId); String desc = req.getParameter(Constants.PR_DESCRIPTION); @@ -725,7 +725,7 @@ public class CAAdminServlet extends AdminServlet { sendResponse(ERROR, "Missing CRL IP description", null, resp); return; } - params.add(Constants.PR_DESCRIPTION, desc); + params.put(Constants.PR_DESCRIPTION, desc); String sEnable = req.getParameter(Constants.PR_ENABLED); boolean enable = true; @@ -733,9 +733,9 @@ public class CAAdminServlet extends AdminServlet { if (sEnable != null && sEnable.length() > 0 && sEnable.equalsIgnoreCase(Constants.FALSE)) { enable = false; - params.add(Constants.PR_ENABLED, Constants.FALSE); + params.put(Constants.PR_ENABLED, Constants.FALSE); } else { - params.add(Constants.PR_ENABLED, Constants.TRUE); + params.put(Constants.PR_ENABLED, Constants.TRUE); } IConfigStore crlSubStore = @@ -1036,7 +1036,7 @@ public class CAAdminServlet extends AdminServlet { continue; String value = req.getParameter(name); - params.add(name, value); + params.put(name, value); } crlExts.setConfigParams(id, params, crlExtSubStore); commit(true); @@ -1125,7 +1125,7 @@ public class CAAdminServlet extends AdminServlet { crlExtEnabled = crlExtSubStore.getBoolean(name, false); } } - params.add(extName, extName + ";visible;" + ((crlExtEnabled) ? "enabled" : "disabled")); + params.put(extName, extName + ";visible;" + ((crlExtEnabled) ? "enabled" : "disabled")); } } @@ -1245,7 +1245,7 @@ public class CAAdminServlet extends AdminServlet { continue; String value = req.getParameter(name); - params.add(name, value); + params.put(name, value); crlSubStore.putString(name, value); } boolean noRestart = ip.updateConfig(params); @@ -1334,7 +1334,7 @@ public class CAAdminServlet extends AdminServlet { continue; if (name.equals(Constants.PR_ENABLE)) continue; - params.add(name, crlSubStore.getString(name, "")); + params.put(name, crlSubStore.getString(name, "")); } getSigningAlgConfig(params); @@ -1369,7 +1369,7 @@ public class CAAdminServlet extends AdminServlet { if (name.equals(Constants.OP_TYPE)) continue; - params.add(name, caConnectorConfig.getString(name, "")); + params.put(name, caConnectorConfig.getString(name, "")); } } sendResponse(SUCCESS, null, params, resp); @@ -1488,7 +1488,7 @@ public class CAAdminServlet extends AdminServlet { IConfigStore caConfig = mCA.getConfigStore(); value = caConfig.getString(ICertificateAuthority.PROP_ENABLE_PAST_CATIME, "false"); - params.add(Constants.PR_VALIDITY, value); + params.put(Constants.PR_VALIDITY, value); getSigningAlgConfig(params); getSerialConfig(params); @@ -1498,7 +1498,7 @@ public class CAAdminServlet extends AdminServlet { } private void getSigningAlgConfig(NameValuePairs params) { - params.add(Constants.PR_DEFAULT_ALGORITHM, + params.put(Constants.PR_DEFAULT_ALGORITHM, mCA.getDefaultAlgorithm()); String[] algorithms = mCA.getCASigningAlgorithms(); StringBuffer algorStr = new StringBuffer(); @@ -1511,16 +1511,16 @@ public class CAAdminServlet extends AdminServlet { algorStr.append(algorithms[i]); } } - params.add(Constants.PR_ALL_ALGORITHMS, algorStr.toString()); + params.put(Constants.PR_ALL_ALGORITHMS, algorStr.toString()); } private void getSerialConfig(NameValuePairs params) { - params.add(Constants.PR_SERIAL, + params.put(Constants.PR_SERIAL, mCA.getStartSerial()); } private void getMaxSerialConfig(NameValuePairs params) { - params.add(Constants.PR_MAXSERIAL, + params.put(Constants.PR_MAXSERIAL, mCA.getMaxSerial()); } 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 58fb1d03f..3a2ae0a11 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 @@ -320,9 +320,9 @@ public final class CMSAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); if (File.separator.equals("\\")) - params.add(Constants.PR_NT, Constants.TRUE); + params.put(Constants.PR_NT, Constants.TRUE); else - params.add(Constants.PR_NT, Constants.FALSE); + params.put(Constants.PR_NT, Constants.FALSE); sendResponse(SUCCESS, null, params, resp); } @@ -335,7 +335,7 @@ public final class CMSAdminServlet extends AdminServlet { CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_TOKEN_LIST, jssSubSystem.getTokenList()); + params.put(Constants.PR_TOKEN_LIST, jssSubSystem.getTokenList()); sendResponse(SUCCESS, null, params, resp); } @@ -348,7 +348,7 @@ public final class CMSAdminServlet extends AdminServlet { ICryptoSubsystem jssSubSystem = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); - params.add(Constants.PR_ALL_NICKNAMES, jssSubSystem.getAllCerts()); + params.put(Constants.PR_ALL_NICKNAMES, jssSubSystem.getAllCerts()); sendResponse(SUCCESS, null, params, resp); } @@ -405,10 +405,10 @@ public final class CMSAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_CIPHER_VERSION, + params.put(Constants.PR_CIPHER_VERSION, jssSubSystem.getCipherVersion()); - params.add(Constants.PR_CIPHER_FORTEZZA, jssSubSystem.isCipherFortezza()); - params.add(Constants.PR_CIPHER_PREF, jssSubSystem.getCipherPreferences()); + params.put(Constants.PR_CIPHER_FORTEZZA, jssSubSystem.isCipherFortezza()); + params.put(Constants.PR_CIPHER_PREF, jssSubSystem.getCipherPreferences()); String tokenList = jssSubSystem.getTokenList(); @@ -426,10 +426,10 @@ public final class CMSAdminServlet extends AdminServlet { else tokenNewList = tokenNewList + "," + tokenName; tokenName = escapeString(tokenName); - params.add(Constants.PR_TOKEN_PREFIX + tokenName, certs); + params.put(Constants.PR_TOKEN_PREFIX + tokenName, certs); } - params.add(Constants.PR_TOKEN_LIST, tokenNewList); + params.put(Constants.PR_TOKEN_LIST, tokenNewList); if (isCAInstalled) { ICertificateAuthority ca = (ICertificateAuthority) CMS.getSubsystem(CMS.SUBSYSTEM_CA); @@ -443,7 +443,7 @@ public final class CMSAdminServlet extends AdminServlet { String caNickName = signingUnit.getNickname(); //params.add(Constants.PR_CERT_CA, caTokenName+","+caNickName); - params.add(Constants.PR_CERT_CA, getCertNickname(caNickName)); + params.put(Constants.PR_CERT_CA, getCertNickname(caNickName)); } if (isRAInstalled) { @@ -451,7 +451,7 @@ public final class CMSAdminServlet extends AdminServlet { CMS.getSubsystem(CMS.SUBSYSTEM_RA); String raNickname = ra.getNickname(); - params.add(Constants.PR_CERT_RA, getCertNickname(raNickname)); + params.put(Constants.PR_CERT_RA, getCertNickname(raNickname)); } if (isKRAInstalled) { @@ -459,12 +459,12 @@ public final class CMSAdminServlet extends AdminServlet { CMS.getSubsystem(CMS.SUBSYSTEM_KRA); String kraNickname = kra.getNickname(); - params.add(Constants.PR_CERT_TRANS, getCertNickname(kraNickname)); + params.put(Constants.PR_CERT_TRANS, getCertNickname(kraNickname)); } String nickName = CMS.getServerCertNickname(); - params.add(Constants.PR_CERT_SERVER, getCertNickname(nickName)); + params.put(Constants.PR_CERT_SERVER, getCertNickname(nickName)); sendResponse(SUCCESS, null, params, resp); } @@ -795,7 +795,7 @@ public final class CMSAdminServlet extends AdminServlet { if (sys instanceof ITKSAuthority) type = Constants.PR_TKS_INSTANCE; if (!type.trim().equals("")) - params.add(sys.getId(), type); + params.put(sys.getId(), type); } sendResponse(SUCCESS, null, params, resp); @@ -811,25 +811,25 @@ public final class CMSAdminServlet extends AdminServlet { IConfigStore cs = CMS.getConfigStore(); try { String installdate = cs.getString(Constants.PR_STAT_INSTALLDATE, ""); - params.add(Constants.PR_STAT_INSTALLDATE, installdate); + params.put(Constants.PR_STAT_INSTALLDATE, installdate); } catch (Exception e) { } try { String version = cs.getString(Constants.PR_STAT_VERSION, ""); - params.add(Constants.PR_STAT_VERSION, version); + params.put(Constants.PR_STAT_VERSION, version); } catch (Exception e) { } try { String instanceId = cs.getString(Constants.PR_STAT_INSTANCEID, ""); - params.add(Constants.PR_STAT_INSTANCEID, instanceId); + params.put(Constants.PR_STAT_INSTANCEID, instanceId); } catch (Exception e) { } - params.add(Constants.PR_STAT_STARTUP, + params.put(Constants.PR_STAT_STARTUP, (new Date(CMS.getStartupTime())).toString()); - params.add(Constants.PR_STAT_TIME, + params.put(Constants.PR_STAT_TIME, (new Date(System.currentTimeMillis())).toString()); sendResponse(SUCCESS, null, params, resp); } @@ -890,8 +890,8 @@ public final class CMSAdminServlet extends AdminServlet { String masterKeyPrefix = CMS.getConfigStore().getString("tks.master_key_prefix", null); SessionKey.SetDefaultPrefix(masterKeyPrefix); - params.add(Constants.PR_KEY_LIST, newKeyName); - params.add(Constants.PR_TOKEN_LIST, selectedToken); + params.put(Constants.PR_KEY_LIST, newKeyName); + params.put(Constants.PR_TOKEN_LIST, selectedToken); } sendResponse(SUCCESS, null, params, resp); } @@ -937,7 +937,7 @@ public final class CMSAdminServlet extends AdminServlet { } // String symKeys = new String("key1,key2"); String symKeys = SessionKey.ListSymmetricKeys(selectedToken); - params.add(Constants.PR_TOKEN_LIST, symKeys); + params.put(Constants.PR_TOKEN_LIST, symKeys); } } @@ -966,9 +966,9 @@ public final class CMSAdminServlet extends AdminServlet { if (name.equals(Constants.OP_SCOPE)) continue; if (name.equals(Constants.PR_SECURE_PORT_ENABLED)) - params.add(name, ldapConfig.getString(name, "Constants.FALSE")); + params.put(name, ldapConfig.getString(name, "Constants.FALSE")); else - params.add(name, ldapConfig.getString(name, "")); + params.put(name, ldapConfig.getString(name, "")); } sendResponse(SUCCESS, null, params, resp); } @@ -1006,9 +1006,9 @@ public final class CMSAdminServlet extends AdminServlet { IConfigStore dbConfig = mConfig.getSubStore(PROP_SMTP); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_SERVER_NAME, + params.put(Constants.PR_SERVER_NAME, dbConfig.getString("host")); - params.add(Constants.PR_PORT, + params.put(Constants.PR_PORT, dbConfig.getString("port")); sendResponse(SUCCESS, null, params, resp); } @@ -1064,7 +1064,7 @@ public final class CMSAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_LOGGED_IN, "" + status); + params.put(Constants.PR_LOGGED_IN, "" + status); sendResponse(SUCCESS, null, params, resp); } @@ -1210,8 +1210,8 @@ public final class CMSAdminServlet extends AdminServlet { } String certReq = jssSubSystem.getCertRequest(subjectName, keypair); - params.add(Constants.PR_CSR, certReq); - params.add(Constants.PR_CERT_REQUEST_DIR, dir); + params.put(Constants.PR_CSR, certReq); + params.put(Constants.PR_CERT_REQUEST_DIR, dir); PrintStream ps = new PrintStream(new FileOutputStream(pathname)); ps.println(certReq); @@ -2432,8 +2432,8 @@ public final class CMSAdminServlet extends AdminServlet { String content = jssSubSystem.getCertPrettyPrint(b64Cert, super.getLocale(req)); - results.add(Constants.PR_NICKNAME, "FBCA cross-signed cert"); - results.add(Constants.PR_CERT_CONTENT, content); + results.put(Constants.PR_NICKNAME, "FBCA cross-signed cert"); + results.put(Constants.PR_CERT_CONTENT, content); // store a message in the signed audit log file auditMessage = CMS.getLogMessage( @@ -2618,8 +2618,8 @@ public final class CMSAdminServlet extends AdminServlet { super.getLocale(req)); if (nickname != null && !nickname.equals("")) - results.add(Constants.PR_NICKNAME, nickname); - results.add(Constants.PR_CERT_CONTENT, content); + results.put(Constants.PR_NICKNAME, nickname); + results.put(Constants.PR_CERT_CONTENT, content); //results = jssSubSystem.getCertInfo(value); sendResponse(SUCCESS, null, results, resp); @@ -2664,7 +2664,7 @@ public final class CMSAdminServlet extends AdminServlet { String print = jssSubSystem.getCertPrettyPrintAndFingerPrint(nickname, serialno, issuername, locale); - pairs.add(nickname, print); + pairs.put(nickname, print); sendResponse(SUCCESS, null, pairs, resp); } @@ -2707,7 +2707,7 @@ public final class CMSAdminServlet extends AdminServlet { String trustbit = jssSubSystem.getRootCertTrustBit(nickname, serialno, issuername); - pairs.add(nickname, trustbit); + pairs.put(nickname, trustbit); sendResponse(SUCCESS, null, pairs, resp); } @@ -2924,7 +2924,7 @@ public final class CMSAdminServlet extends AdminServlet { CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); String subjectName = jssSubSystem.getSubjectDN(nickname); - params.add(Constants.PR_SUBJECT_NAME, subjectName); + params.put(Constants.PR_SUBJECT_NAME, subjectName); sendResponse(SUCCESS, null, params, resp); } @@ -2950,7 +2950,7 @@ public final class CMSAdminServlet extends AdminServlet { CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); String subjectName = jssSubSystem.getSubjectDN(nickname); - params.add(Constants.PR_SUBJECT_NAME, subjectName); + params.put(Constants.PR_SUBJECT_NAME, subjectName); sendResponse(SUCCESS, null, params, resp); } @@ -3342,9 +3342,9 @@ public final class CMSAdminServlet extends AdminServlet { audit(auditMessage); // notify console of SUCCESS - results.add(Constants.PR_RUN_SELFTESTS_ON_DEMAND_CLASS, + results.put(Constants.PR_RUN_SELFTESTS_ON_DEMAND_CLASS, CMSAdminServlet.class.getName()); - results.add(Constants.PR_RUN_SELFTESTS_ON_DEMAND_CONTENT, + results.put(Constants.PR_RUN_SELFTESTS_ON_DEMAND_CONTENT, content); sendResponse(SUCCESS, null, results, resp); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java index a9baa874c..42ff32ebe 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/JobsAdminServlet.java @@ -510,7 +510,7 @@ public class JobsAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_JOBS_IMPL_NAME, implname); + params.put(Constants.PR_JOBS_IMPL_NAME, implname); sendResponse(SUCCESS, null, params, resp); return; } @@ -526,7 +526,7 @@ public class JobsAdminServlet extends AdminServlet { String name = e.nextElement(); JobPlugin value = mJobsSched.getPlugins().get(name); - params.add(name, value.getClassPath()); + params.put(name, value.getClassPath()); // params.add(name, value.getClassPath()+EDIT); } sendResponse(SUCCESS, null, params, resp); @@ -544,9 +544,9 @@ public class JobsAdminServlet extends AdminServlet { IJob value = mJobsSched.getInstances().get((Object) name); // params.add(name, value.getImplName()); - params.add(name, value.getImplName() + VISIBLE + + params.put(name, value.getImplName() + VISIBLE + (value.isEnabled() ? ENABLED : DISABLED) - ); + ); } sendResponse(SUCCESS, null, params, resp); return; @@ -691,10 +691,10 @@ public class JobsAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); // implName is always required so always send it. - params.add(Constants.PR_JOBS_IMPL_NAME, ""); + params.put(Constants.PR_JOBS_IMPL_NAME, ""); if (configParams != null) { for (int i = 0; i < configParams.length; i++) { - params.add(configParams[i], ""); + params.put(configParams[i], ""); } } sendResponse(0, null, params, resp); @@ -728,7 +728,7 @@ public class JobsAdminServlet extends AdminServlet { String[] configParams = jobInst.getConfigParams(); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_JOBS_IMPL_NAME, jobInst.getImplName()); + params.put(Constants.PR_JOBS_IMPL_NAME, jobInst.getImplName()); // implName is always required so always send it. if (configParams != null) { @@ -738,9 +738,9 @@ public class JobsAdminServlet extends AdminServlet { String val = (String) config.get(key); if (val != null && !val.equals("")) { - params.add(key, val); + params.put(key, val); } else { - params.add(key, ""); + params.put(key, ""); } } } @@ -813,7 +813,7 @@ public class JobsAdminServlet extends AdminServlet { NameValuePairs saveParams = new NameValuePairs(); // implName is always required so always include it it. - saveParams.add(IJobsScheduler.PROP_PLUGIN, + saveParams.put(IJobsScheduler.PROP_PLUGIN, (String) oldConfig.get(IJobsScheduler.PROP_PLUGIN)); if (oldConfigParms != null) { for (int i = 0; i < oldConfigParms.length; i++) { @@ -821,7 +821,7 @@ public class JobsAdminServlet extends AdminServlet { Object val = oldConfig.get(key); if (val != null) { - saveParams.add(key, (String) val); + saveParams.put(key, (String) val); } } } @@ -945,11 +945,11 @@ public class JobsAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); IConfigStore config = mConfig.getSubStore(DestDef.DEST_JOBS_ADMIN); - params.add(Constants.PR_ENABLE, + params.put(Constants.PR_ENABLE, config.getString(IJobsScheduler.PROP_ENABLED, Constants.FALSE)); // default 1 minute - params.add(Constants.PR_JOBS_FREQUENCY, + params.put(Constants.PR_JOBS_FREQUENCY, config.getString(IJobsScheduler.PROP_INTERVAL, "1")); //System.out.println("Send: "+params.toString()); @@ -997,11 +997,8 @@ public class JobsAdminServlet extends AdminServlet { store.removeSubStore(id); IConfigStore rstore = store.makeSubStore(id); - Enumeration<String> keys = saveParams.getNames(); - - while (keys.hasMoreElements()) { - String key = keys.nextElement(); - String value = saveParams.getValue(key); + for (String key : saveParams.keySet()) { + String value = saveParams.get(key); if (!value.equals("")) rstore.put(key, value); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java index 0d3648c98..eaa5a95c4 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/KRAAdminServlet.java @@ -180,7 +180,7 @@ public class KRAAdminServlet extends AdminServlet { int value = 1; value = mKRA.getNoOfRequiredAgents(); - params.add(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS, Integer.toString(value)); + params.put(Constants.PR_NO_OF_REQUIRED_RECOVERY_AGENTS, Integer.toString(value)); sendResponse(SUCCESS, null, params, resp); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java index ff70a5c53..be723fcd6 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java @@ -355,7 +355,7 @@ public class LogAdminServlet extends AdminServlet { // not show ntEventlog here if (all || (!all && !c.endsWith("NTEventLog"))) - params.add(name, pName + ";visible"); + params.put(name, pName + ";visible"); } sendResponse(SUCCESS, null, params, resp); return; @@ -976,7 +976,7 @@ public class LogAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_LOG_IMPL_NAME, implname); + params.put(Constants.PR_LOG_IMPL_NAME, implname); // store a message in the signed audit log file if (logType.equals(SIGNED_AUDIT_LOG_TYPE)) { @@ -1054,7 +1054,7 @@ public class LogAdminServlet extends AdminServlet { resp); return; } - params.add(name, value.getClassPath() + "," + desc); + params.put(name, value.getClassPath() + "," + desc); } sendResponse(SUCCESS, null, params, resp); return; @@ -1569,13 +1569,13 @@ public class LogAdminServlet extends AdminServlet { NameValuePairs saveParams = new NameValuePairs(); // implName is always required so always include it it. - saveParams.add("pluginName", implname); + saveParams.put("pluginName", implname); if (oldConfigParms != null) { for (int i = 0; i < oldConfigParms.size(); i++) { String kv = (String) oldConfigParms.elementAt(i); int index = kv.indexOf('='); - saveParams.add(kv.substring(0, index), + saveParams.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2214,16 +2214,16 @@ public class LogAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); // implName is always required so always send it. - params.add(Constants.PR_LOG_IMPL_NAME, ""); + params.put(Constants.PR_LOG_IMPL_NAME, ""); if (configParams != null) { for (int i = 0; i < configParams.size(); i++) { String kv = (String) configParams.elementAt(i); int index = kv.indexOf('='); if (index == -1) { - params.add(kv, ""); + params.put(kv, ""); } else { - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2259,7 +2259,7 @@ public class LogAdminServlet extends AdminServlet { Vector<String> configParams = logInst.getInstanceParams(); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_LOG_IMPL_NAME, + params.put(Constants.PR_LOG_IMPL_NAME, getLogPluginName(logInst)); // implName is always required so always send it. if (configParams != null) { @@ -2267,7 +2267,7 @@ public class LogAdminServlet extends AdminServlet { String kv = (String) configParams.elementAt(i); int index = kv.indexOf('='); - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2282,11 +2282,8 @@ public class LogAdminServlet extends AdminServlet { store.removeSubStore(id); IConfigStore rstore = store.makeSubStore(id); - Enumeration<String> keys = saveParams.getNames(); - - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - String value = saveParams.getValue(key); + for (String key : saveParams.keySet()) { + String value = saveParams.get(key); if (value != null) rstore.put(key, value); @@ -2323,10 +2320,10 @@ public class LogAdminServlet extends AdminServlet { String value = "false"; value = mConfig.getString(Constants.PR_DEBUG_LOG_ENABLE, "false"); - params.add(Constants.PR_DEBUG_LOG_ENABLE, value); + params.put(Constants.PR_DEBUG_LOG_ENABLE, value); value = mConfig.getString(Constants.PR_DEBUG_LOG_LEVEL, "0"); - params.add(Constants.PR_DEBUG_LOG_LEVEL, value); + params.put(Constants.PR_DEBUG_LOG_LEVEL, value); sendResponse(SUCCESS, null, params, resp); } diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/OCSPAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/OCSPAdminServlet.java index 317a50d68..59eead9df 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/OCSPAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/OCSPAdminServlet.java @@ -362,7 +362,7 @@ public class OCSPAdminServlet extends AdminServlet { continue; String value = req.getParameter(name); - params.add(name, value); + params.put(name, value); } store.setConfigParameters(params); commit(true); @@ -432,7 +432,7 @@ public class OCSPAdminServlet extends AdminServlet { if (storeName.equals(defStore)) { storeEnabled = true; } - params.add(storeName, storeName + ";visible;" + ((storeEnabled) ? "enabled" : "disabled")); + params.put(storeName, storeName + ";visible;" + ((storeEnabled) ? "enabled" : "disabled")); } sendResponse(SUCCESS, null, params, resp); } @@ -449,7 +449,7 @@ public class OCSPAdminServlet extends AdminServlet { } private void getSigningAlgConfig(NameValuePairs params) { - params.add(Constants.PR_DEFAULT_ALGORITHM, + params.put(Constants.PR_DEFAULT_ALGORITHM, mOCSP.getDefaultAlgorithm()); String[] algorithms = mOCSP.getOCSPSigningAlgorithms(); StringBuffer algorStr = new StringBuffer(); @@ -461,7 +461,7 @@ public class OCSPAdminServlet extends AdminServlet { algorStr.append(":"); algorStr.append(algorithms[i]); } - params.add(Constants.PR_ALL_ALGORITHMS, algorStr.toString()); + params.put(Constants.PR_ALL_ALGORITHMS, algorStr.toString()); } /** diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java index 4dbde7e06..9eb5c3455 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java @@ -298,11 +298,11 @@ public class PolicyAdminServlet extends AdminServlet { /* make sure policy rules have 'enable' and 'predicate' */ if (ext_info instanceof IPolicyRule) { - if (nvps.getPair(IPolicyRule.PROP_ENABLE) == null) { - nvps.add(IPolicyRule.PROP_ENABLE, "boolean;Enable this policy rule"); + if (nvps.get(IPolicyRule.PROP_ENABLE) == null) { + nvps.put(IPolicyRule.PROP_ENABLE, "boolean;Enable this policy rule"); } - if (nvps.getPair(PROP_PREDICATE) == null) { - nvps.add(PROP_PREDICATE, "string;Rules describing when this policy should run."); + if (nvps.get(PROP_PREDICATE) == null) { + nvps.put(PROP_PREDICATE, "string;Rules describing when this policy should run."); } } } @@ -448,7 +448,7 @@ public class PolicyAdminServlet extends AdminServlet { impl.getClass().getName(); String desc = impl.getDescription(); - nvp.add(id, className + "," + desc); + nvp.put(id, className + "," + desc); } sendResponse(SUCCESS, null, nvp, resp); } @@ -471,7 +471,7 @@ public class PolicyAdminServlet extends AdminServlet { String info = instancesInfo.nextElement(); int i = info.indexOf(";"); - nvp.add(info.substring(0, i), info.substring(i + 1)); + nvp.put(info.substring(0, i), info.substring(i + 1)); } sendResponse(SUCCESS, null, nvp, resp); @@ -594,7 +594,7 @@ public class PolicyAdminServlet extends AdminServlet { String nv = e.nextElement(); int index = nv.indexOf("="); - nvp.add(nv.substring(0, index), nv.substring(index + 1)); + nvp.put(nv.substring(0, index), nv.substring(index + 1)); } sendResponse(SUCCESS, null, nvp, resp); } @@ -829,7 +829,7 @@ public class PolicyAdminServlet extends AdminServlet { value = ""; } - nvp.add(name, value); + nvp.put(name, value); } sendResponse(SUCCESS, null, nvp, resp); 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 8e67c3402..94235f532 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 @@ -387,7 +387,7 @@ public class ProfileAdminServlet extends AdminServlet { String id = (String) impls.nextElement(); IPluginInfo info = mRegistry.getPluginInfo("profile", id); - nvp.add(id, info.getClassName() + "," + + nvp.put(id, info.getClassName() + "," + info.getDescription(getLocale(req))); } sendResponse(SUCCESS, null, nvp, resp); @@ -599,7 +599,7 @@ public class ProfileAdminServlet extends AdminServlet { continue; if (name.equals("RS_ID")) continue; - nvps.add(name, req.getParameter(name)); + nvps.put(name, req.getParameter(name)); } try { @@ -725,7 +725,7 @@ public class ProfileAdminServlet extends AdminServlet { continue; if (name.equals("RS_ID")) continue; - nvps.add(name, req.getParameter(name)); + nvps.put(name, req.getParameter(name)); } try { @@ -1968,9 +1968,9 @@ public class ProfileAdminServlet extends AdminServlet { IDescriptor desc = rule.getConfigDescriptor(getLocale(req), name); if (desc == null) { - nvp.add(name, ";" + ";" + rule.getConfig(name)); + nvp.put(name, ";" + ";" + rule.getConfig(name)); } else { - nvp.add(name, + nvp.put(name, desc.getSyntax() + ";" + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getDescription(getLocale(req)) + ";" + rule.getConfig(name)); @@ -2019,9 +2019,9 @@ public class ProfileAdminServlet extends AdminServlet { IDescriptor desc = rule.getConfigDescriptor(getLocale(req), name); if (desc == null) { - nvp.add(name, ";" + rule.getConfig(name)); + nvp.put(name, ";" + rule.getConfig(name)); } else { - nvp.add(name, + nvp.put(name, desc.getSyntax() + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getDescription(getLocale(req)) + ";" + rule.getConfig(name)); @@ -2064,7 +2064,7 @@ public class ProfileAdminServlet extends AdminServlet { IPolicyDefault def = policy.getDefault(); IPolicyConstraint con = policy.getConstraint(); - nvp.add(setId + ":" + policy.getId(), + nvp.put(setId + ":" + policy.getId(), def.getName(getLocale(req)) + ";" + con.getName(getLocale(req))); } @@ -2094,7 +2094,7 @@ public class ProfileAdminServlet extends AdminServlet { String outputId = (String) outputs.nextElement(); IProfileOutput output = profile.getProfileOutput(outputId); - nvp.add(outputId, output.getName(getLocale(req))); + nvp.put(outputId, output.getName(getLocale(req))); } sendResponse(SUCCESS, null, nvp, resp); @@ -2121,7 +2121,7 @@ public class ProfileAdminServlet extends AdminServlet { String inputId = (String) inputs.nextElement(); IProfileInput input = profile.getProfileInput(inputId); - nvp.add(inputId, input.getName(getLocale(req))); + nvp.put(inputId, input.getName(getLocale(req))); } sendResponse(SUCCESS, null, nvp, resp); @@ -2156,9 +2156,9 @@ public class ProfileAdminServlet extends AdminServlet { IDescriptor desc = profileInput.getConfigDescriptor( getLocale(req), name); if (desc == null) { - nvp.add(name, ";" + ";" + profileInput.getConfig(name)); + nvp.put(name, ";" + ";" + profileInput.getConfig(name)); } else { - nvp.add(name, desc.getSyntax() + ";" + + nvp.put(name, desc.getSyntax() + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getDescription(getLocale(req)) + ";" + profileInput.getConfig(name)); @@ -2197,9 +2197,9 @@ public class ProfileAdminServlet extends AdminServlet { IDescriptor desc = profileOutput.getConfigDescriptor( getLocale(req), name); if (desc == null) { - nvp.add(name, ";" + ";" + profileOutput.getConfig(name)); + nvp.put(name, ";" + ";" + profileOutput.getConfig(name)); } else { - nvp.add(name, desc.getSyntax() + ";" + + nvp.put(name, desc.getSyntax() + ";" + getNonNull(desc.getConstraint()) + ";" + desc.getDescription(getLocale(req)) + ";" + profileOutput.getConfig(name)); @@ -2228,7 +2228,7 @@ public class ProfileAdminServlet extends AdminServlet { } // mInstanceId + ";visible;" + enabled - nvp.add(profileId, profileId + ";visible;" + status); + nvp.put(profileId, profileId + ";visible;" + status); } sendResponse(SUCCESS, null, nvp, resp); } @@ -2250,21 +2250,21 @@ public class ProfileAdminServlet extends AdminServlet { NameValuePairs nvp = new NameValuePairs(); - nvp.add("name", profile.getName(getLocale(req))); - nvp.add("desc", profile.getDescription(getLocale(req))); - nvp.add("visible", Boolean.toString(profile.isVisible())); - nvp.add("enable", Boolean.toString( + nvp.put("name", profile.getName(getLocale(req))); + nvp.put("desc", profile.getDescription(getLocale(req))); + nvp.put("visible", Boolean.toString(profile.isVisible())); + nvp.put("enable", Boolean.toString( mProfileSub.isProfileEnable(id))); String authid = profile.getAuthenticatorId(); if (authid == null) { - nvp.add("auth", ""); + nvp.put("auth", ""); } else { - nvp.add("auth", authid); + nvp.put("auth", authid); } CMS.debug("ProfileAdminServlet: authid=" + authid); - nvp.add("plugin", mProfileSub.getProfileClassId(id)); + nvp.put("plugin", mProfileSub.getProfileClassId(id)); 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 799e1bb37..3774d6e6f 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 @@ -468,7 +468,7 @@ public class PublisherAdminServlet extends AdminServlet { if (name.equals(Constants.PR_CERT_NAMES)) { ICryptoSubsystem jss = (ICryptoSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_CRYPTO); - params.add(name, jss.getAllCerts()); + params.put(name, jss.getAllCerts()); } else { String value = ldap.getString(name, ""); @@ -481,22 +481,22 @@ public class PublisherAdminServlet extends AdminServlet { value = ILdapAuthInfo.PROP_BINDDN_DEFAULT; } } - params.add(name, value); + params.put(name, value); } } - params.add(Constants.PR_PUBLISHING_ENABLE, + params.put(Constants.PR_PUBLISHING_ENABLE, publishcfg.getString(IPublisherProcessor.PROP_ENABLE, Constants.FALSE)); - params.add(Constants.PR_PUBLISHING_QUEUE_ENABLE, + params.put(Constants.PR_PUBLISHING_QUEUE_ENABLE, publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_ENABLE, Constants.TRUE)); - params.add(Constants.PR_PUBLISHING_QUEUE_THREADS, + params.put(Constants.PR_PUBLISHING_QUEUE_THREADS, publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_THREADS, "3")); - params.add(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, + params.put(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_PAGE_SIZE, "40")); - params.add(Constants.PR_PUBLISHING_QUEUE_PRIORITY, + params.put(Constants.PR_PUBLISHING_QUEUE_PRIORITY, publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_PRIORITY, "0")); - params.add(Constants.PR_PUBLISHING_QUEUE_STATUS, + params.put(Constants.PR_PUBLISHING_QUEUE_STATUS, publishcfg.getString(Constants.PR_PUBLISHING_QUEUE_STATUS, "200")); - params.add(Constants.PR_ENABLE, + params.put(Constants.PR_ENABLE, ldapcfg.getString(IPublisherProcessor.PROP_ENABLE, Constants.FALSE)); sendResponse(SUCCESS, null, params, resp); } @@ -694,7 +694,7 @@ public class PublisherAdminServlet extends AdminServlet { // test before commit if (publishcfg.getBoolean(IPublisherProcessor.PROP_ENABLE) && ldapcfg.getBoolean(IPublisherProcessor.PROP_ENABLE)) { - params.add("title", + params.put("title", "You've attempted to configure CMS to connect" + " to a LDAP directory. The connection status is" + " as follows:\n \n"); @@ -725,16 +725,16 @@ public class PublisherAdminServlet extends AdminServlet { conn = new LDAPConnection(CMS.getLdapJssSSLSocketFactory( certNickName)); CMS.debug("Publishing Test certNickName=" + certNickName); - params.add(Constants.PR_CONN_INITED, + params.put(Constants.PR_CONN_INITED, "Create ssl LDAPConnection with certificate: " + certNickName + dashes(70 - 44 - certNickName.length()) + " Success"); } catch (Exception ex) { - params.add(Constants.PR_CONN_INIT_FAIL, + params.put(Constants.PR_CONN_INIT_FAIL, "Create ssl LDAPConnection with certificate: " + certNickName + dashes(70 - 44 - certNickName.length()) + " failure\n" + " exception: " + ex); - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then LDAP publishing will fail.\n" + "Do you want to save the configuration anyway?"); sendResponse(SUCCESS, null, params, resp); @@ -742,13 +742,13 @@ public class PublisherAdminServlet extends AdminServlet { } try { conn.connect(host, port); - params.add(Constants.PR_CONN_OK, + params.put(Constants.PR_CONN_OK, "Connect to directory server " + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Success"); - params.add(Constants.PR_AUTH_OK, + params.put(Constants.PR_AUTH_OK, "Authentication: SSL client authentication" + dashes(70 - 41) + " Success" + "\nBind to the directory as: " + certNickName + @@ -757,20 +757,20 @@ public class PublisherAdminServlet extends AdminServlet { if (ex.getLDAPResultCode() == LDAPException.UNAVAILABLE) { // need to intercept this because message from LDAP is // "DSA is unavailable" which confuses with DSA PKI. - params.add(Constants.PR_CONN_FAIL, + params.put(Constants.PR_CONN_FAIL, "Connect to directory server " + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Failure\n" + " error: server unavailable"); } else { - params.add(Constants.PR_CONN_FAIL, + params.put(Constants.PR_CONN_FAIL, "Connect to directory server " + host + " at port " + port + dashes(70 - 37 - host.length() - (Integer.valueOf(port)).toString().length()) + " Failure"); } - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then " + "LDAP publishing will fail.\n" + "Do you want to save the configuration anyway?"); @@ -782,21 +782,21 @@ public class PublisherAdminServlet extends AdminServlet { if (secure) { conn = new LDAPConnection( CMS.getLdapJssSSLSocketFactory()); - params.add(Constants.PR_CONN_INITED, + params.put(Constants.PR_CONN_INITED, "Create ssl LDAPConnection" + dashes(70 - 25) + " Success"); } else { conn = new LDAPConnection(); - params.add(Constants.PR_CONN_INITED, + params.put(Constants.PR_CONN_INITED, "Create LDAPConnection" + dashes(70 - 21) + " Success"); } } catch (Exception ex) { - params.add(Constants.PR_CONN_INIT_FAIL, + params.put(Constants.PR_CONN_INIT_FAIL, "Create LDAPConnection" + dashes(70 - 21) + " Failure\n" + "exception: " + ex); - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then " + "LDAP publishing will fail.\n" + "Do you want to save the configuration anyway?"); @@ -805,7 +805,7 @@ public class PublisherAdminServlet extends AdminServlet { } try { conn.connect(host, port); - params.add(Constants.PR_CONN_OK, + params.put(Constants.PR_CONN_OK, "Connect to directory server " + host + " at port " + port + @@ -815,7 +815,7 @@ public class PublisherAdminServlet extends AdminServlet { if (ex.getLDAPResultCode() == LDAPException.UNAVAILABLE) { // need to intercept this because message from LDAP is // "DSA is unavailable" which confuses with DSA PKI. - params.add(Constants.PR_CONN_FAIL, + params.put(Constants.PR_CONN_FAIL, "Connect to directory server " + host + " at port " + port + @@ -823,7 +823,7 @@ public class PublisherAdminServlet extends AdminServlet { + " Failure" + "\nerror: server unavailable"); } else { - params.add(Constants.PR_CONN_FAIL, + params.put(Constants.PR_CONN_FAIL, "Connect to directory server " + host + " at port " + port + @@ -831,7 +831,7 @@ public class PublisherAdminServlet extends AdminServlet { + " Failure" + "\nexception: " + ex); } - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then " + "LDAP publishing will fail.\n" + "Do you want to save the configuration anyway?"); @@ -843,14 +843,14 @@ public class PublisherAdminServlet extends AdminServlet { bindAs = ldap.getSubStore( ILdapBoundConnFactory.PROP_LDAPAUTHINFO).getString(ILdapAuthInfo.PROP_BINDDN); conn.authenticate(version, bindAs, pwd); - params.add(Constants.PR_AUTH_OK, + params.put(Constants.PR_AUTH_OK, "Authentication: Basic authentication" + dashes(70 - 36) + " Success" + "\nBind to the directory as: " + bindAs + dashes(70 - 26 - bindAs.length()) + " Success"); } catch (LDAPException ex) { if (ex.getLDAPResultCode() == LDAPException.NO_SUCH_OBJECT) { - params.add(Constants.PR_AUTH_FAIL, + params.put(Constants.PR_AUTH_FAIL, "Authentication: Basic authentication" + dashes(70 - 36) + "Failure" + "\nBind to the directory as: " + bindAs + @@ -859,7 +859,7 @@ public class PublisherAdminServlet extends AdminServlet { "Please correct the value assigned in the" + " \"Directory manager DN\" field."); } else if (ex.getLDAPResultCode() == LDAPException.INVALID_CREDENTIALS) { - params.add(Constants.PR_AUTH_FAIL, + params.put(Constants.PR_AUTH_FAIL, "Authentication: Basic authentication" + dashes(70 - 36) + " Failure" + "\nBind to the directory as: " + bindAs + @@ -868,14 +868,14 @@ public class PublisherAdminServlet extends AdminServlet { "Please correct the value assigned in the" + " \"Password\" field."); } else { - params.add(Constants.PR_AUTH_FAIL, + params.put(Constants.PR_AUTH_FAIL, "Authentication: Basic authentication" + dashes(70 - 36) + " Failure" + "\nBind to the directory as: " + bindAs + dashes(70 - 26 - bindAs.length()) + " Failure"); } - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then " + "LDAP publishing will fail.\n" + "Do you want to save the configuration anyway?"); @@ -942,23 +942,23 @@ public class PublisherAdminServlet extends AdminServlet { try { mProcessor.publishCACert(ca.getCACert()); CMS.debug("PublisherAdminServlet: " + CMS.getLogMessage("ADMIN_SRVLT_PUB_CA_CERT")); - params.add("publishCA", + params.put("publishCA", "CA certificate is published."); } catch (Exception ex) { // exception not thrown - not seen as a fatal error. log(ILogger.LL_FAILURE, CMS.getLogMessage("ADMIN_SRVLT_NO_PUB_CA_CERT", ex.toString())); - params.add("publishCA", + params.put("publishCA", "Failed to publish CA certificate."); int index = ex.toString().indexOf("Failed to create CA"); if (index > -1) { - params.add("createError", + params.put("createError", ex.toString().substring(index)); } mProcessor.shutdown(); // Do you want to enable LDAP publishing anyway - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then " + "the CA certificate won't be published.\n" + "Do you want to enable LDAP publishing anyway?"); @@ -971,17 +971,17 @@ public class PublisherAdminServlet extends AdminServlet { CMS.debug("PublisherAdminServlet: about to update CRL"); ca.publishCRLNow(); CMS.debug(CMS.getLogMessage("ADMIN_SRVLT_PUB_CRL")); - params.add("publishCRL", + params.put("publishCRL", "CRL is published."); } catch (Exception ex) { // exception not thrown - not seen as a fatal error. log(ILogger.LL_FAILURE, "Could not publish crl " + ex.toString()); - params.add("publishCRL", + params.put("publishCRL", "Failed to publish CRL."); mProcessor.shutdown(); // Do you want to enable LDAP publishing anyway - params.add(Constants.PR_SAVE_NOT, + params.put(Constants.PR_SAVE_NOT, "\n \nIf the problem is not fixed then " + "the CRL won't be published.\n" + "Do you want to enable LDAP publishing anyway?"); @@ -990,14 +990,14 @@ public class PublisherAdminServlet extends AdminServlet { } } commit(true); - params.add(Constants.PR_SAVE_OK, + params.put(Constants.PR_SAVE_OK, "\n \nConfiguration changes are now committed."); - params.add("restarted", "Publishing is restarted."); + params.put("restarted", "Publishing is restarted."); } else { commit(true); - params.add(Constants.PR_SAVE_OK, + params.put(Constants.PR_SAVE_OK, "\n \nConfiguration changes are now committed."); - params.add("stopped", + params.put("stopped", "Publishing is stopped."); } @@ -1236,7 +1236,7 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_MAPPER_IMPL_NAME, implname); + params.put(Constants.PR_MAPPER_IMPL_NAME, implname); sendResponse(SUCCESS, null, params, resp); return; } @@ -1265,7 +1265,7 @@ public class PublisherAdminServlet extends AdminServlet { resp); return; } - params.add(name, value.getClassPath() + "," + desc); + params.put(name, value.getClassPath() + "," + desc); } sendResponse(SUCCESS, null, params, resp); return; @@ -1292,7 +1292,7 @@ public class PublisherAdminServlet extends AdminServlet { String name = e.nextElement(); ILdapMapper value = mProcessor.getMapperInstance(name); - params.add(name, getMapperPluginName(value) + ";visible"); + params.put(name, getMapperPluginName(value) + ";visible"); } sendResponse(SUCCESS, null, params, resp); return; @@ -1427,13 +1427,13 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); // implName is always required so always send it. - params.add(Constants.PR_MAPPER_IMPL_NAME, ""); + params.put(Constants.PR_MAPPER_IMPL_NAME, ""); if (configParams != null) { for (int i = 0; i < configParams.size(); i++) { String kv = configParams.elementAt(i); int index = kv.indexOf('='); - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -1468,7 +1468,7 @@ public class PublisherAdminServlet extends AdminServlet { Vector<String> configParams = mapperInst.getInstanceParams(); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_MAPPER_IMPL_NAME, + params.put(Constants.PR_MAPPER_IMPL_NAME, getMapperPluginName(mapperInst)); // implName is always required so always send it. if (configParams != null) { @@ -1476,7 +1476,7 @@ public class PublisherAdminServlet extends AdminServlet { String kv = configParams.elementAt(i); int index = kv.indexOf('='); - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -1534,13 +1534,13 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs saveParams = new NameValuePairs(); // implName is always required so always include it it. - saveParams.add("pluginName", implname); + saveParams.put("pluginName", implname); if (oldConfigParms != null) { for (int i = 0; i < oldConfigParms.size(); i++) { String kv = oldConfigParms.elementAt(i); int index = kv.indexOf('='); - saveParams.add(kv.substring(0, index), + saveParams.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -1875,7 +1875,7 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_RULE_IMPL_NAME, implname); + params.put(Constants.PR_RULE_IMPL_NAME, implname); sendResponse(SUCCESS, null, params, resp); return; } @@ -1901,7 +1901,7 @@ public class PublisherAdminServlet extends AdminServlet { desc = lp.getDescription(); } catch (Exception exp) { } - params.add(name, value.getClassPath() + "," + desc); + params.put(name, value.getClassPath() + "," + desc); } sendResponse(SUCCESS, null, params, resp); return; @@ -1919,7 +1919,7 @@ public class PublisherAdminServlet extends AdminServlet { mProcessor.getRuleInsts().get((Object) name); String enabled = value.enabled() ? "enabled" : "disabled"; - params.add(name, value.getInstanceName() + ";visible;" + enabled); + params.put(name, value.getInstanceName() + ";visible;" + enabled); } sendResponse(SUCCESS, null, params, resp); return; @@ -2062,13 +2062,13 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); // implName is always required so always send it. - params.add(Constants.PR_RULE_IMPL_NAME, ""); + params.put(Constants.PR_RULE_IMPL_NAME, ""); if (configParams != null) { for (int i = 0; i < configParams.size(); i++) { String kv = (String) configParams.elementAt(i); int index = kv.indexOf('='); - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2102,7 +2102,7 @@ public class PublisherAdminServlet extends AdminServlet { Vector<String> configParams = ruleInst.getInstanceParams(); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_RULE_IMPL_NAME, + params.put(Constants.PR_RULE_IMPL_NAME, getRulePluginName(ruleInst)); // implName is always required so always send it. if (configParams != null) { @@ -2110,7 +2110,7 @@ public class PublisherAdminServlet extends AdminServlet { String kv = (String) configParams.elementAt(i); int index = kv.indexOf('='); - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2167,13 +2167,13 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs saveParams = new NameValuePairs(); // implName is always required so always include it it. - saveParams.add("pluginName", implname); + saveParams.put("pluginName", implname); if (oldConfigParms != null) { for (int i = 0; i < oldConfigParms.size(); i++) { String kv = oldConfigParms.elementAt(i); int index = kv.indexOf('='); - saveParams.add(kv.substring(0, index), + saveParams.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2523,7 +2523,7 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_PUBLISHER_IMPL_NAME, implname); + params.put(Constants.PR_PUBLISHER_IMPL_NAME, implname); sendResponse(SUCCESS, null, params, resp); return; } @@ -2550,7 +2550,7 @@ public class PublisherAdminServlet extends AdminServlet { desc = lp.getDescription(); } catch (Exception exp) { } - params.add(name, value.getClassPath() + "," + desc); + params.put(name, value.getClassPath() + "," + desc); } sendResponse(SUCCESS, null, params, resp); return; @@ -2579,7 +2579,7 @@ public class PublisherAdminServlet extends AdminServlet { if (value == null) continue; - params.add(name, getPublisherPluginName(value) + ";visible"); + params.put(name, getPublisherPluginName(value) + ";visible"); } sendResponse(SUCCESS, null, params, resp); return; @@ -2725,16 +2725,16 @@ public class PublisherAdminServlet extends AdminServlet { NameValuePairs params = new NameValuePairs(); // implName is always required so always send it. - params.add(Constants.PR_PUBLISHER_IMPL_NAME, ""); + params.put(Constants.PR_PUBLISHER_IMPL_NAME, ""); if (configParams != null) { for (int i = 0; i < configParams.size(); i++) { String kv = (String) configParams.elementAt(i); int index = kv.indexOf('='); if (index == -1) { - params.add(kv, ""); + params.put(kv, ""); } else { - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2771,7 +2771,7 @@ public class PublisherAdminServlet extends AdminServlet { Vector<String> configParams = publisherInst.getInstanceParams(); NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_PUBLISHER_IMPL_NAME, + params.put(Constants.PR_PUBLISHER_IMPL_NAME, getPublisherPluginName(publisherInst)); // implName is always required so always send it. if (configParams != null) { @@ -2779,7 +2779,7 @@ public class PublisherAdminServlet extends AdminServlet { String kv = (String) configParams.elementAt(i); int index = kv.indexOf('='); - params.add(kv.substring(0, index), + params.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2848,7 +2848,7 @@ public class PublisherAdminServlet extends AdminServlet { String pubType = ""; // implName is always required so always include it it. - saveParams.add("pluginName", implname); + saveParams.put("pluginName", implname); if (oldConfigParms != null) { for (int i = 0; i < oldConfigParms.size(); i++) { String kv = (String) oldConfigParms.elementAt(i); @@ -2860,7 +2860,7 @@ public class PublisherAdminServlet extends AdminServlet { pubType = "crl"; } - saveParams.add(kv.substring(0, index), + saveParams.put(kv.substring(0, index), kv.substring(index + 1)); } } @@ -2876,11 +2876,11 @@ public class PublisherAdminServlet extends AdminServlet { // get objects added and deleted if (pubType.equals("cacert")) { - saveParams.add("caObjectClassAdded", instancesConfig.getString(id + ".caObjectClassAdded", "")); - saveParams.add("caObjectClassDeleted", instancesConfig.getString(id + ".caObjectClassDeleted", "")); + saveParams.put("caObjectClassAdded", instancesConfig.getString(id + ".caObjectClassAdded", "")); + saveParams.put("caObjectClassDeleted", instancesConfig.getString(id + ".caObjectClassDeleted", "")); } else if (pubType.equals("crl")) { - saveParams.add("crlObjectClassAdded", instancesConfig.getString(id + ".crlObjectClassAdded", "")); - saveParams.add("crlObjectClassDeleted", instancesConfig.getString(id + ".crlObjectClassDeleted", "")); + saveParams.put("crlObjectClassAdded", instancesConfig.getString(id + ".crlObjectClassAdded", "")); + saveParams.put("crlObjectClassDeleted", instancesConfig.getString(id + ".crlObjectClassDeleted", "")); } // create new substore. @@ -3054,9 +3054,9 @@ public class PublisherAdminServlet extends AdminServlet { } catch (Exception e) { } - oldOC = saveParams.getValue(objName); - oldAdded = saveParams.getValue(objName + "Added"); - oldDeleted = saveParams.getValue(objName + "Deleted"); + oldOC = saveParams.get(objName); + oldAdded = saveParams.get(objName + "Added"); + oldDeleted = saveParams.get(objName + "Deleted"); if ((oldOC == null) || (newOC == null)) return; @@ -3106,11 +3106,8 @@ public class PublisherAdminServlet extends AdminServlet { store.removeSubStore(id); IConfigStore rstore = store.makeSubStore(id); - Enumeration<String> keys = saveParams.getNames(); - - while (keys.hasMoreElements()) { - String key = keys.nextElement(); - String value = saveParams.getValue(key); + for (String key : saveParams.keySet()) { + String value = saveParams.get(key); if (value != null) rstore.put(key, value); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/RAAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/RAAdminServlet.java index 1adde0891..5bdb14177 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/RAAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/RAAdminServlet.java @@ -199,10 +199,10 @@ public class RAAdminServlet extends AdminServlet { continue; if (name.equals(Constants.PR_ENABLE)) continue; - params.add(name, rc.getString(name, "")); + params.put(name, rc.getString(name, "")); } - params.add(Constants.PR_ENABLE, + params.put(Constants.PR_ENABLE, rc.getString(PROP_ENABLED, Constants.FALSE)); //System.out.println("Send: "+params.toString()); sendResponse(SUCCESS, null, params, resp); @@ -265,10 +265,10 @@ public class RAAdminServlet extends AdminServlet { continue; if (name.equals(Constants.PR_ENABLE)) continue; - params.add(name, riq.getString(name, "")); + params.put(name, riq.getString(name, "")); } - params.add(Constants.PR_ENABLE, + params.put(Constants.PR_ENABLE, riq.getString(PROP_ENABLED, Constants.FALSE)); //System.out.println("Send: "+params.toString()); sendResponse(SUCCESS, null, params, resp); @@ -423,7 +423,7 @@ public class RAAdminServlet extends AdminServlet { if (name.equals(Constants.OP_TYPE)) continue; - params.add(name, caConnectorConfig.getString(name, "")); + params.put(name, caConnectorConfig.getString(name, "")); } } sendResponse(SUCCESS, null, params, resp); 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 0175d9aa4..aa5494f0d 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 @@ -251,7 +251,7 @@ public class RegistryAdminServlet extends AdminServlet { String id = impls.nextElement(); IPluginInfo info = mRegistry.getPluginInfo(scope, id); - nvp.add(id, info.getClassName() + "," + + nvp.put(id, info.getClassName() + "," + info.getDescription(getLocale(req)) + "," + info.getName(getLocale(req))); } @@ -289,7 +289,7 @@ public class RegistryAdminServlet extends AdminServlet { if (policyConstraintClass.isApplicable(policyDefaultClass)) { CMS.debug("RegistryAdminServlet: getSUpportedConstraint isApplicable " + constraintInfo.getClassName()); - nvp.add(constraintID, + nvp.put(constraintID, constraintInfo.getClassName() + "," + constraintInfo.getDescription(getLocale(req)) + "," @@ -352,7 +352,7 @@ public class RegistryAdminServlet extends AdminServlet { + getNonNull(desc.getDefaultValue()); CMS.debug("RegistryAdminServlet: getProfileImpl " + value); - nvp.add(name, value); + nvp.put(name, value); } catch (Exception e) { CMS.debug("RegistryAdminServlet: getProfileImpl skipped descriptor for " + name); diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/UsrGrpAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/UsrGrpAdminServlet.java index 3783ead6f..e5a6dd3c4 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/admin/UsrGrpAdminServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/admin/UsrGrpAdminServlet.java @@ -327,7 +327,7 @@ public class UsrGrpAdminServlet extends AdminServlet { val = "noType"; NameValuePairs params = new NameValuePairs(); - params.add(Constants.PR_USER_TYPE, val); + params.put(Constants.PR_USER_TYPE, val); sendResponse(SUCCESS, null, params, resp); } @@ -372,7 +372,7 @@ public class UsrGrpAdminServlet extends AdminServlet { } i++; } - params.add("userInfo", sb.toString()); + params.put("userInfo", sb.toString()); sendResponse(SUCCESS, null, params, resp); } @@ -416,10 +416,10 @@ public class UsrGrpAdminServlet extends AdminServlet { } if (user != null) { - params.add(Constants.PR_USER_FULLNAME, user.getFullName()); - params.add(Constants.PR_USER_EMAIL, user.getEmail()); - params.add(Constants.PR_USER_PHONE, user.getPhone()); - params.add(Constants.PR_USER_STATE, user.getState()); + params.put(Constants.PR_USER_FULLNAME, user.getFullName()); + params.put(Constants.PR_USER_EMAIL, user.getEmail()); + params.put(Constants.PR_USER_PHONE, user.getPhone()); + params.put(Constants.PR_USER_STATE, user.getState()); // get list of groups, and get a list of those that this // uid belongs to @@ -447,7 +447,7 @@ public class UsrGrpAdminServlet extends AdminServlet { } } - params.add(Constants.PR_USER_GROUP, grpString.toString()); + params.put(Constants.PR_USER_GROUP, grpString.toString()); sendResponse(SUCCESS, null, params, resp); return; @@ -516,7 +516,7 @@ public class UsrGrpAdminServlet extends AdminServlet { String base64 = CMS.getEncodedCert(certs[i]); // pretty print certs - params.add(getCertificateString(certs[i]), + params.put(getCertificateString(certs[i]), print.toString(clientLocale) + "\n" + base64); } sendResponse(SUCCESS, null, params, resp); @@ -567,9 +567,9 @@ public class UsrGrpAdminServlet extends AdminServlet { String desc = group.getDescription(); if (desc != null) { - params.add(group.getGroupID(), desc); + params.put(group.getGroupID(), desc); } else { - params.add(group.getGroupID(), ""); + params.put(group.getGroupID(), ""); } } @@ -612,8 +612,8 @@ public class UsrGrpAdminServlet extends AdminServlet { if (e.hasMoreElements()) { IGroup group = e.nextElement(); - params.add(Constants.PR_GROUP_GROUP, group.getGroupID()); - params.add(Constants.PR_GROUP_DESC, + params.put(Constants.PR_GROUP_GROUP, group.getGroupID()); + params.put(Constants.PR_GROUP_DESC, group.getDescription()); Enumeration<String> members = group.getMemberNames(); @@ -631,7 +631,7 @@ public class UsrGrpAdminServlet extends AdminServlet { } } - params.add(Constants.PR_GROUP_USER, membersString.toString()); + params.put(Constants.PR_GROUP_USER, membersString.toString()); sendResponse(SUCCESS, null, params, resp); return; 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 ac44672d2..42768060c 100644 --- a/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java @@ -90,7 +90,6 @@ import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.ISubsystem; import com.netscape.certsrv.common.Constants; -import com.netscape.certsrv.common.NameValuePair; import com.netscape.certsrv.common.NameValuePairs; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.security.ICryptoSubsystem; @@ -1043,11 +1042,11 @@ public final class JssSubsystem implements ICryptoSubsystem { X509CertImpl impl = new X509CertImpl(b); NameValuePairs results = new NameValuePairs(); - results.add(Constants.PR_CERT_SUBJECT_NAME, impl.getSubjectDN().getName()); - results.add(Constants.PR_ISSUER_NAME, impl.getIssuerDN().getName()); - results.add(Constants.PR_SERIAL_NUMBER, impl.getSerialNumber().toString()); - results.add(Constants.PR_BEFORE_VALIDDATE, impl.getNotBefore().toString()); - results.add(Constants.PR_AFTER_VALIDDATE, impl.getNotAfter().toString()); + results.put(Constants.PR_CERT_SUBJECT_NAME, impl.getSubjectDN().getName()); + results.put(Constants.PR_ISSUER_NAME, impl.getIssuerDN().getName()); + results.put(Constants.PR_SERIAL_NUMBER, impl.getSerialNumber().toString()); + results.put(Constants.PR_BEFORE_VALIDDATE, impl.getNotBefore().toString()); + results.put(Constants.PR_AFTER_VALIDDATE, impl.getNotAfter().toString()); // fingerprint is using MD5 hash @@ -1202,7 +1201,7 @@ public final class JssSubsystem implements ICryptoSubsystem { } String serialno = impl.getSerialNumber().toString(); String issuer = impl.getIssuerDN().toString(); - nvps.add(nickname + "," + serialno, issuer); + nvps.put(nickname + "," + serialno, issuer); Debug.trace("getRootCerts: nickname=" + nickname + ", serialno=" + serialno + ", issuer=" + issuer); continue; @@ -1265,7 +1264,7 @@ public final class JssSubsystem implements ICryptoSubsystem { } String serialno = impl.getSerialNumber().toString(); String issuer = impl.getIssuerDN().toString(); - nvps.add(nickname + "," + serialno, issuer); + nvps.put(nickname + "," + serialno, issuer); Debug.trace("getUserCerts: nickname=" + nickname + ", serialno=" + serialno + ", issuer=" + issuer); } catch (ObjectNotFoundException e) { @@ -1329,18 +1328,16 @@ public final class JssSubsystem implements ICryptoSubsystem { } Date date = impl.getNotAfter(); String dateStr = mFormatter.format(date); - NameValuePair pair = pairs.getPair(nickname); + String vvalue = pairs.get(nickname); /* always user cert here*/ String certValue = dateStr + "," + "u"; - if (pair == null) - pairs.add(nickname, certValue); + if (vvalue == null) + pairs.put(nickname, certValue); else { - String vvalue = pair.getValue(); - if (vvalue.endsWith(",u")) { - pair.setValue(vvalue + ";" + certValue); + pairs.put(nickname, vvalue + ";" + certValue); } } @@ -1441,15 +1438,13 @@ public final class JssSubsystem implements ICryptoSubsystem { impl = new X509CertImpl(icert.getEncoded()); Date date = impl.getNotAfter(); String dateStr = mFormatter.format(date); - NameValuePair pair = pairs.getPair(nickname); + String vvalue = pairs.get(nickname); String certValue = dateStr + "," + trust; - if (pair == null) - pairs.add(nickname, certValue); + if (vvalue == null) + pairs.put(nickname, certValue); else { - String vvalue = pair.getValue(); - - pair.setValue(vvalue + ";" + certValue); + pairs.put(nickname, vvalue + ";" + certValue); } } catch (CertificateException e) { log(ILogger.LL_FAILURE, |