Apply Checkstyle EmptyStatementCheck module

This commit adds Checkstyle `EmptyStatementCheck` module and aligns code with it.
This commit is contained in:
Johnny Lim 2017-11-17 03:37:00 +09:00 committed by Rob Winch
parent be397b8b33
commit 5f518d00e5
9 changed files with 37 additions and 37 deletions

View File

@ -82,7 +82,7 @@ public class AclEntryAfterInvocationCollectionFilteringProviderTests {
assertThat(provider.decide(mock(Authentication.class), new Object(), assertThat(provider.decide(mock(Authentication.class), new Object(),
SecurityConfig.createList("AFTER_ACL_COLLECTION_READ"), null)) SecurityConfig.createList("AFTER_ACL_COLLECTION_READ"), null))
.isNull();; .isNull();
verify(service, never()).readAclById(any(ObjectIdentity.class), any(List.class)); verify(service, never()).readAclById(any(ObjectIdentity.class), any(List.class));
} }

View File

@ -138,7 +138,7 @@ public class AclEntryAfterInvocationProviderTests {
assertThat(provider.decide(mock(Authentication.class), new Object(), assertThat(provider.decide(mock(Authentication.class), new Object(),
SecurityConfig.createList("AFTER_ACL_COLLECTION_READ"), null)) SecurityConfig.createList("AFTER_ACL_COLLECTION_READ"), null))
.isNull();; .isNull();
verify(service, never()).readAclById(any(ObjectIdentity.class), any(List.class)); verify(service, never()).readAclById(any(ObjectIdentity.class), any(List.class));
} }
} }

View File

