From a01257b8a1ace8e8b13e6a3b25aebb0348610409 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Tue, 17 Jul 2012 07:44:41 -0400
Subject: [PATCH] Fixed LdapUserService if account has null email address (issue 110)

---
 docs/04_releases.mkd                 |   10 ++++++++++
 src/com/gitblit/LdapUserService.java |   10 ++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd
index 80fc029..1c74c0c 100644
--- a/docs/04_releases.mkd
+++ b/docs/04_releases.mkd
@@ -11,6 +11,16 @@
 
 #### fixes
 
+- Fixed null pointer in LdapUserSerivce if account has a null email address (issue 110)
+
+#### changes
+
+- Updated Polish translation
+
+**1.0.0** *released 2012-07-14*
+
+#### fixes
+
 - Fixed bug in Lucene search where old/stale blobs were never properly deleted during incremental updates.  This resulted in duplicate blob entries in the index.
 - Fixed intermittent bug in identifying line numbers in Lucene search (issue 105)
 - Adjust repository identification algorithm to handle the scenario where a repository name collides with a group/folder name (e.g. foo.git and foo/bar.git) (issue 104)
diff --git a/src/com/gitblit/LdapUserService.java b/src/com/gitblit/LdapUserService.java
index bba943d..61de01d 100644
--- a/src/com/gitblit/LdapUserService.java
+++ b/src/com/gitblit/LdapUserService.java
@@ -220,7 +220,10 @@
 
 				user.displayName = displayName;
 			} else {
-				user.displayName = userEntry.getAttribute(displayName).getValue();
+				Attribute attribute = userEntry.getAttribute(displayName);
+				if (attribute != null && attribute.hasValue()) {
+					user.displayName = attribute.getValue();
+				}
 			}
 		}
 		
@@ -233,7 +236,10 @@
 
 				user.emailAddress = email;
 			} else {
-				user.emailAddress = userEntry.getAttribute(email).getValue();
+				Attribute attribute = userEntry.getAttribute(email);
+				if (attribute != null && attribute.hasValue()) {
+					user.emailAddress = attribute.getValue();
+				}
 			}
 		}
 	}

--
Gitblit v1.9.1