diff options
Diffstat (limited to 'base/common')
3 files changed, 49 insertions, 19 deletions
diff --git a/base/common/src/com/netscape/certsrv/system/ConfigurationResponse.java b/base/common/src/com/netscape/certsrv/system/ConfigurationResponse.java index 489970c9c..6d3275a51 100644 --- a/base/common/src/com/netscape/certsrv/system/ConfigurationResponse.java +++ b/base/common/src/com/netscape/certsrv/system/ConfigurationResponse.java @@ -20,8 +20,6 @@ package com.netscape.certsrv.system; import java.security.cert.CertificateEncodingException; import java.util.ArrayList; import java.util.Collection; -import java.util.Enumeration; -import java.util.Vector; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -32,7 +30,6 @@ import javax.xml.bind.annotation.XmlRootElement; import netscape.security.x509.X509CertImpl; import com.netscape.certsrv.apps.CMS; -import com.netscape.cms.servlet.csadmin.Cert; /** * @author alee @@ -56,20 +53,6 @@ public class ConfigurationResponse { adminCert = new SystemCertData(); } - public void setSystemCerts(Vector<Cert> certs) { - systemCerts.clear(); - Enumeration<Cert> e = certs.elements(); - while (e.hasMoreElements()) { - Cert cert = e.nextElement(); - SystemCertData cdata = new SystemCertData(); - cdata.setCert(cert.getCert()); - cdata.setRequest(cert.getRequest()); - cdata.setTag(cert.getCertTag()); - cdata.setCertChain(cert.getCertChain()); - systemCerts.add(cdata); - } - } - /** * @return the systemCerts */ diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/SystemCertDataFactory.java b/base/common/src/com/netscape/cms/servlet/csadmin/SystemCertDataFactory.java new file mode 100644 index 000000000..bd23c8f16 --- /dev/null +++ b/base/common/src/com/netscape/cms/servlet/csadmin/SystemCertDataFactory.java @@ -0,0 +1,47 @@ +// --- 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) 2012 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +package com.netscape.cms.servlet.csadmin; + +import java.util.ArrayList; +import java.util.Collection; + +import com.netscape.certsrv.system.SystemCertData; + +/** + * @author edewata + */ +public class SystemCertDataFactory { + + public static SystemCertData create(Cert cert) { + SystemCertData data = new SystemCertData(); + data.setCert(cert.getCert()); + data.setRequest(cert.getRequest()); + data.setTag(cert.getCertTag()); + data.setCertChain(cert.getCertChain()); + return data; + } + + public static Collection<SystemCertData> create(Collection<Cert> certs) { + Collection<SystemCertData> result = new ArrayList<SystemCertData>(); + for (Cert cert : certs) { + result.add(create(cert)); + } + return result; + } +} diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java b/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java index c7560fbc4..53b004846 100644 --- a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java +++ b/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java @@ -545,7 +545,7 @@ public class SystemConfigService extends PKIService implements SystemConfigResou // submitting to external ca if ((data.getIssuingCA()!= null) && data.getIssuingCA().equals("External CA") && (!hasSigningCert)) { - response.setSystemCerts(certs); + response.setSystemCerts(SystemCertDataFactory.create(certs)); return response; } @@ -564,7 +564,7 @@ public class SystemConfigService extends PKIService implements SystemConfigResou throw new PKIException("Error in confguring system certificates"); } } - response.setSystemCerts(certs); + response.setSystemCerts(SystemCertDataFactory.create(certs)); // BackupKeyCertPanel/SavePKCS12Panel if (data.getBackupKeys().equals("true")) { |