commit b65d6a8095b864c912e2e0884e9b50f58353805b Author: Ade Lee Date: Thu Jul 16 16:48:51 2015 -0400 Fix exception when talking to dogtag 9 systems When getting a token from the security domain for a Dogtag 9 system, we first attempt to reach the REST interfaces. When this fails (with 404 exception), we catch the exception and try the old interfaces. The exception being thrown has been changed from the deprecated ClientResponseFailure to being wrapped in a PKIException, so the code catching the exception needs to be modified accordingly. Ticket 1495 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 5566e91..c8ab38c 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 @@ -89,7 +89,6 @@ import netscape.security.x509.X509CertImpl; import netscape.security.x509.X509Key; import org.apache.velocity.context.Context; -import org.jboss.resteasy.client.ClientResponseFailure; import org.mozilla.jss.CryptoManager; import org.mozilla.jss.CryptoManager.NicknameConflictException; import org.mozilla.jss.CryptoManager.NotInitializedException; @@ -152,6 +151,7 @@ import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.EPropertyNotFound; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.ISubsystem; +import com.netscape.certsrv.base.PKIException; import com.netscape.certsrv.base.ResourceNotFoundException; import com.netscape.certsrv.ca.ICertificateAuthority; import com.netscape.certsrv.client.ClientConfig; @@ -372,17 +372,14 @@ public class ConfigurationUtils { InstallToken token = sdClient.getInstallToken(sdhost, csType); accountClient.logout(); return token.getToken(); - - } catch (ClientResponseFailure e) { - - if (e.getResponse().getResponseStatus() == Response.Status.NOT_FOUND) { + } catch (PKIException e) { + if (e.getCode() == Response.Status.NOT_FOUND.getStatusCode()) { // try the old servlet CMS.debug("Getting old cookie"); String tokenString = getOldCookie(sdhost, sdport, user, passwd); CMS.debug("Token: " + tokenString); return tokenString; } - throw e; } }