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

@@ -125,7 +125,7 @@ public abstract class AbstractSecurityInterceptor implements InitializingBean,
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notNull(getSecureObjectClass(),
"Subclass must provide a non-null response to getSecureObjectClass()");
Assert.notNull(this.messages, "A message source must be set");

View File

@@ -61,7 +61,7 @@ public class AfterInvocationProviderManager implements AfterInvocationManager,
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
checkIfValidList(this.providers);
}

View File

@@ -57,7 +57,7 @@ public class MethodInvocationPrivilegeEvaluator implements InitializingBean {
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notNull(securityInterceptor, "SecurityInterceptor required");
}

View File

@@ -54,7 +54,7 @@ public class RunAsImplAuthenticationProvider implements InitializingBean,
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notNull(key,
"A Key is required and should match that configured for the RunAsManagerImpl");
}

View File

@@ -63,7 +63,7 @@ public class RunAsManagerImpl implements RunAsManager, InitializingBean {
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notNull(
key,
"A Key is required and should match that configured for the RunAsImplAuthenticationProvider");

View File

@@ -69,8 +69,7 @@ public class PrePostAdviceReactiveMethodInterceptor implements MethodInterceptor
}
@Override
public Object invoke(final MethodInvocation invocation)
throws Throwable {
public Object invoke(final MethodInvocation invocation) {
Method method = invocation.getMethod();
Class<?> returnType = method.getReturnType();
if (!Publisher.class.isAssignableFrom(returnType)) {

View File

@@ -60,7 +60,7 @@ public abstract class AbstractAccessDecisionManager implements AccessDecisionMan
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notEmpty(this.decisionVoters, "A list of AccessDecisionVoters is required");
Assert.notNull(this.messages, "A message source must be set");
}

View File

@@ -115,7 +115,7 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
checkState();
}

View File

@@ -48,7 +48,7 @@ public class RememberMeAuthenticationProvider implements AuthenticationProvider,
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notNull(this.messages, "A message source must be set");
}

View File

