Remove redundant throws clauses

Removes exceptions that are declared in a method's signature but never thrown by the method itself or its implementations/derivatives.
This commit is contained in:
Lars Grefer
2019-08-23 01:03:54 +02:00
parent f0515a021c
commit 34dd5fea30
418 changed files with 1146 additions and 1273 deletions

View File

@@ -58,8 +58,7 @@ public class DefaultSpringSecurityContextSourceTests {
}
@Test
public void poolingFlagIsSetWhenAuthenticationDnMatchesManagerUserDn()
throws Exception {
public void poolingFlagIsSetWhenAuthenticationDnMatchesManagerUserDn() {
EnvExposingDefaultSpringSecurityContextSource ctxSrc = new EnvExposingDefaultSpringSecurityContextSource(
"ldap://blah:789/dc=springframework,dc=org");
ctxSrc.setUserDn("manager");
@@ -70,8 +69,7 @@ public class DefaultSpringSecurityContextSourceTests {
}
@Test
public void poolingFlagIsNotSetWhenAuthenticationDnIsNotManagerUserDn()
throws Exception {
public void poolingFlagIsNotSetWhenAuthenticationDnIsNotManagerUserDn() {
EnvExposingDefaultSpringSecurityContextSource ctxSrc = new EnvExposingDefaultSpringSecurityContextSource(
"ldap://blah:789/dc=springframework,dc=org");
ctxSrc.setUserDn("manager");
@@ -103,7 +101,7 @@ public class DefaultSpringSecurityContextSourceTests {
}
@Test
public void serverUrlWithSpacesIsSupported() throws Exception {
public void serverUrlWithSpacesIsSupported() {
DefaultSpringSecurityContextSource contextSource = new DefaultSpringSecurityContextSource(
this.contextSource.getUrls()[0]
+ "ou=space%20cadets,dc=springframework,dc=org");
@@ -114,7 +112,7 @@ public class DefaultSpringSecurityContextSourceTests {
}
@Test(expected = IllegalArgumentException.class)
public void instantiationFailsWithEmptyServerList() throws Exception {
public void instantiationFailsWithEmptyServerList() {
List<String> serverUrls = new ArrayList<>();
DefaultSpringSecurityContextSource ctxSrc = new DefaultSpringSecurityContextSource(
serverUrls, "dc=springframework,dc=org");
@@ -122,7 +120,7 @@ public class DefaultSpringSecurityContextSourceTests {
}
@Test
public void instantiationSuceedsWithProperServerList() throws Exception {
public void instantiationSuceedsWithProperServerList() {
List<String> serverUrls = new ArrayList<>();
serverUrls.add("ldap://foo:789");
serverUrls.add("ldap://bar:389");
@@ -136,7 +134,7 @@ public class DefaultSpringSecurityContextSourceTests {
// SEC-2308
@Test
public void instantiationSuceedsWithEmtpyBaseDn() throws Exception {
public void instantiationSuceedsWithEmtpyBaseDn() {
String baseDn = "";
List<String> serverUrls = new ArrayList<>();
serverUrls.add("ldap://foo:789");
@@ -150,7 +148,7 @@ public class DefaultSpringSecurityContextSourceTests {
}
@Test(expected = IllegalArgumentException.class)
public void instantiationFailsWithIncorrectServerUrl() throws Exception {
public void instantiationFailsWithIncorrectServerUrl() {
List<String> serverUrls = new ArrayList<>();
// a simple trailing slash should be ok
serverUrls.add("ldaps://blah:636/");

View File

@@ -56,7 +56,7 @@ public class SpringSecurityLdapTemplateITests {
// ========================================================================================================
@Before
public void setUp() throws Exception {
public void setUp() {
template = new SpringSecurityLdapTemplate(this.contextSource);
}
@@ -181,7 +181,7 @@ public class SpringSecurityLdapTemplateITests {
}
@Test
public void roleSearchWithEscapedCharacterSucceeds() throws Exception {
public void roleSearchWithEscapedCharacterSucceeds() {
String param = "cn=mouse\\, jerry,ou=people,dc=springframework,dc=org";
Set<String> values = template.searchForSingleAttributeValues("ou=groups",

View File

@@ -59,7 +59,7 @@ public class PasswordComparisonAuthenticatorTests {
// ========================================================================================================
@Before
public void setUp() throws Exception {
public void setUp() {
authenticator = new PasswordComparisonAuthenticator(this.contextSource);
authenticator.setPasswordEncoder(NoOpPasswordEncoder.getInstance());
authenticator.setUserDnPatterns(new String[] { "uid={0},ou=people" });
@@ -106,7 +106,7 @@ public class PasswordComparisonAuthenticatorTests {
}
@Test
public void testOnlySpecifiedAttributesAreRetrieved() throws Exception {
public void testOnlySpecifiedAttributesAreRetrieved() {
authenticator.setUserAttributes(new String[] { "uid", "userPassword" });
DirContextAdapter user = (DirContextAdapter) authenticator.authenticate(bob);

View File

@@ -73,7 +73,7 @@ public class FilterBasedLdapUserSearchTests {
// Try some funny business with filters.
@Test
public void extraFilterPartToExcludeBob() throws Exception {
public void extraFilterPartToExcludeBob() {
FilterBasedLdapUserSearch locator = new FilterBasedLdapUserSearch(
"ou=people",
"(&(cn=*)(!(|(uid={0})(uid=rod)(uid=jerry)(uid=slashguy)(uid=javadude)(uid=groovydude)(uid=closuredude)(uid=scaladude))))",
@@ -112,7 +112,7 @@ public class FilterBasedLdapUserSearchTests {
}
@Test
public void searchWithDifferentSearchBaseIsSuccessful() throws Exception {
public void searchWithDifferentSearchBaseIsSuccessful() {
FilterBasedLdapUserSearch locator = new FilterBasedLdapUserSearch(
"ou=otherpeople", "(cn={0})", this.contextSource);
DirContextOperations joe = locator.searchForUser("Joe Smeth");

View File

@@ -50,7 +50,7 @@ public class ApacheDSEmbeddedLdifTests {
this.ldapTemplate = new SpringSecurityLdapTemplate(createLdapContextSource());
}
private LdapContextSource createLdapContextSource() throws Exception {
private LdapContextSource createLdapContextSource() {
LdapContextSource ldapContextSource = new LdapContextSource();
ldapContextSource.setUrl("ldap://localhost:" + LDAP_PORT);
ldapContextSource.setBase(LDAP_ROOT);

View File

@@ -52,7 +52,7 @@ public class DefaultLdapAuthoritiesPopulatorTests {
// ========================================================================================================
@Before
public void setUp() throws Exception {
public void setUp() {
populator = new DefaultLdapAuthoritiesPopulator(this.contextSource, "ou=groups");
populator.setIgnorePartialResultException(false);
}
@@ -72,7 +72,7 @@ public class DefaultLdapAuthoritiesPopulatorTests {
}
@Test
public void nullSearchBaseIsAccepted() throws Exception {
public void nullSearchBaseIsAccepted() {
populator = new DefaultLdapAuthoritiesPopulator(this.contextSource, null);
populator.setDefaultRole("ROLE_USER");
@@ -154,7 +154,7 @@ public class DefaultLdapAuthoritiesPopulatorTests {
}
@Test
public void extraRolesAreAdded() throws Exception {
public void extraRolesAreAdded() {
populator = new DefaultLdapAuthoritiesPopulator(this.contextSource, null) {
@Override
protected Set<GrantedAuthority> getAdditionalRoles(DirContextOperations user,

View File

@@ -60,7 +60,7 @@ public class LdapUserDetailsManagerTests {
private SpringSecurityLdapTemplate template;
@Before
public void setUp() throws Exception {
public void setUp() {
mgr = new LdapUserDetailsManager(this.contextSource);
template = new SpringSecurityLdapTemplate(this.contextSource);
DirContextAdapter ctx = new DirContextAdapter();
@@ -91,7 +91,7 @@ public class LdapUserDetailsManagerTests {
}
@After
public void onTearDown() throws Exception {
public void onTearDown() {
// Iterator people = template.list("ou=testpeople").iterator();
// DirContext rootCtx = new DirContextAdapter(new

View File

@@ -55,7 +55,7 @@ public class NestedLdapAuthoritiesPopulatorTests {
// ========================================================================================================
@Before
public void setUp() throws Exception {
public void setUp() {
populator = new NestedLdapAuthoritiesPopulator(this.contextSource,
"ou=jdeveloper");
populator.setGroupSearchFilter("(member={0})");