Author: kwright
Date: Mon Aug 15 21:25:15 2016
New Revision: 1756432

URL: http://svn.apache.org/viewvc?rev=1756432&view=rev
Log:
Pull up fix for CONNECTORS-1335 from trunk

Modified:
    manifoldcf/branches/release-2.5-branch/   (props changed)
    manifoldcf/branches/release-2.5-branch/CHANGES.txt
    
manifoldcf/branches/release-2.5-branch/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
    
manifoldcf/branches/release-2.5-branch/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java

Propchange: manifoldcf/branches/release-2.5-branch/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug 15 21:25:15 2016
@@ -137,3 +137,4 @@
 /manifoldcf/branches/CONNECTORS-981:1605049-1605773
 /manifoldcf/branches/CONNECTORS-989:1611600-1612101
 /manifoldcf/branches/CONNECTORS-990:1610284-1610707
+/manifoldcf/trunk:1756431

Modified: manifoldcf/branches/release-2.5-branch/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/release-2.5-branch/CHANGES.txt?rev=1756432&r1=1756431&r2=1756432&view=diff
==============================================================================
--- manifoldcf/branches/release-2.5-branch/CHANGES.txt (original)
+++ manifoldcf/branches/release-2.5-branch/CHANGES.txt Mon Aug 15 21:25:15 2016
@@ -3,6 +3,9 @@ $Id$
 
 ======================= Release 2.5 =====================
 
+CONNECTORS-1335: Log message cleanup.
+(Furkan KAMACI)
+
 CONNECTORS-1316: Upgrade to Tika 1.13.
 (Furkan KAMACI)
 

Modified: 
manifoldcf/branches/release-2.5-branch/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/release-2.5-branch/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java?rev=1756432&r1=1756431&r2=1756432&view=diff
==============================================================================
--- 
manifoldcf/branches/release-2.5-branch/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
 (original)
+++ 
manifoldcf/branches/release-2.5-branch/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
 Mon Aug 15 21:25:15 2016
@@ -955,11 +955,11 @@ public class ActiveDirectoryAuthority ex
     /**
      * Stringifies LDAP Context environment variable
      * @param env LDAP Context environment variable
-     * @return Stringified LDAP Context environment. Password is masked if 
exists.
+     * @return Stringified LDAP Context environment. Password is masked if set.
      */
     private String printLdapContextEnvironment(Hashtable env) {
       Hashtable copyEnv = new Hashtable<>(env);
-      if (copyEnv.contains(Context.SECURITY_CREDENTIALS)){
+      if (copyEnv.containsKey(Context.SECURITY_CREDENTIALS)){
         copyEnv.put(Context.SECURITY_CREDENTIALS, "********");
       }
       return Arrays.toString(copyEnv.entrySet().toArray());

Modified: 
manifoldcf/branches/release-2.5-branch/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/release-2.5-branch/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java?rev=1756432&r1=1756431&r2=1756432&view=diff
==============================================================================
--- 
manifoldcf/branches/release-2.5-branch/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
 (original)
+++ 
manifoldcf/branches/release-2.5-branch/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
 Mon Aug 15 21:25:15 2016
@@ -210,7 +210,7 @@ public class LDAPAuthority extends org.a
           env.put(Context.SECURITY_CREDENTIALS, bindPass);
         }
 
-        Logging.authorityConnectors.info("LDAP Context environment properties: 
" + Arrays.toString(env.entrySet().toArray()));
+        Logging.authorityConnectors.info("LDAP Context environment properties: 
" + printLdapContextEnvironment(env));
         session = new InitialLdapContext(env, null);
         
         if (isLDAPTLS(ldapProtocol)) {
@@ -226,7 +226,8 @@ public class LDAPAuthority extends org.a
         }
         session.reconnect(null);
       }
-      sessionExpirationTime = System.currentTimeMillis() + 300000L;      
return session;
+      sessionExpirationTime = System.currentTimeMillis() + 300000L;
+      return session;
     } catch (AuthenticationException e) {
       session = null;
       sessionExpirationTime = -1L;
@@ -240,8 +241,8 @@ public class LDAPAuthority extends org.a
     } catch (NamingException e) {
       session = null;
       sessionExpirationTime = -1L;
-      Logging.authorityConnectors.error("Naming error: " + e.getMessage(), e);
-      throw new ManifoldCFException("Naming error: " + e.getMessage(), e);
+      Logging.authorityConnectors.error("Naming exception: " + e.getMessage(), 
e);
+      throw new ManifoldCFException("Naming exception: " + e.getMessage(), e);
     } catch (InterruptedIOException e) {
       session = null;
       sessionExpirationTime = -1L;
@@ -503,11 +504,11 @@ public class LDAPAuthority extends org.a
 
     } catch (NameNotFoundException e) {
       // This means that the user doesn't exist
-      Logging.authorityConnectors.error("User does not exists: 
"+e.getMessage(), e);
+      Logging.authorityConnectors.error("User does not exists: "+ 
e.getMessage(), e);
       return RESPONSE_USERNOTFOUND;
     } catch (NamingException e) {
       // Unreachable
-      Logging.authorityConnectors.error("Response Unreachable: 
"+e.getMessage(), e);
+      Logging.authorityConnectors.error("Response Unreachable: "+ 
e.getMessage(), e);
       return RESPONSE_UNREACHABLE;
     }
   }
@@ -525,6 +526,19 @@ public class LDAPAuthority extends org.a
     return RESPONSE_UNREACHABLE;
   }
 
+  /**
+   * Stringifies LDAP Context environment variable
+   * @param env LDAP Context environment variable
+   * @return Stringified LDAP Context environment. Password is masked if set.
+   */
+  private String printLdapContextEnvironment(Hashtable env) {
+    Hashtable copyEnv = new Hashtable<>(env);
+    if (copyEnv.containsKey(Context.SECURITY_CREDENTIALS)){
+      copyEnv.put(Context.SECURITY_CREDENTIALS, "********");
+    }
+    return Arrays.toString(copyEnv.entrySet().toArray());
+  }
+
   // UI support methods.
   //
   // These support methods are involved in setting up authority connection 
configuration information. The configuration methods cannot assume that the
@@ -825,7 +839,7 @@ public class LDAPAuthority extends org.a
       }
     } catch (ManifoldCFException e) {
       message = e.getMessage();
-      
org.apache.manifoldcf.authorities.system.Logging.authorityConnectors.warn(e);
+      Logging.authorityConnectors.warn(e);
     }
 
     if(sslCertificatesMap != null)


Reply via email to