From 5f518d00e546f195103c01425d1365ec9b97ad5d Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Fri, 17 Nov 2017 03:37:00 +0900 Subject: [PATCH] Apply Checkstyle EmptyStatementCheck module This commit adds Checkstyle `EmptyStatementCheck` module and aligns code with it. --- ...ationCollectionFilteringProviderTests.java | 2 +- .../AclEntryAfterInvocationProviderTests.java | 2 +- .../provisioning/JdbcUserDetailsManager.java | 56 +++++++++---------- .../RoleHierarchyImplTests.java | 3 +- ...tingMethodSecurityMetadataSourceTests.java | 2 +- etc/checkstyle/checkstyle.xml | 5 +- .../ChannelSecurityInterceptorTests.java | 1 - .../security/web/FilterChainProxyTests.java | 2 +- ...yContextHolderAwareRequestFilterTests.java | 1 - 9 files changed, 37 insertions(+), 37 deletions(-) diff --git a/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationCollectionFilteringProviderTests.java b/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationCollectionFilteringProviderTests.java index 7eed9dcf8c..488ec48930 100644 --- a/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationCollectionFilteringProviderTests.java +++ b/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationCollectionFilteringProviderTests.java @@ -82,7 +82,7 @@ public class AclEntryAfterInvocationCollectionFilteringProviderTests { assertThat(provider.decide(mock(Authentication.class), new Object(), SecurityConfig.createList("AFTER_ACL_COLLECTION_READ"), null)) - .isNull();; + .isNull(); verify(service, never()).readAclById(any(ObjectIdentity.class), any(List.class)); } diff --git a/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationProviderTests.java b/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationProviderTests.java index 180c610f3f..b398aa8625 100644 --- a/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationProviderTests.java +++ b/acl/src/test/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationProviderTests.java @@ -138,7 +138,7 @@ public class AclEntryAfterInvocationProviderTests { assertThat(provider.decide(mock(Authentication.class), new Object(), SecurityConfig.createList("AFTER_ACL_COLLECTION_READ"), null)) - .isNull();; + .isNull(); verify(service, never()).readAclById(any(ObjectIdentity.class), any(List.class)); } } diff --git a/core/src/main/java/org/springframework/security/provisioning/JdbcUserDetailsManager.java b/core/src/main/java/org/springframework/security/provisioning/JdbcUserDetailsManager.java index 5f2a1293c7..7dbe8b61b4 100644 --- a/core/src/main/java/org/springframework/security/provisioning/JdbcUserDetailsManager.java +++ b/core/src/main/java/org/springframework/security/provisioning/JdbcUserDetailsManager.java @@ -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, "oldName should have text");; - Assert.hasText(newName, "newName should have text");; + 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, "username should have text");; - Assert.hasText(groupName, "groupName should have text");; + 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, "username should have text");; - Assert.hasText(groupName, "groupName should have text");; + 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 findGroupAuthorities(String 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 }, new RowMapper() { @@ -377,7 +377,7 @@ 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, "groupName should have text");; + Assert.hasText(groupName, "groupName should have text"); Assert.notNull(authority, "authority cannot be null"); final int id = findGroupId(groupName); @@ -398,102 +398,102 @@ public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsMa } public void setCreateUserSql(String createUserSql) { - Assert.hasText(createUserSql, "createUserSql should have text");; + Assert.hasText(createUserSql, "createUserSql should have text"); this.createUserSql = createUserSql; } public void setDeleteUserSql(String deleteUserSql) { - Assert.hasText(deleteUserSql, "deleteUserSql should have text");; + Assert.hasText(deleteUserSql, "deleteUserSql should have text"); this.deleteUserSql = deleteUserSql; } public void setUpdateUserSql(String updateUserSql) { - Assert.hasText(updateUserSql, "updateUserSql should have text");; + Assert.hasText(updateUserSql, "updateUserSql should have text"); this.updateUserSql = updateUserSql; } public void setCreateAuthoritySql(String createAuthoritySql) { - Assert.hasText(createAuthoritySql, "createAuthoritySql should have text");; + Assert.hasText(createAuthoritySql, "createAuthoritySql should have text"); this.createAuthoritySql = createAuthoritySql; } public void setDeleteUserAuthoritiesSql(String deleteUserAuthoritiesSql) { - Assert.hasText(deleteUserAuthoritiesSql, "deleteUserAuthoritiesSql should have text");; + Assert.hasText(deleteUserAuthoritiesSql, "deleteUserAuthoritiesSql should have text"); this.deleteUserAuthoritiesSql = deleteUserAuthoritiesSql; } public void setUserExistsSql(String userExistsSql) { - Assert.hasText(userExistsSql, "userExistsSql should have text");; + Assert.hasText(userExistsSql, "userExistsSql should have text"); this.userExistsSql = userExistsSql; } public void setChangePasswordSql(String changePasswordSql) { - Assert.hasText(changePasswordSql, "changePasswordSql should have text");; + Assert.hasText(changePasswordSql, "changePasswordSql should have text"); this.changePasswordSql = changePasswordSql; } public void setFindAllGroupsSql(String findAllGroupsSql) { - Assert.hasText(findAllGroupsSql, "findAllGroupsSql should have text");; + Assert.hasText(findAllGroupsSql, "findAllGroupsSql should have text"); this.findAllGroupsSql = findAllGroupsSql; } public void setFindUsersInGroupSql(String findUsersInGroupSql) { - Assert.hasText(findUsersInGroupSql, "findUsersInGroupSql should have text");; + Assert.hasText(findUsersInGroupSql, "findUsersInGroupSql should have text"); this.findUsersInGroupSql = findUsersInGroupSql; } public void setInsertGroupSql(String insertGroupSql) { - Assert.hasText(insertGroupSql, "insertGroupSql should have text");; + Assert.hasText(insertGroupSql, "insertGroupSql should have text"); this.insertGroupSql = insertGroupSql; } public void setFindGroupIdSql(String findGroupIdSql) { - Assert.hasText(findGroupIdSql, "findGroupIdSql should have text");; + Assert.hasText(findGroupIdSql, "findGroupIdSql should have text"); this.findGroupIdSql = findGroupIdSql; } public void setInsertGroupAuthoritySql(String insertGroupAuthoritySql) { - Assert.hasText(insertGroupAuthoritySql, "insertGroupAuthoritySql should have text");; + Assert.hasText(insertGroupAuthoritySql, "insertGroupAuthoritySql should have text"); this.insertGroupAuthoritySql = insertGroupAuthoritySql; } public void setDeleteGroupSql(String deleteGroupSql) { - Assert.hasText(deleteGroupSql, "deleteGroupSql should have text");; + Assert.hasText(deleteGroupSql, "deleteGroupSql should have text"); this.deleteGroupSql = deleteGroupSql; } public void setDeleteGroupAuthoritiesSql(String deleteGroupAuthoritiesSql) { - Assert.hasText(deleteGroupAuthoritiesSql, "deleteGroupAuthoritiesSql should have text");; + Assert.hasText(deleteGroupAuthoritiesSql, "deleteGroupAuthoritiesSql should have text"); this.deleteGroupAuthoritiesSql = deleteGroupAuthoritiesSql; } public void setDeleteGroupMembersSql(String deleteGroupMembersSql) { - Assert.hasText(deleteGroupMembersSql, "deleteGroupMembersSql should have text");; + Assert.hasText(deleteGroupMembersSql, "deleteGroupMembersSql should have text"); this.deleteGroupMembersSql = deleteGroupMembersSql; } public void setRenameGroupSql(String renameGroupSql) { - Assert.hasText(renameGroupSql, "renameGroupSql should have text");; + Assert.hasText(renameGroupSql, "renameGroupSql should have text"); this.renameGroupSql = renameGroupSql; } public void setInsertGroupMemberSql(String insertGroupMemberSql) { - Assert.hasText(insertGroupMemberSql, "insertGroupMemberSql should have text");; + Assert.hasText(insertGroupMemberSql, "insertGroupMemberSql should have text"); this.insertGroupMemberSql = insertGroupMemberSql; } public void setDeleteGroupMemberSql(String deleteGroupMemberSql) { - Assert.hasText(deleteGroupMemberSql, "deleteGroupMemberSql should have text");; + Assert.hasText(deleteGroupMemberSql, "deleteGroupMemberSql should have text"); this.deleteGroupMemberSql = deleteGroupMemberSql; } public void setGroupAuthoritiesSql(String groupAuthoritiesSql) { - Assert.hasText(groupAuthoritiesSql, "groupAuthoritiesSql should have text");; + Assert.hasText(groupAuthoritiesSql, "groupAuthoritiesSql should have text"); this.groupAuthoritiesSql = groupAuthoritiesSql; } public void setDeleteGroupAuthoritySql(String deleteGroupAuthoritySql) { - Assert.hasText(deleteGroupAuthoritySql, "deleteGroupAuthoritySql should have text");; + Assert.hasText(deleteGroupAuthoritySql, "deleteGroupAuthoritySql should have text"); this.deleteGroupAuthoritySql = deleteGroupAuthoritySql; } diff --git a/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyImplTests.java b/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyImplTests.java index b2f18e57c6..456face892 100644 --- a/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyImplTests.java +++ b/core/src/test/java/org/springframework/security/access/hierarchicalroles/RoleHierarchyImplTests.java @@ -44,12 +44,11 @@ public class RoleHierarchyImplTests { authorities0)).isNotNull(); assertThat( roleHierarchyImpl.getReachableGrantedAuthorities(authorities0)).isEmpty(); - ; + assertThat(roleHierarchyImpl.getReachableGrantedAuthorities( authorities1)).isNotNull(); assertThat( roleHierarchyImpl.getReachableGrantedAuthorities(authorities1)).isEmpty(); - ; } @Test diff --git a/core/src/test/java/org/springframework/security/access/method/DelegatingMethodSecurityMetadataSourceTests.java b/core/src/test/java/org/springframework/security/access/method/DelegatingMethodSecurityMetadataSourceTests.java index 167cb5ae5c..636745a8d2 100644 --- a/core/src/test/java/org/springframework/security/access/method/DelegatingMethodSecurityMetadataSourceTests.java +++ b/core/src/test/java/org/springframework/security/access/method/DelegatingMethodSecurityMetadataSourceTests.java @@ -68,7 +68,7 @@ public class DelegatingMethodSecurityMetadataSourceTests { // Exercise the cached case assertThat(mds.getAttributes(mi)).isSameAs(attributes); assertThat(mds.getAttributes( - new SimpleMethodInvocation(null, String.class.getMethod("length")))).isEmpty();; + new SimpleMethodInvocation(null, String.class.getMethod("length")))).isEmpty(); } } diff --git a/etc/checkstyle/checkstyle.xml b/etc/checkstyle/checkstyle.xml index 370aba4bbd..520c7d9cb4 100644 --- a/etc/checkstyle/checkstyle.xml +++ b/etc/checkstyle/checkstyle.xml @@ -16,7 +16,10 @@ - + + + + diff --git a/messaging/src/test/java/org/springframework/security/messaging/access/intercept/ChannelSecurityInterceptorTests.java b/messaging/src/test/java/org/springframework/security/messaging/access/intercept/ChannelSecurityInterceptorTests.java index ba3e061691..a244c2ddc3 100644 --- a/messaging/src/test/java/org/springframework/security/messaging/access/intercept/ChannelSecurityInterceptorTests.java +++ b/messaging/src/test/java/org/springframework/security/messaging/access/intercept/ChannelSecurityInterceptorTests.java @@ -163,7 +163,6 @@ public class ChannelSecurityInterceptorTests { @Test public void preReceive() throws Exception { assertThat(interceptor.preReceive(channel)).isTrue(); - ; } @Test diff --git a/web/src/test/java/org/springframework/security/web/FilterChainProxyTests.java b/web/src/test/java/org/springframework/security/web/FilterChainProxyTests.java index d9cd466fcd..576fda3f75 100644 --- a/web/src/test/java/org/springframework/security/web/FilterChainProxyTests.java +++ b/web/src/test/java/org/springframework/security/web/FilterChainProxyTests.java @@ -240,7 +240,7 @@ public class FilterChainProxyTests { } }).when(filter).doFilter(any(HttpServletRequest.class), any(HttpServletResponse.class), any(FilterChain.class)); - ; + fcp.doFilter(request, response, innerChain); assertThat(SecurityContextHolder.getContext().getAuthentication()).isSameAs(expected); return null; diff --git a/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestFilterTests.java b/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestFilterTests.java index 953bd27307..85bab452c1 100644 --- a/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestFilterTests.java @@ -403,7 +403,6 @@ public class SecurityContextHolderAwareRequestFilterTests { this.filter.setRolePrefix("PREFIX_"); assertThat(wrappedRequest().isUserInRole("PREFIX_USER")).isTrue(); - ; } private HttpServletRequest wrappedRequest() throws Exception {