Bläddra i källkod

Apply Checkstyle EmptyStatementCheck module

This commit adds Checkstyle `EmptyStatementCheck` module and aligns code with it.
Johnny Lim 7 år sedan
förälder
incheckning
5f518d00e5

+ 1 - 1
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));
 	}
 

+ 1 - 1
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));
 	}
 }

+ 28 - 28
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<GrantedAuthority> 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<GrantedAuthority>() {
@@ -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;
 	}
 

+ 1 - 2
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

+ 1 - 1
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();
 	}
 
 }

+ 4 - 1
etc/checkstyle/checkstyle.xml

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

+ 0 - 1
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

+ 1 - 1
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;

+ 0 - 1
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 {