1
0
mirror of synced 2026-08-04 09:17:02 +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
@@ -49,7 +49,7 @@ public class SecuredAnnotationSecurityMetadataSource extends
public SecuredAnnotationSecurityMetadataSource(
AnnotationMetadataExtractor annotationMetadataExtractor) {
Assert.notNull(annotationMetadataExtractor);
Assert.notNull(annotationMetadataExtractor, "annotationMetadataExtractor cannot be null");
annotationExtractor = annotationMetadataExtractor;
annotationType = (Class<? extends Annotation>) GenericTypeResolver
.resolveTypeArgument(annotationExtractor.getClass(),
@@ -41,7 +41,7 @@ public class RememberMeAuthenticationProvider implements AuthenticationProvider,
private String key;
public RememberMeAuthenticationProvider(String key) {
Assert.hasLength(key);
Assert.hasLength(key, "key must have a length");
this.key = key;
}
@@ -45,7 +45,7 @@ public class InteractiveAuthenticationSuccessEvent extends AbstractAuthenticatio
public InteractiveAuthenticationSuccessEvent(Authentication authentication,
Class<?> generatedBy) {
super(authentication);
Assert.notNull(generatedBy);
Assert.notNull(generatedBy, "generatedBy cannot be null");
this.generatedBy = generatedBy;
}
@@ -76,7 +76,7 @@ public class InMemoryUserDetailsManager implements UserDetailsManager {
}
public void createUser(UserDetails user) {
Assert.isTrue(!userExists(user.getUsername()));
Assert.isTrue(!userExists(user.getUsername()), "user should not exist");
users.put(user.getUsername().toLowerCase(), new MutableUser(user));
}
@@ -86,7 +86,7 @@ public class InMemoryUserDetailsManager implements UserDetailsManager {
}
public void updateUser(UserDetails user) {
Assert.isTrue(userExists(user.getUsername()));
Assert.isTrue(userExists(user.getUsername()), "user should exist");
users.put(user.getUsername().toLowerCase(), new MutableUser(user));
}
@@ -258,15 +258,15 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa
}
public List<String> findUsersInGroup(String groupName) {
Assert.hasText(groupName);
Assert.hasText(groupName, "groupName should have text");
return getJdbcTemplate().queryForList(findUsersInGroupSql,
new String[] { groupName }, String.class);
}
public void createGroup(final String groupName,
final List<GrantedAuthority> authorities) {
Assert.hasText(groupName);
Assert.notNull(authorities);
Assert.hasText(groupName, "groupName should have text");
Assert.notNull(authorities, "authorities cannot be null");
logger.debug("Creating new group '" + groupName + "' with authorities "
+ AuthorityUtils.authorityListToSet(authorities));
@@ -289,7 +289,7 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa
public void deleteGroup(String groupName) {
logger.debug("Deleting group '" + groupName + "'");
Assert.hasText(groupName);
Assert.hasText(groupName, "groupName should have text");
final int id = findGroupId(groupName);
PreparedStatementSetter groupIdPSS = new PreparedStatementSetter() {
@@ -304,16 +304,16 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa
public void renameGroup(String oldName, String newName) {
logger.debug("Changing group name from '" + oldName + "' to '" + newName + "'");
Assert.hasText(oldName);
Assert.hasText(newName);
Assert.hasText(oldName,"oldName should have text");;
Assert.hasText(newName,"newName should have text");;
getJdbcTemplate().update(renameGroupSql, newName, oldName);
}
public void addUserToGroup(final String username, final String groupName) {
logger.debug("Adding user '" + username + "' to group '" + groupName + "'");
Assert.hasText(username);
Assert.hasText(groupName);
Assert.hasText(username,"username should have text");;
Assert.hasText(groupName,"groupName should have text");;
final int id = findGroupId(groupName);
getJdbcTemplate().update(insertGroupMemberSql, new PreparedStatementSetter() {
@@ -328,8 +328,8 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa
public void removeUserFromGroup(final String username, final String groupName) {
logger.debug("Removing user '" + username + "' to group '" + groupName + "'");
Assert.hasText(username);
Assert.hasText(groupName);
Assert.hasText(username,"username should have text");;
Assert.hasText(groupName,"groupName should have text");;
final int id = findGroupId(groupName);
@@ -345,7 +345,7 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa
public List<GrantedAuthority> findGroupAuthorities(String groupName) {
logger.debug("Loading authorities for group '" + groupName + "'");
Assert.hasText(groupName);
Assert.hasText(groupName,"groupName should have text");;
return getJdbcTemplate().query(groupAuthoritiesSql, new String[] { groupName },
new RowMapper<GrantedAuthority>() {
@@ -361,8 +361,8 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa
public void removeGroupAuthority(String groupName, final GrantedAuthority authority) {
logger.debug("Removing authority '" + authority + "' from group '" + groupName
+ "'");
Assert.hasText(groupName);
Assert.notNull(authority);
Assert.hasText(groupName,"groupName should have text");
Assert.notNull(authority, "authority cannot be null");
final int id = findGroupId(groupName);
@@ -377,8 +377,8 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa
public void addGroupAuthority(final String groupName, final GrantedAuthority authority) {
logger.debug("Adding authority '" + authority + "' to group '" + groupName + "'");
Assert.hasText(groupName);
Assert.notNull(authority);
Assert.hasText(groupName,"groupName should have text");;
Assert.notNull(authority, "authority cannot be null");
final int id = findGroupId(groupName);
getJdbcTemplate().update(insertGroupAuthoritySql, new PreparedStatementSetter() {
@@ -398,102 +398,102 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa
}
public void setCreateUserSql(String createUserSql) {
Assert.hasText(createUserSql);
Assert.hasText(createUserSql,"createUserSql should have text");;
this.createUserSql = createUserSql;
}
public void setDeleteUserSql(String deleteUserSql) {
Assert.hasText(deleteUserSql);
Assert.hasText(deleteUserSql,"deleteUserSql should have text");;
this.deleteUserSql = deleteUserSql;
}
public void setUpdateUserSql(String updateUserSql) {
Assert.hasText(updateUserSql);
Assert.hasText(updateUserSql,"updateUserSql should have text");;
this.updateUserSql = updateUserSql;
}
public void setCreateAuthoritySql(String createAuthoritySql) {
Assert.hasText(createAuthoritySql);
Assert.hasText(createAuthoritySql,"createAuthoritySql should have text");;
this.createAuthoritySql = createAuthoritySql;
}
public void setDeleteUserAuthoritiesSql(String deleteUserAuthoritiesSql) {
Assert.hasText(deleteUserAuthoritiesSql);
Assert.hasText(deleteUserAuthoritiesSql,"deleteUserAuthoritiesSql should have text");;
this.deleteUserAuthoritiesSql = deleteUserAuthoritiesSql;
}
public void setUserExistsSql(String userExistsSql) {
Assert.hasText(userExistsSql);
Assert.hasText(userExistsSql,"userExistsSql should have text");;
this.userExistsSql = userExistsSql;
}
public void setChangePasswordSql(String changePasswordSql) {
Assert.hasText(changePasswordSql);
Assert.hasText(changePasswordSql,"changePasswordSql should have text");;
this.changePasswordSql = changePasswordSql;
}
public void setFindAllGroupsSql(String findAllGroupsSql) {
Assert.hasText(findAllGroupsSql);
Assert.hasText(findAllGroupsSql,"findAllGroupsSql should have text");;
this.findAllGroupsSql = findAllGroupsSql;
}
public void setFindUsersInGroupSql(String findUsersInGroupSql) {
Assert.hasText(findUsersInGroupSql);
Assert.hasText(findUsersInGroupSql,"findUsersInGroupSql should have text");;
this.findUsersInGroupSql = findUsersInGroupSql;
}
public void setInsertGroupSql(String insertGroupSql) {
Assert.hasText(insertGroupSql);
Assert.hasText(insertGroupSql,"insertGroupSql should have text");;
this.insertGroupSql = insertGroupSql;
}
public void setFindGroupIdSql(String findGroupIdSql) {
Assert.hasText(findGroupIdSql);
Assert.hasText(findGroupIdSql,"findGroupIdSql should have text");;
this.findGroupIdSql = findGroupIdSql;
}
public void setInsertGroupAuthoritySql(String insertGroupAuthoritySql) {
Assert.hasText(insertGroupAuthoritySql);
Assert.hasText(insertGroupAuthoritySql,"insertGroupAuthoritySql should have text");;
this.insertGroupAuthoritySql = insertGroupAuthoritySql;
}
public void setDeleteGroupSql(String deleteGroupSql) {
Assert.hasText(deleteGroupSql);
Assert.hasText(deleteGroupSql,"deleteGroupSql should have text");;
this.deleteGroupSql = deleteGroupSql;
}
public void setDeleteGroupAuthoritiesSql(String deleteGroupAuthoritiesSql) {
Assert.hasText(deleteGroupAuthoritiesSql);
Assert.hasText(deleteGroupAuthoritiesSql,"deleteGroupAuthoritiesSql should have text");;
this.deleteGroupAuthoritiesSql = deleteGroupAuthoritiesSql;
}
public void setDeleteGroupMembersSql(String deleteGroupMembersSql) {
Assert.hasText(deleteGroupMembersSql);
Assert.hasText(deleteGroupMembersSql,"deleteGroupMembersSql should have text");;
this.deleteGroupMembersSql = deleteGroupMembersSql;
}
public void setRenameGroupSql(String renameGroupSql) {
Assert.hasText(renameGroupSql);
Assert.hasText(renameGroupSql,"renameGroupSql should have text");;
this.renameGroupSql = renameGroupSql;
}
public void setInsertGroupMemberSql(String insertGroupMemberSql) {
Assert.hasText(insertGroupMemberSql);
Assert.hasText(insertGroupMemberSql,"insertGroupMemberSql should have text");;
this.insertGroupMemberSql = insertGroupMemberSql;
}
public void setDeleteGroupMemberSql(String deleteGroupMemberSql) {
Assert.hasText(deleteGroupMemberSql);
Assert.hasText(deleteGroupMemberSql,"deleteGroupMemberSql should have text");;
this.deleteGroupMemberSql = deleteGroupMemberSql;
}
public void setGroupAuthoritiesSql(String groupAuthoritiesSql) {
Assert.hasText(groupAuthoritiesSql);
Assert.hasText(groupAuthoritiesSql,"groupAuthoritiesSql should have text");;
this.groupAuthoritiesSql = groupAuthoritiesSql;
}
public void setDeleteGroupAuthoritySql(String deleteGroupAuthoritySql) {
Assert.hasText(deleteGroupAuthoritySql);
Assert.hasText(deleteGroupAuthoritySql,"deleteGroupAuthoritySql should have text");;
this.deleteGroupAuthoritySql = deleteGroupAuthoritySql;
}
@@ -52,7 +52,7 @@ public class InMemoryResource extends AbstractResource {
}
public InMemoryResource(byte[] source, String description) {
Assert.notNull(source);
Assert.notNull(source, "source cannot be null");
this.source = source;
this.description = description;
}