From 74807e00d0318ca7d7a52de38ca1b10b8424ef53 Mon Sep 17 00:00:00 2001
From: Josef Ludvicek <jludvice@redhat.com>
Date: Fri, 17 Jul 2015 11:28:10 +0200
Subject: [PATCH] [KARAF-3860] improve logging in ldap login module to show
 stacktrace with root cause

---
 .../java/org/apache/karaf/jaas/modules/ldap/LDAPLoginModule.java  | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPLoginModule.java b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPLoginModule.java
index 23b6648..607d02c 100644
--- a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPLoginModule.java
+++ b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPLoginModule.java
@@ -23,7 +23,6 @@ import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.CommunicationException;
 import javax.naming.Context;
 import javax.naming.NamingEnumeration;
 import javax.naming.directory.*;
@@ -297,13 +296,6 @@ public class LDAPLoginModule extends AbstractKarafLoginModule {
             }
             userDN = userDnAndNamespace[0];
             userDNNamespace = userDnAndNamespace[1];
-        } catch (CommunicationException ce) {
-            // explicitly catch CommunicationException as it my wrap a lower level root cause.
-            String rootCause = null;
-            if (ce.getRootCause() != null)
-                rootCause = ce.getRootCause().getMessage();
-            logger.warn("Can't connect to the LDAP server: {}", ce.getMessage(), rootCause);
-            throw new LoginException("Can't connect to the LDAP server: " + ce.getMessage());
         } catch (Exception e) {
             logger.warn("Can't connect to the LDAP server: {}", e.getMessage(), e);
             throw new LoginException("Can't connect to the LDAP server: " + e.getMessage());
-- 
1.8.3.1

