// LDAP not active
Hudson hudson = Hudson.getInstance();
if (!(hudson.getSecurityRealm() instanceof CrowdSecurityRealm))
return null;
try {
CrowdUserDetails details = (CrowdUserDetails) hudson.getSecurityRealm()
.getSecurityComponents().userDetails.loadUserByUsername(u.getId());
String mail = details.getEmail();
if (mail == null)
return null; // not found
return mail;
} catch (UsernameNotFoundException e) {
LOGGER.log(Level.FINE, "Failed to look up LDAP for e-mail address", e);