@@ -228,7 +228,7 @@ public abstract class AbstractUserDetailsAuthenticationProvider implements
return result;
}
protected void doAfterPropertiesSet() throws Exception {
protected void doAfterPropertiesSet() {
}
public UserCache getUserCache() {

View File

@@ -96,7 +96,7 @@ public class DaoAuthenticationProvider extends AbstractUserDetailsAuthentication
}
}
protected void doAfterPropertiesSet() throws Exception {
protected void doAfterPropertiesSet() {
Assert.notNull(this.userDetailsService, "A UserDetailsService must be set");
}

View File

@@ -60,9 +60,6 @@ public interface JaasAuthenticationCallbackHandler {
* @param callback
* @param auth The Authentication object currently being authenticated.
*
* @throws IOException
* @throws UnsupportedCallbackException
*/
void handle(Callback callback, Authentication auth) throws IOException,
UnsupportedCallbackException;
void handle(Callback callback, Authentication auth);
}

View File

@@ -49,11 +49,8 @@ public class JaasNameCallbackHandler implements JaasAuthenticationCallbackHandle
* @param callback
* @param authentication
*
* @throws IOException
* @throws UnsupportedCallbackException
*/
public void handle(Callback callback, Authentication authentication)
throws IOException, UnsupportedCallbackException {
public void handle(Callback callback, Authentication authentication) {
if (callback instanceof NameCallback) {
NameCallback ncb = (NameCallback) callback;
String username;

View File

@@ -49,11 +49,8 @@ public class JaasPasswordCallbackHandler implements JaasAuthenticationCallbackHa
* @param callback
* @param auth
*
* @throws IOException
* @throws UnsupportedCallbackException
*/
public void handle(Callback callback, Authentication auth) throws IOException,
UnsupportedCallbackException {
public void handle(Callback callback, Authentication auth) {
if (callback instanceof PasswordCallback) {
PasswordCallback pc = (PasswordCallback) callback;
pc.setPassword(auth.getCredentials().toString().toCharArray());

View File

@@ -76,7 +76,7 @@ public class SecurityContextLoginModule implements LoginModule {
*
* @exception LoginException if the abort fails
*/
public boolean abort() throws LoginException {
public boolean abort() {
if (authen == null) {
return false;
}
@@ -95,7 +95,7 @@ public class SecurityContextLoginModule implements LoginModule {
*
* @exception LoginException if the commit fails
*/
public boolean commit() throws LoginException {
public boolean commit() {
if (authen == null) {
return false;
}
@@ -171,7 +171,7 @@ public class SecurityContextLoginModule implements LoginModule {
*
* @exception LoginException if the logout fails
*/
public boolean logout() throws LoginException {
public boolean logout() {
if (authen == null) {
return false;
}

View File

@@ -43,7 +43,7 @@ public class RemoteAuthenticationManagerImpl implements RemoteAuthenticationMana
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notNull(this.authenticationManager, "authenticationManager is required");
}

View File

@@ -60,7 +60,7 @@ public class RemoteAuthenticationProvider implements AuthenticationProvider,
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notNull(this.remoteAuthenticationManager,
"remoteAuthenticationManager is mandatory");
}

View File

@@ -38,7 +38,7 @@ public class MapBasedAttributes2GrantedAuthoritiesMapper implements
private String stringSeparator = ",";
private Set<String> mappableAttributes = null;
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notNull(attributes2grantedAuthoritiesMap,
"attributes2grantedAuthoritiesMap must be set");
}

View File

@@ -51,7 +51,7 @@ public class SimpleAttributes2GrantedAuthoritiesMapper implements
/**
* Check whether all properties have been set to correct values.
*/
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.isTrue(
!(isConvertAttributeToUpperCase() && isConvertAttributeToLowerCase()),
"Either convertAttributeToUpperCase or convertAttributeToLowerCase can be set to true, but not both");

View File

@@ -37,7 +37,7 @@ public final class SimpleAuthorityMapper implements GrantedAuthoritiesMapper,
private boolean convertToUpperCase = false;
private boolean convertToLowerCase = false;
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.isTrue(!(convertToUpperCase && convertToLowerCase),
"Either convertToUpperCase or convertToLowerCase can be set to true, but not both");
}

View File

@@ -173,7 +173,7 @@ public class KeyBasedPersistenceTokenService implements TokenService, Initializi
this.serverInteger = serverInteger;
}
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.hasText(serverSecret, "Server secret required");
Assert.notNull(serverInteger, "Server integer required");
Assert.notNull(secureRandom, "SecureRandom instance required");

View File

@@ -57,7 +57,7 @@ public class UserDetailsByNameServiceWrapper<T extends Authentication> implement
*
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
*/
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notNull(this.userDetailsService, "UserDetailsService must be set");
}

View File

@@ -46,7 +46,7 @@ public class EhCacheBasedUserCache implements UserCache, InitializingBean {
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notNull(cache, "cache mandatory");
}

View File

@@ -43,7 +43,7 @@ public class SpringCacheBasedUserCache implements UserCache {
// ~ Constructors
// ===================================================================================================
public SpringCacheBasedUserCache(Cache cache) throws Exception {
public SpringCacheBasedUserCache(Cache cache) {
Assert.notNull(cache, "cache mandatory");
this.cache = cache;
}

View File

@@ -66,7 +66,7 @@ public class InMemoryResource extends AbstractResource {
}
@Override
public InputStream getInputStream() throws IOException {
public InputStream getInputStream() {
return new ByteArrayInputStream(source);
}

View File

@@ -65,7 +65,7 @@ public class SimpleMethodInvocation implements MethodInvocation {
return targetObject;
}
public Object proceed() throws Throwable {
public Object proceed() {
throw new UnsupportedOperationException("mock method not implemented");
}
}