1
0
mirror of synced 2026-08-04 17:27:13 +00:00

Use message in all Assert

This ensures compatibility with Spring 5.

Fixes gh-4193
This commit is contained in:
Rob Winch
2017-01-30 19:58:24 -06:00
parent 4c79107e01
commit 9c03571bbb
25 changed files with 67 additions and 67 deletions
@@ -157,7 +157,7 @@ public final class LdapUtils {
* @return the root DN
*/
public static String parseRootDnFromUrl(String url) {
Assert.hasLength(url);
Assert.hasLength(url, "url must have length");
String urlRootDn;
@@ -187,7 +187,7 @@ public final class LdapUtils {
*/
private static URI parseLdapUrl(String url) {
Assert.hasLength(url);
Assert.hasLength(url, "url must have length");
try {
return new URI(url);
@@ -119,7 +119,7 @@ public abstract class AbstractLdapAuthenticator implements LdapAuthenticator,
}
public void setMessageSource(MessageSource messageSource) {
Assert.notNull("Message source must not be null");
Assert.notNull(messageSource, "Message source must not be null");
this.messages = new MessageSourceAccessor(messageSource);
}
@@ -159,7 +159,7 @@ public class ApacheDSContainer implements InitializingBean, DisposableBean, Life
}
public void setWorkingDirectory(File workingDir) {
Assert.notNull(workingDir);
Assert.notNull(workingDir, "workingDir cannot be null");
logger.info("Setting working directory for LDAP_PROVIDER: "
+ workingDir.getAbsolutePath());
@@ -239,7 +239,7 @@ public class ApacheDSContainer implements InitializingBean, DisposableBean, Life
catch (LdapNameNotFoundException e) {
try {
LdapDN dn = new LdapDN(root);
Assert.isTrue(root.startsWith("dc="));
Assert.isTrue(root.startsWith("dc="), "root must start with dc=");
String dc = root.substring(3, root.indexOf(','));
ServerEntry entry = service.newEntry(dn);
entry.add("objectClass", "top", "domain", "extensibleObject");
@@ -387,7 +387,7 @@ public class LdapUserDetailsManager implements UserDetailsManager {
}
public void setAttributesToRetrieve(String[] attributesToRetrieve) {
Assert.notNull(attributesToRetrieve);
Assert.notNull(attributesToRetrieve, "attributesToRetrieve cannot be null");
this.attributesToRetrieve = attributesToRetrieve;
}
@@ -406,7 +406,7 @@ public class LdapUserDetailsManager implements UserDetailsManager {
* members.
*/
public void setGroupMemberAttributeName(String groupMemberAttributeName) {
Assert.hasText(groupMemberAttributeName);
Assert.hasText(groupMemberAttributeName, "groupMemberAttributeName should have text");
this.groupMemberAttributeName = groupMemberAttributeName;
this.groupSearchFilter = "(" + groupMemberAttributeName + "={0})";
}
@@ -139,8 +139,8 @@ public class Person extends LdapUserDetailsImpl {
public LdapUserDetails createUserDetails() {
Person p = (Person) super.createUserDetails();
Assert.notNull(p.cn);
Assert.notEmpty(p.cn);
Assert.notNull(p.cn, "person.sn cannot be null");
Assert.notEmpty(p.cn, "person.cn cannot be empty");
// TODO: Check contents for null entries
return p;
}