diff options
author | Endi S. Dewata <edewata@redhat.com> | 2016-04-06 20:15:21 +0200 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2016-04-06 20:15:21 +0200 |
commit | 2df750de798fb8ea6f6e72079fa6c44f40b8ad35 (patch) | |
tree | 1ee2761646e09040daea44b14ce8bcdc7ecb8c8a /base/server/cms | |
parent | 3d045118027b9f1a2c4b9e6416258e1a7a133376 (diff) | |
download | pki-2df750de798fb8ea6f6e72079fa6c44f40b8ad35.tar.gz pki-2df750de798fb8ea6f6e72079fa6c44f40b8ad35.tar.xz pki-2df750de798fb8ea6f6e72079fa6c44f40b8ad35.zip |
Fixed error handling in ConfigurationUtils.updateDomainXML().branch-10.2.7
https://fedorahosted.org/pki/ticket/1695
Diffstat (limited to 'base/server/cms')
-rw-r--r-- | base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java | 22 | ||||
-rw-r--r-- | base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java | 4 |
2 files changed, 17 insertions, 9 deletions
diff --git a/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java b/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java index 0ca8c0222..69682d51e 100644 --- a/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java +++ b/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java @@ -31,7 +31,6 @@ import java.math.BigInteger; import java.net.URI; import java.net.URISyntaxException; import java.net.URLEncoder; -import java.security.DigestException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.KeyPair; @@ -57,6 +56,7 @@ import java.util.Vector; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.NotFoundException; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; @@ -3816,15 +3816,19 @@ public class ConfigurationUtils { content.putSingle("httpport", CMS.getEENonSSLPort()); try { + // Use new interface String session_id = CMS.getConfigSDSessionId(); content.putSingle("sessionID", session_id); updateDomainXML(sd_host, sd_admin_port, true, url, content, false); - } catch (Exception e) { - CMS.debug("updateSecurityDomain: failed to update security domain using admin port " - + sd_admin_port + ": " + e); - CMS.debug("updateSecurityDomain: now trying agent port with client auth"); + } catch (NotFoundException e) { + CMS.debug("updateSecurityDomain: admin interface not found: " + + "https://" + sd_host + ":" + sd_admin_port + url); + + // Use legacy interface url = "/ca/agent/ca/updateDomainXML"; + CMS.debug("updateSecurityDomain: now trying agent interface: " + + "https://" + sd_host + ":" + sd_admin_port + url); updateDomainXML(sd_host, sd_agent_port, true, url, content, true); } @@ -3896,13 +3900,17 @@ public class ConfigurationUtils { if (status.equals(SUCCESS)) { return; + + } else if (status.equals(AUTH_FAILURE)) { + throw new PKIException("Unable to update security domain info: authentication failure"); + } else { String error = obj.getValue("Error"); - throw new IOException(error); + throw new PKIException("Unable to update security domain info: " + error); } } else { - throw new IOException("Failed to get response when updating security domain"); + throw new PKIException("Unable to update security domain info: no response"); } } diff --git a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java index 697196a6e..bde50b3f1 100644 --- a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java +++ b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java @@ -282,8 +282,8 @@ public class SystemConfigService extends PKIService implements SystemConfigResou cs.putString("securitydomain.store", "ldap"); cs.commit(false); } catch (Exception e) { - e.printStackTrace(); - throw new PKIException("Error while updating security domain: " + e); + CMS.debug(e); + throw new PKIException("Error while updating security domain: " + e, e); } } |