return to SQLException catch and testing for Nullpointers manually

This commit is contained in:
Oliver Goldschmidt
2021-03-25 10:55:54 +01:00
parent ede3f11073
commit e4349db70c

View File

@@ -141,6 +141,14 @@ public class LDAPAuthentication
// Prevents anonymous users from being added to this group, and the second check // Prevents anonymous users from being added to this group, and the second check
// ensures they are LDAP users // ensures they are LDAP users
try { try {
// without a logged in user, this method should return an empty list
if (context.getCurrentUser() == null) {
return Collections.EMPTY_LIST;
}
// if the logged in user does not have a netid, it's not an LDAP user and this method should return an empty list
if (context.getCurrentUser().getNetid() == null) {
return Collections.EMPTY_LIST;
}
if (!context.getCurrentUser().getNetid().equals("")) { if (!context.getCurrentUser().getNetid().equals("")) {
String groupName = configurationService.getProperty("authentication-ldap.login.specialgroup"); String groupName = configurationService.getProperty("authentication-ldap.login.specialgroup");
if ((groupName != null) && (!groupName.trim().equals(""))) { if ((groupName != null) && (!groupName.trim().equals(""))) {
@@ -156,7 +164,7 @@ public class LDAPAuthentication
} }
} }
} }
} catch (Exception ex) { } catch (SQLException ex) {
// The user is not an LDAP user, so we don't need to worry about them // The user is not an LDAP user, so we don't need to worry about them
} }
return Collections.EMPTY_LIST; return Collections.EMPTY_LIST;