1
0
mirror of synced 2026-08-05 17:57:15 +00:00

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
@@ -231,7 +231,7 @@ class DummyRequest extends HttpServletRequestWrapper {
}
final class UnsupportedOperationExceptionInvocationHandler implements InvocationHandler {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
public Object invoke(Object proxy, Method method, Object[] args) {
throw new UnsupportedOperationException(method + " is not supported");
}
}
@@ -58,7 +58,7 @@ public abstract class AbstractRetryEntryPoint implements ChannelEntryPoint {
// ========================================================================================================
public void commence(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
throws IOException {
String queryString = request.getQueryString();
String redirectUrl = request.getRequestURI()
+ ((queryString == null) ? "" : ("?" + queryString));
@@ -60,7 +60,7 @@ public class ChannelDecisionManagerImpl implements ChannelDecisionManager,
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notEmpty(channelProcessors, "A list of ChannelProcessors is required");
}
@@ -48,5 +48,5 @@ public interface ChannelEntryPoint {
*
*/
void commence(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException;
throws IOException;
}
@@ -50,7 +50,7 @@ public class InsecureChannelProcessor implements InitializingBean, ChannelProces
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.hasLength(insecureKeyword, "insecureKeyword required");
Assert.notNull(entryPoint, "entryPoint required");
}
@@ -50,7 +50,7 @@ public class SecureChannelProcessor implements InitializingBean, ChannelProcesso
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.hasLength(secureKeyword, "secureKeyword required");
Assert.notNull(entryPoint, "entryPoint required");
}
@@ -63,9 +63,8 @@ public class FilterSecurityInterceptor extends AbstractSecurityInterceptor imple
*
* @param arg0 ignored
*
* @throws ServletException never thrown
*/
public void init(FilterConfig arg0) throws ServletException {
public void init(FilterConfig arg0) {
}
/**
@@ -280,8 +280,7 @@ public abstract class AbstractAuthenticationProcessingFilter extends GenericFilt
* @throws AuthenticationException if authentication fails.
*/
public abstract Authentication attemptAuthentication(HttpServletRequest request,
HttpServletResponse response) throws AuthenticationException, IOException,
ServletException;
HttpServletResponse response) throws AuthenticationException, IOException;
/**
* Default behaviour for successful authentication.
@@ -79,7 +79,7 @@ public abstract class AbstractAuthenticationTargetUrlRequestHandler {
* The redirect will not be performed if the response has already been committed.
*/
protected void handle(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
Authentication authentication) throws IOException {
String targetUrl = determineTargetUrl(request, response, authentication);
if (response.isCommitted()) {
@@ -167,7 +167,7 @@ public class AuthenticationFilter extends OncePerRequestFilter {
}
protected Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
throws AuthenticationException, IOException, ServletException {
throws AuthenticationException, ServletException {
Authentication authentication = this.authenticationConverter.convert(request);
if (authentication == null) {
return null;
@@ -102,7 +102,7 @@ public class DelegatingAuthenticationEntryPoint implements AuthenticationEntryPo
this.defaultEntryPoint = defaultEntryPoint;
}
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notEmpty(entryPoints, "entryPoints must be specified");
Assert.notNull(defaultEntryPoint, "defaultEntryPoint must be specified");
}
@@ -52,10 +52,10 @@ public class Http403ForbiddenEntryPoint implements AuthenticationEntryPoint {
* Always returns a 403 error code to the client.
*/
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException arg2) throws IOException, ServletException {
AuthenticationException arg2) throws IOException {
if (logger.isDebugEnabled()) {
logger.debug("Pre-authenticated entry point called. Rejecting access");
}
response.sendError(HttpServletResponse.SC_FORBIDDEN, "Access Denied");
}
}
}
@@ -48,7 +48,7 @@ public final class HttpStatusEntryPoint implements AuthenticationEntryPoint {
}
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException {
AuthenticationException authException) {
response.setStatus(httpStatus.value());
}
}
@@ -99,7 +99,7 @@ public class LoginUrlAuthenticationEntryPoint implements AuthenticationEntryPoin
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.isTrue(
StringUtils.hasText(loginFormUrl)
&& UrlUtils.isValidRedirectUrl(loginFormUrl),
@@ -211,8 +211,7 @@ public class LoginUrlAuthenticationEntryPoint implements AuthenticationEntryPoin
* Builds a URL to redirect the supplied request to HTTPS. Used to redirect the
* current request to HTTPS, before doing a forward to the login page.
*/
protected String buildHttpsRedirectUrlForRequest(HttpServletRequest request)
throws IOException, ServletException {
protected String buildHttpsRedirectUrlForRequest(HttpServletRequest request) {
int serverPort = portResolver.getServerPort(request);
Integer httpsPort = portMapper.lookupHttpsPort(serverPort);
@@ -63,7 +63,7 @@ public class HttpStatusReturningLogoutSuccessHandler implements LogoutSuccessHan
* . Sets the status on the {@link HttpServletResponse}.
*/
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
Authentication authentication) throws IOException {
response.setStatus(this.httpStatusToReturn.value());
response.getWriter().flush();
}
@@ -50,7 +50,7 @@ public class J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource
/**
* Check that all required properties have been set.
*/
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notNull(j2eeMappableRoles, "No mappable roles available");
Assert.notNull(j2eeUserRoles2GrantedAuthoritiesMapper,
"Roles to granted authorities mapper not set");
@@ -130,8 +130,7 @@ public class WebXmlMappableAttributesRetriever implements ResourceLoaderAware,
* We do not need to resolve external entities, so just return an empty String.
*/
private static final class MyEntityResolver implements EntityResolver {
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
public InputSource resolveEntity(String publicId, String systemId) {
return new InputSource(new StringReader(""));
}
}
@@ -94,7 +94,7 @@ public abstract class AbstractRememberMeServices implements RememberMeServices,
}
@Override
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.hasLength(key, "key cannot be empty or null");
Assert.notNull(userDetailsService, "A UserDetailsService is required");
}
@@ -56,7 +56,7 @@ public class BasicAuthenticationEntryPoint implements AuthenticationEntryPoint,
}
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException {
AuthenticationException authException) throws IOException {
response.addHeader("WWW-Authenticate", "Basic realm=\"" + realmName + "\"");
response.sendError(HttpStatus.UNAUTHORIZED.value(), HttpStatus.UNAUTHORIZED.getReasonPhrase());
}
@@ -244,12 +244,11 @@ public class BasicAuthenticationFilter extends OncePerRequestFilter {
}
protected void onSuccessfulAuthentication(HttpServletRequest request,
HttpServletResponse response, Authentication authResult) throws IOException {
HttpServletResponse response, Authentication authResult) {
}
protected void onUnsuccessfulAuthentication(HttpServletRequest request,
HttpServletResponse response, AuthenticationException failed)
throws IOException {
HttpServletResponse response, AuthenticationException failed) {
}
protected AuthenticationEntryPoint getAuthenticationEntryPoint() {
@@ -72,7 +72,7 @@ public class DigestAuthenticationEntryPoint implements AuthenticationEntryPoint,
this.order = order;
}
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
if ((realmName == null) || "".equals(realmName)) {
throw new IllegalArgumentException("realmName must be specified");
}
@@ -83,7 +83,7 @@ public class DigestAuthenticationEntryPoint implements AuthenticationEntryPoint,
}
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException {
AuthenticationException authException) throws IOException {
HttpServletResponse httpResponse = response;
// compute a nonce (do not use remote IP address due to proxy farms)
@@ -107,7 +107,7 @@ public final class AuthenticationPrincipalArgumentResolver
*/
public Object resolveArgument(MethodParameter parameter,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest,
WebDataBinderFactory binderFactory) throws Exception {
WebDataBinderFactory binderFactory) {
Authentication authentication = SecurityContextHolder.getContext()
.getAuthentication();
if (authentication == null) {
@@ -153,4 +153,4 @@ public final class AuthenticationPrincipalArgumentResolver
}
return null;
}
}
}
@@ -106,7 +106,7 @@ public final class CurrentSecurityContextArgumentResolver
*/
public Object resolveArgument(MethodParameter parameter,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest,
WebDataBinderFactory binderFactory) throws Exception {
WebDataBinderFactory binderFactory) {
SecurityContext securityContext = SecurityContextHolder.getContext();
if (securityContext == null) {
return null;
@@ -109,7 +109,7 @@ public abstract class AbstractSecurityWebApplicationInitializer
* @see org.springframework.web.WebApplicationInitializer#onStartup(javax.servlet.
* ServletContext)
*/
public final void onStartup(ServletContext servletContext) throws ServletException {
public final void onStartup(ServletContext servletContext) {
beforeSpringSecurityFilterChain(servletContext);
if (this.configurationClasses != null) {
AnnotationConfigWebApplicationContext rootAppContext = new AnnotationConfigWebApplicationContext();
@@ -65,22 +65,20 @@ public final class SecurityContextCallableProcessingInterceptor extends
}
@Override
public <T> void beforeConcurrentHandling(NativeWebRequest request, Callable<T> task)
throws Exception {
public <T> void beforeConcurrentHandling(NativeWebRequest request, Callable<T> task) {
if (securityContext == null) {
setSecurityContext(SecurityContextHolder.getContext());
}
}
@Override
public <T> void preProcess(NativeWebRequest request, Callable<T> task)
throws Exception {
public <T> void preProcess(NativeWebRequest request, Callable<T> task) {
SecurityContextHolder.setContext(securityContext);
}
@Override
public <T> void postProcess(NativeWebRequest request, Callable<T> task,
Object concurrentResult) throws Exception {
Object concurrentResult) {
SecurityContextHolder.clearContext();
}
@@ -143,7 +143,7 @@ public final class DebugFilter implements Filter {
return null;
}
public void init(FilterConfig filterConfig) throws ServletException {
public void init(FilterConfig filterConfig) {
}
public void destroy() {
@@ -112,7 +112,7 @@ public final class AuthenticationPrincipalArgumentResolver
*/
public Object resolveArgument(MethodParameter parameter,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest,
WebDataBinderFactory binderFactory) throws Exception {
WebDataBinderFactory binderFactory) {
Authentication authentication = SecurityContextHolder.getContext()
.getAuthentication();
if (authentication == null) {
@@ -180,4 +180,4 @@ public final class AuthenticationPrincipalArgumentResolver
}
return null;
}
}
}
@@ -68,9 +68,9 @@ public final class CsrfTokenArgumentResolver implements HandlerMethodArgumentRes
*/
public Object resolveArgument(MethodParameter parameter,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest,
WebDataBinderFactory binderFactory) throws Exception {
WebDataBinderFactory binderFactory) {
CsrfToken token = (CsrfToken) webRequest.getAttribute(CsrfToken.class.getName(),
NativeWebRequest.SCOPE_REQUEST);
return token;
}
}
}
@@ -192,7 +192,7 @@ public class ConcurrentSessionFilter extends GenericFilterBean {
implements SessionInformationExpiredStrategy {
@Override
public void onExpiredSessionDetected(SessionInformationExpiredEvent event)
throws IOException, ServletException {
throws IOException {
HttpServletResponse response = event.getResponse();
response.getWriter().print(
"This session has been expired (possibly due to multiple concurrent "
@@ -29,6 +29,6 @@ import java.io.IOException;
public interface InvalidSessionStrategy {
void onInvalidSessionDetected(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException;
throws IOException;
}
@@ -30,5 +30,5 @@ import javax.servlet.ServletException;
public interface SessionInformationExpiredStrategy {
void onExpiredSessionDetected(SessionInformationExpiredEvent event)
throws IOException, ServletException;
throws IOException;
}