summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2016-04-06 20:15:21 +0200
committerEndi S. Dewata <edewata@redhat.com>2016-04-06 20:15:21 +0200
commit2df750de798fb8ea6f6e72079fa6c44f40b8ad35 (patch)
tree1ee2761646e09040daea44b14ce8bcdc7ecb8c8a
parent3d045118027b9f1a2c4b9e6416258e1a7a133376 (diff)
downloadpki-branch-10.2.7.zip
pki-branch-10.2.7.tar.gz
pki-branch-10.2.7.tar.xz
Fixed error handling in ConfigurationUtils.updateDomainXML().branch-10.2.7
https://fedorahosted.org/pki/ticket/1695
-rw-r--r--base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java22
-rw-r--r--base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java4
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 0ca8c02..69682d5 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 697196a..bde50b3 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);
}
}