@ -304,16 +304,16 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa
public void renameGroup(String oldName, String newName) { public void renameGroup(String oldName, String newName) {
logger.debug("Changing group name from '" + oldName + "' to '" + newName + "'"); logger.debug("Changing group name from '" + oldName + "' to '" + newName + "'");
Assert.hasText(oldName, "oldName should have text");; Assert.hasText(oldName, "oldName should have text");
Assert.hasText(newName, "newName should have text");; Assert.hasText(newName, "newName should have text");
getJdbcTemplate().update(renameGroupSql, newName, oldName); getJdbcTemplate().update(renameGroupSql, newName, oldName);
} }
public void addUserToGroup(final String username, final String groupName) { public void addUserToGroup(final String username, final String groupName) {
logger.debug("Adding user '" + username + "' to group '" + groupName + "'"); logger.debug("Adding user '" + username + "' to group '" + groupName + "'");
Assert.hasText(username, "username should have text");; Assert.hasText(username, "username should have text");
Assert.hasText(groupName, "groupName should have text");; Assert.hasText(groupName, "groupName should have text");
final int id = findGroupId(groupName); final int id = findGroupId(groupName);
getJdbcTemplate().update(insertGroupMemberSql, new PreparedStatementSetter() { 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) { public void removeUserFromGroup(final String username, final String groupName) {
logger.debug("Removing user '" + username + "' to group '" + groupName + "'"); logger.debug("Removing user '" + username + "' to group '" + groupName + "'");
Assert.hasText(username, "username should have text");; Assert.hasText(username, "username should have text");
Assert.hasText(groupName, "groupName should have text");; Assert.hasText(groupName, "groupName should have text");
final int id = findGroupId(groupName); final int id = findGroupId(groupName);
@ -345,7 +345,7 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa
public List<GrantedAuthority> findGroupAuthorities(String groupName) { public List<GrantedAuthority> findGroupAuthorities(String groupName) {
logger.debug("Loading authorities for group '" + groupName + "'"); logger.debug("Loading authorities for group '" + groupName + "'");
Assert.hasText(groupName, "groupName should have text");; Assert.hasText(groupName, "groupName should have text");
return getJdbcTemplate().query(groupAuthoritiesSql, new String[] { groupName }, return getJdbcTemplate().query(groupAuthoritiesSql, new String[] { groupName },
new RowMapper<GrantedAuthority>() { new RowMapper<GrantedAuthority>() {
@ -377,7 +377,7 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa
public void addGroupAuthority(final String groupName, final GrantedAuthority authority) { public void addGroupAuthority(final String groupName, final GrantedAuthority authority) {
logger.debug("Adding authority '" + authority + "' to group '" + groupName + "'"); logger.debug("Adding authority '" + authority + "' to group '" + groupName + "'");
Assert.hasText(groupName, "groupName should have text");; Assert.hasText(groupName, "groupName should have text");
Assert.notNull(authority, "authority cannot be null"); Assert.notNull(authority, "authority cannot be null");
final int id = findGroupId(groupName); final int id = findGroupId(groupName);
@ -398,102 +398,102 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa
} }
public void setCreateUserSql(String createUserSql) { public void setCreateUserSql(String createUserSql) {
Assert.hasText(createUserSql, "createUserSql should have text");; Assert.hasText(createUserSql, "createUserSql should have text");
this.createUserSql = createUserSql; this.createUserSql = createUserSql;
} }
public void setDeleteUserSql(String deleteUserSql) { public void setDeleteUserSql(String deleteUserSql) {
Assert.hasText(deleteUserSql, "deleteUserSql should have text");; Assert.hasText(deleteUserSql, "deleteUserSql should have text");
this.deleteUserSql = deleteUserSql; this.deleteUserSql = deleteUserSql;
} }
public void setUpdateUserSql(String updateUserSql) { public void setUpdateUserSql(String updateUserSql) {
Assert.hasText(updateUserSql, "updateUserSql should have text");; Assert.hasText(updateUserSql, "updateUserSql should have text");
this.updateUserSql = updateUserSql; this.updateUserSql = updateUserSql;
} }
public void setCreateAuthoritySql(String createAuthoritySql) { public void setCreateAuthoritySql(String createAuthoritySql) {
Assert.hasText(createAuthoritySql, "createAuthoritySql should have text");; Assert.hasText(createAuthoritySql, "createAuthoritySql should have text");
this.createAuthoritySql = createAuthoritySql; this.createAuthoritySql = createAuthoritySql;
} }
public void setDeleteUserAuthoritiesSql(String deleteUserAuthoritiesSql) { public void setDeleteUserAuthoritiesSql(String deleteUserAuthoritiesSql) {
Assert.hasText(deleteUserAuthoritiesSql, "deleteUserAuthoritiesSql should have text");; Assert.hasText(deleteUserAuthoritiesSql, "deleteUserAuthoritiesSql should have text");
this.deleteUserAuthoritiesSql = deleteUserAuthoritiesSql; this.deleteUserAuthoritiesSql = deleteUserAuthoritiesSql;
} }
public void setUserExistsSql(String userExistsSql) { public void setUserExistsSql(String userExistsSql) {
Assert.hasText(userExistsSql, "userExistsSql should have text");; Assert.hasText(userExistsSql, "userExistsSql should have text");
this.userExistsSql = userExistsSql; this.userExistsSql = userExistsSql;
} }
public void setChangePasswordSql(String changePasswordSql) { public void setChangePasswordSql(String changePasswordSql) {
Assert.hasText(changePasswordSql, "changePasswordSql should have text");; Assert.hasText(changePasswordSql, "changePasswordSql should have text");
this.changePasswordSql = changePasswordSql; this.changePasswordSql = changePasswordSql;
} }
public void setFindAllGroupsSql(String findAllGroupsSql) { public void setFindAllGroupsSql(String findAllGroupsSql) {
Assert.hasText(findAllGroupsSql, "findAllGroupsSql should have text");; Assert.hasText(findAllGroupsSql, "findAllGroupsSql should have text");
this.findAllGroupsSql = findAllGroupsSql; this.findAllGroupsSql = findAllGroupsSql;
} }
public void setFindUsersInGroupSql(String findUsersInGroupSql) { public void setFindUsersInGroupSql(String findUsersInGroupSql) {
Assert.hasText(findUsersInGroupSql, "findUsersInGroupSql should have text");; Assert.hasText(findUsersInGroupSql, "findUsersInGroupSql should have text");
this.findUsersInGroupSql = findUsersInGroupSql; this.findUsersInGroupSql = findUsersInGroupSql;
} }
public void setInsertGroupSql(String insertGroupSql) { public void setInsertGroupSql(String insertGroupSql) {
Assert.hasText(insertGroupSql, "insertGroupSql should have text");; Assert.hasText(insertGroupSql, "insertGroupSql should have text");
this.insertGroupSql = insertGroupSql; this.insertGroupSql = insertGroupSql;
} }
public void setFindGroupIdSql(String findGroupIdSql) { public void setFindGroupIdSql(String findGroupIdSql) {
Assert.hasText(findGroupIdSql, "findGroupIdSql should have text");; Assert.hasText(findGroupIdSql, "findGroupIdSql should have text");
this.findGroupIdSql = findGroupIdSql; this.findGroupIdSql = findGroupIdSql;
} }
public void setInsertGroupAuthoritySql(String insertGroupAuthoritySql) { public void setInsertGroupAuthoritySql(String insertGroupAuthoritySql) {
Assert.hasText(insertGroupAuthoritySql, "insertGroupAuthoritySql should have text");; Assert.hasText(insertGroupAuthoritySql, "insertGroupAuthoritySql should have text");
this.insertGroupAuthoritySql = insertGroupAuthoritySql; this.insertGroupAuthoritySql = insertGroupAuthoritySql;
} }
public void setDeleteGroupSql(String deleteGroupSql) { public void setDeleteGroupSql(String deleteGroupSql) {
Assert.hasText(deleteGroupSql, "deleteGroupSql should have text");; Assert.hasText(deleteGroupSql, "deleteGroupSql should have text");
this.deleteGroupSql = deleteGroupSql; this.deleteGroupSql = deleteGroupSql;
} }
public void setDeleteGroupAuthoritiesSql(String deleteGroupAuthoritiesSql) { public void setDeleteGroupAuthoritiesSql(String deleteGroupAuthoritiesSql) {
Assert.hasText(deleteGroupAuthoritiesSql, "deleteGroupAuthoritiesSql should have text");; Assert.hasText(deleteGroupAuthoritiesSql, "deleteGroupAuthoritiesSql should have text");
this.deleteGroupAuthoritiesSql = deleteGroupAuthoritiesSql; this.deleteGroupAuthoritiesSql = deleteGroupAuthoritiesSql;
} }
public void setDeleteGroupMembersSql(String deleteGroupMembersSql) { public void setDeleteGroupMembersSql(String deleteGroupMembersSql) {
Assert.hasText(deleteGroupMembersSql, "deleteGroupMembersSql should have text");; Assert.hasText(deleteGroupMembersSql, "deleteGroupMembersSql should have text");
this.deleteGroupMembersSql = deleteGroupMembersSql; this.deleteGroupMembersSql = deleteGroupMembersSql;
} }
public void setRenameGroupSql(String renameGroupSql) { public void setRenameGroupSql(String renameGroupSql) {
Assert.hasText(renameGroupSql, "renameGroupSql should have text");; Assert.hasText(renameGroupSql, "renameGroupSql should have text");
this.renameGroupSql = renameGroupSql; this.renameGroupSql = renameGroupSql;
} }
public void setInsertGroupMemberSql(String insertGroupMemberSql) { public void setInsertGroupMemberSql(String insertGroupMemberSql) {
Assert.hasText(insertGroupMemberSql, "insertGroupMemberSql should have text");; Assert.hasText(insertGroupMemberSql, "insertGroupMemberSql should have text");
this.insertGroupMemberSql = insertGroupMemberSql; this.insertGroupMemberSql = insertGroupMemberSql;
} }
public void setDeleteGroupMemberSql(String deleteGroupMemberSql) { public void setDeleteGroupMemberSql(String deleteGroupMemberSql) {
Assert.hasText(deleteGroupMemberSql, "deleteGroupMemberSql should have text");; Assert.hasText(deleteGroupMemberSql, "deleteGroupMemberSql should have text");
this.deleteGroupMemberSql = deleteGroupMemberSql; this.deleteGroupMemberSql = deleteGroupMemberSql;
} }
public void setGroupAuthoritiesSql(String groupAuthoritiesSql) { public void setGroupAuthoritiesSql(String groupAuthoritiesSql) {
Assert.hasText(groupAuthoritiesSql, "groupAuthoritiesSql should have text");; Assert.hasText(groupAuthoritiesSql, "groupAuthoritiesSql should have text");
this.groupAuthoritiesSql = groupAuthoritiesSql; this.groupAuthoritiesSql = groupAuthoritiesSql;
} }
public void setDeleteGroupAuthoritySql(String deleteGroupAuthoritySql) { public void setDeleteGroupAuthoritySql(String deleteGroupAuthoritySql) {
Assert.hasText(deleteGroupAuthoritySql, "deleteGroupAuthoritySql should have text");; Assert.hasText(deleteGroupAuthoritySql, "deleteGroupAuthoritySql should have text");
this.deleteGroupAuthoritySql = deleteGroupAuthoritySql; this.deleteGroupAuthoritySql = deleteGroupAuthoritySql;
} }

View File

@ -44,12 +44,11 @@ public class RoleHierarchyImplTests {
authorities0)).isNotNull(); authorities0)).isNotNull();
assertThat( assertThat(
roleHierarchyImpl.getReachableGrantedAuthorities(authorities0)).isEmpty(); roleHierarchyImpl.getReachableGrantedAuthorities(authorities0)).isEmpty();
;
assertThat(roleHierarchyImpl.getReachableGrantedAuthorities( assertThat(roleHierarchyImpl.getReachableGrantedAuthorities(
authorities1)).isNotNull(); authorities1)).isNotNull();
assertThat( assertThat(
roleHierarchyImpl.getReachableGrantedAuthorities(authorities1)).isEmpty(); roleHierarchyImpl.getReachableGrantedAuthorities(authorities1)).isEmpty();
;
} }
@Test @Test

View File

@ -68,7 +68,7 @@ public class DelegatingMethodSecurityMetadataSourceTests {
// Exercise the cached case // Exercise the cached case
assertThat(mds.getAttributes(mi)).isSameAs(attributes); assertThat(mds.getAttributes(mi)).isSameAs(attributes);
assertThat(mds.getAttributes( assertThat(mds.getAttributes(
new SimpleMethodInvocation(null, String.class.getMethod("length")))).isEmpty();; new SimpleMethodInvocation(null, String.class.getMethod("length")))).isEmpty();
} }
} }

View File

@ -16,7 +16,10 @@
<!-- Root Checks --> <!-- Root Checks -->
<module name="TreeWalker"> <module name="TreeWalker">
<!-- Annotations --> <!-- Annotations -->
<module name="MissingOverrideCheck"/> <module name="MissingOverrideCheck" />
<!-- Coding -->
<module name="EmptyStatementCheck" />
<!-- Imports --> <!-- Imports -->
<module name="UnusedImportsCheck"> <module name="UnusedImportsCheck">

View File

@ -163,7 +163,6 @@ public class ChannelSecurityInterceptorTests {
@Test @Test
public void preReceive() throws Exception { public void preReceive() throws Exception {
assertThat(interceptor.preReceive(channel)).isTrue(); assertThat(interceptor.preReceive(channel)).isTrue();
;
} }
@Test @Test

View File

@ -240,7 +240,7 @@ public class FilterChainProxyTests {
} }
}).when(filter).doFilter(any(HttpServletRequest.class), }).when(filter).doFilter(any(HttpServletRequest.class),
any(HttpServletResponse.class), any(FilterChain.class)); any(HttpServletResponse.class), any(FilterChain.class));
;
fcp.doFilter(request, response, innerChain); fcp.doFilter(request, response, innerChain);
assertThat(SecurityContextHolder.getContext().getAuthentication()).isSameAs(expected); assertThat(SecurityContextHolder.getContext().getAuthentication()).isSameAs(expected);
return null; return null;

View File

@ -403,7 +403,6 @@ public class SecurityContextHolderAwareRequestFilterTests {
this.filter.setRolePrefix("PREFIX_"); this.filter.setRolePrefix("PREFIX_");
assertThat(wrappedRequest().isUserInRole("PREFIX_USER")).isTrue(); assertThat(wrappedRequest().isUserInRole("PREFIX_USER")).isTrue();
;
} }
private HttpServletRequest wrappedRequest() throws Exception { private HttpServletRequest wrappedRequest() throws Exception {