lens git commit: LENS-840 : LDAP config loader should be more forgiving for attribute absense
Repository: lens Updated Branches: refs/heads/master 114dab346 -> b3b7e5f4d LENS-840 : LDAP config loader should be more forgiving for attribute absense Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/b3b7e5f4 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/b3b7e5f4 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/b3b7e5f4 Branch: refs/heads/master Commit: b3b7e5f4d087be5377e0f043e00b57dfb6e4e124 Parents: 114dab3 Author: Rajat Khandelwal Authored: Mon Nov 30 11:37:14 2015 +0530 Committer: Amareshwari Sriramadasu Committed: Mon Nov 30 11:37:14 2015 +0530 -- .../lens/server/user/LDAPBackedDatabaseUserConfigLoader.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/b3b7e5f4/lens-server/src/main/java/org/apache/lens/server/user/LDAPBackedDatabaseUserConfigLoader.java -- diff --git a/lens-server/src/main/java/org/apache/lens/server/user/LDAPBackedDatabaseUserConfigLoader.java b/lens-server/src/main/java/org/apache/lens/server/user/LDAPBackedDatabaseUserConfigLoader.java index 82b76c9..a647282 100644 --- a/lens-server/src/main/java/org/apache/lens/server/user/LDAPBackedDatabaseUserConfigLoader.java +++ b/lens-server/src/main/java/org/apache/lens/server/user/LDAPBackedDatabaseUserConfigLoader.java @@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit; import javax.naming.Context; import javax.naming.NamingEnumeration; import javax.naming.NamingException; +import javax.naming.directory.Attribute; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; import javax.naming.ldap.InitialLdapContext; @@ -155,7 +156,8 @@ public class LDAPBackedDatabaseUserConfigLoader extends DatabaseUserConfigLoader String[] attributes = new String[ldapFields.length]; SearchResult sr = findAccountByAccountName(user); for (int i = 0; i < attributes.length; i++) { - attributes[i] = sr.getAttributes().get(ldapFields[i]).get().toString(); + Attribute attr = sr.getAttributes().get(ldapFields[i]); + attributes[i] = (attr == null ? null : attr.get().toString()); } return attributes; }
[29/50] [abbrv] lens git commit: LENS-840 : LDAP config loader should be more forgiving for attribute absense
LENS-840 : LDAP config loader should be more forgiving for attribute absense Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/b3b7e5f4 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/b3b7e5f4 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/b3b7e5f4 Branch: refs/heads/LENS-581 Commit: b3b7e5f4d087be5377e0f043e00b57dfb6e4e124 Parents: 114dab3 Author: Rajat Khandelwal Authored: Mon Nov 30 11:37:14 2015 +0530 Committer: Amareshwari Sriramadasu Committed: Mon Nov 30 11:37:14 2015 +0530 -- .../lens/server/user/LDAPBackedDatabaseUserConfigLoader.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/lens/blob/b3b7e5f4/lens-server/src/main/java/org/apache/lens/server/user/LDAPBackedDatabaseUserConfigLoader.java -- diff --git a/lens-server/src/main/java/org/apache/lens/server/user/LDAPBackedDatabaseUserConfigLoader.java b/lens-server/src/main/java/org/apache/lens/server/user/LDAPBackedDatabaseUserConfigLoader.java index 82b76c9..a647282 100644 --- a/lens-server/src/main/java/org/apache/lens/server/user/LDAPBackedDatabaseUserConfigLoader.java +++ b/lens-server/src/main/java/org/apache/lens/server/user/LDAPBackedDatabaseUserConfigLoader.java @@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit; import javax.naming.Context; import javax.naming.NamingEnumeration; import javax.naming.NamingException; +import javax.naming.directory.Attribute; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; import javax.naming.ldap.InitialLdapContext; @@ -155,7 +156,8 @@ public class LDAPBackedDatabaseUserConfigLoader extends DatabaseUserConfigLoader String[] attributes = new String[ldapFields.length]; SearchResult sr = findAccountByAccountName(user); for (int i = 0; i < attributes.length; i++) { - attributes[i] = sr.getAttributes().get(ldapFields[i]).get().toString(); + Attribute attr = sr.getAttributes().get(ldapFields[i]); + attributes[i] = (attr == null ? null : attr.get().toString()); } return attributes; }