Blame SOURCES/pki-core-fix-exception-when-talking-to-Dogtag-9-systems.patch

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