diff --git a/acl/src/main/java/org/springframework/security/acls/domain/IdentityUnavailableException.java b/acl/src/main/java/org/springframework/security/acls/domain/IdentityUnavailableException.java index 872b36bbf1..ab53988f52 100644 --- a/acl/src/main/java/org/springframework/security/acls/domain/IdentityUnavailableException.java +++ b/acl/src/main/java/org/springframework/security/acls/domain/IdentityUnavailableException.java @@ -34,10 +34,10 @@ public class IdentityUnavailableException extends RuntimeException { * Constructs an IdentityUnavailableException with the specified message * and root cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public IdentityUnavailableException(String msg, Throwable t) { - super(msg, t); + public IdentityUnavailableException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/acl/src/main/java/org/springframework/security/acls/domain/ObjectIdentityImpl.java b/acl/src/main/java/org/springframework/security/acls/domain/ObjectIdentityImpl.java index 727e81ee77..4c64e995e4 100644 --- a/acl/src/main/java/org/springframework/security/acls/domain/ObjectIdentityImpl.java +++ b/acl/src/main/java/org/springframework/security/acls/domain/ObjectIdentityImpl.java @@ -77,8 +77,8 @@ public class ObjectIdentityImpl implements ObjectIdentity { Method method = typeClass.getMethod("getId", new Class[] {}); result = method.invoke(object); } - catch (Exception e) { - throw new IdentityUnavailableException("Could not extract identity from object " + object, e); + catch (Exception ex) { + throw new IdentityUnavailableException("Could not extract identity from object " + object, ex); } Assert.notNull(result, "getId() is required to return a non-null value"); diff --git a/acl/src/main/java/org/springframework/security/acls/jdbc/AclClassIdUtils.java b/acl/src/main/java/org/springframework/security/acls/jdbc/AclClassIdUtils.java index d8b4ca7555..fc311910cd 100644 --- a/acl/src/main/java/org/springframework/security/acls/jdbc/AclClassIdUtils.java +++ b/acl/src/main/java/org/springframework/security/acls/jdbc/AclClassIdUtils.java @@ -85,8 +85,8 @@ class AclClassIdUtils { try { hasClassIdType = classIdTypeFrom(resultSet) != null; } - catch (SQLException e) { - log.debug("Unable to obtain the class id type", e); + catch (SQLException ex) { + log.debug("Unable to obtain the class id type", ex); } return hasClassIdType; } @@ -101,8 +101,8 @@ class AclClassIdUtils { try { targetType = Class.forName(className); } - catch (ClassNotFoundException e) { - log.debug("Unable to find class id type on classpath", e); + catch (ClassNotFoundException ex) { + log.debug("Unable to find class id type on classpath", ex); } } return targetType; diff --git a/acl/src/main/java/org/springframework/security/acls/jdbc/BasicLookupStrategy.java b/acl/src/main/java/org/springframework/security/acls/jdbc/BasicLookupStrategy.java index 1b89d89c47..2faaeb2ac0 100644 --- a/acl/src/main/java/org/springframework/security/acls/jdbc/BasicLookupStrategy.java +++ b/acl/src/main/java/org/springframework/security/acls/jdbc/BasicLookupStrategy.java @@ -194,8 +194,8 @@ public class BasicLookupStrategy implements LookupStrategy { try { return (List) this.fieldAces.get(acl); } - catch (IllegalAccessException e) { - throw new IllegalStateException("Could not obtain AclImpl.aces field", e); + catch (IllegalAccessException ex) { + throw new IllegalStateException("Could not obtain AclImpl.aces field", ex); } } @@ -203,8 +203,8 @@ public class BasicLookupStrategy implements LookupStrategy { try { this.fieldAcl.set(ace, acl); } - catch (IllegalAccessException e) { - throw new IllegalStateException("Could not or set AclImpl on AccessControlEntryImpl fields", e); + catch (IllegalAccessException ex) { + throw new IllegalStateException("Could not or set AclImpl on AccessControlEntryImpl fields", ex); } } @@ -212,8 +212,8 @@ public class BasicLookupStrategy implements LookupStrategy { try { this.fieldAces.set(acl, aces); } - catch (IllegalAccessException e) { - throw new IllegalStateException("Could not set AclImpl entries", e); + catch (IllegalAccessException ex) { + throw new IllegalStateException("Could not set AclImpl entries", ex); } } diff --git a/acl/src/main/java/org/springframework/security/acls/model/AlreadyExistsException.java b/acl/src/main/java/org/springframework/security/acls/model/AlreadyExistsException.java index 1646f53e0b..a8b3130f46 100644 --- a/acl/src/main/java/org/springframework/security/acls/model/AlreadyExistsException.java +++ b/acl/src/main/java/org/springframework/security/acls/model/AlreadyExistsException.java @@ -34,10 +34,10 @@ public class AlreadyExistsException extends AclDataAccessException { * Constructs an AlreadyExistsException with the specified message and * root cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public AlreadyExistsException(String msg, Throwable t) { - super(msg, t); + public AlreadyExistsException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/acl/src/main/java/org/springframework/security/acls/model/ChildrenExistException.java b/acl/src/main/java/org/springframework/security/acls/model/ChildrenExistException.java index 679112393c..fca77474ff 100644 --- a/acl/src/main/java/org/springframework/security/acls/model/ChildrenExistException.java +++ b/acl/src/main/java/org/springframework/security/acls/model/ChildrenExistException.java @@ -34,10 +34,10 @@ public class ChildrenExistException extends AclDataAccessException { * Constructs an ChildrenExistException with the specified message and * root cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public ChildrenExistException(String msg, Throwable t) { - super(msg, t); + public ChildrenExistException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/acl/src/main/java/org/springframework/security/acls/model/NotFoundException.java b/acl/src/main/java/org/springframework/security/acls/model/NotFoundException.java index a77e252126..9f738f7cc2 100644 --- a/acl/src/main/java/org/springframework/security/acls/model/NotFoundException.java +++ b/acl/src/main/java/org/springframework/security/acls/model/NotFoundException.java @@ -34,10 +34,10 @@ public class NotFoundException extends AclDataAccessException { * Constructs an NotFoundException with the specified message and root * cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public NotFoundException(String msg, Throwable t) { - super(msg, t); + public NotFoundException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/acl/src/main/java/org/springframework/security/acls/model/UnloadedSidException.java b/acl/src/main/java/org/springframework/security/acls/model/UnloadedSidException.java index 68f68b6c42..fd95557ab2 100644 --- a/acl/src/main/java/org/springframework/security/acls/model/UnloadedSidException.java +++ b/acl/src/main/java/org/springframework/security/acls/model/UnloadedSidException.java @@ -36,10 +36,10 @@ public class UnloadedSidException extends AclDataAccessException { * Constructs an NotFoundException with the specified message and root * cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public UnloadedSidException(String msg, Throwable t) { - super(msg, t); + public UnloadedSidException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java b/acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java index cb33e618ca..b4647f3ded 100644 --- a/acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java +++ b/acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java @@ -628,8 +628,8 @@ public class AclImplTests { ((AuditableAccessControlEntry) ac).isAuditFailure())); } } - catch (IllegalAccessException e) { - e.printStackTrace(); + catch (IllegalAccessException ex) { + ex.printStackTrace(); } return acl; diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTests.java b/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTests.java index d0f964ec0d..5a43cd8d54 100644 --- a/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTests.java +++ b/acl/src/test/java/org/springframework/security/acls/jdbc/JdbcMutableAclServiceTests.java @@ -121,9 +121,9 @@ public class JdbcMutableAclServiceTests extends AbstractTransactionalJUnit4Sprin // new DatabaseSeeder(dataSource, new // ClassPathResource("createAclSchemaPostgres.sql")); } - catch (Exception e) { - e.printStackTrace(); - throw e; + catch (Exception ex) { + ex.printStackTrace(); + throw ex; } } diff --git a/cas/src/main/java/org/springframework/security/cas/authentication/CasAuthenticationProvider.java b/cas/src/main/java/org/springframework/security/cas/authentication/CasAuthenticationProvider.java index 48eaaeeca6..17ff6d98ec 100644 --- a/cas/src/main/java/org/springframework/security/cas/authentication/CasAuthenticationProvider.java +++ b/cas/src/main/java/org/springframework/security/cas/authentication/CasAuthenticationProvider.java @@ -156,8 +156,8 @@ public class CasAuthenticationProvider implements AuthenticationProvider, Initia return new CasAuthenticationToken(this.key, userDetails, authentication.getCredentials(), this.authoritiesMapper.mapAuthorities(userDetails.getAuthorities()), userDetails, assertion); } - catch (final TicketValidationException e) { - throw new BadCredentialsException(e.getMessage(), e); + catch (TicketValidationException ex) { + throw new BadCredentialsException(ex.getMessage(), ex); } } diff --git a/cas/src/main/java/org/springframework/security/cas/web/authentication/ServiceAuthenticationDetailsSource.java b/cas/src/main/java/org/springframework/security/cas/web/authentication/ServiceAuthenticationDetailsSource.java index 336fe142aa..530fae36c3 100644 --- a/cas/src/main/java/org/springframework/security/cas/web/authentication/ServiceAuthenticationDetailsSource.java +++ b/cas/src/main/java/org/springframework/security/cas/web/authentication/ServiceAuthenticationDetailsSource.java @@ -74,8 +74,8 @@ public class ServiceAuthenticationDetailsSource return new DefaultServiceAuthenticationDetails(this.serviceProperties.getService(), context, this.artifactPattern); } - catch (MalformedURLException e) { - throw new RuntimeException(e); + catch (MalformedURLException ex) { + throw new RuntimeException(ex); } } diff --git a/config/src/main/java/org/springframework/security/config/annotation/AbstractConfiguredSecurityBuilder.java b/config/src/main/java/org/springframework/security/config/annotation/AbstractConfiguredSecurityBuilder.java index 76f47b51cb..d240639492 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/AbstractConfiguredSecurityBuilder.java +++ b/config/src/main/java/org/springframework/security/config/annotation/AbstractConfiguredSecurityBuilder.java @@ -102,8 +102,8 @@ public abstract class AbstractConfiguredSecurityBuilder type = object.getClass(); - throw new RuntimeException("Could not postProcess " + object + " of type " + type, e); + throw new RuntimeException("Could not postProcess " + object + " of type " + type, ex); } this.autowireBeanFactory.autowireBean(object); if (result instanceof DisposableBean) { diff --git a/config/src/main/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfiguration.java b/config/src/main/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfiguration.java index 5748ed7773..4b4bf3c503 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfiguration.java +++ b/config/src/main/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfiguration.java @@ -153,8 +153,8 @@ public class GlobalMethodSecurityConfiguration implements ImportAware, SmartInit try { initializeMethodSecurityInterceptor(); } - catch (Exception e) { - throw new RuntimeException(e); + catch (Exception ex) { + throw new RuntimeException(ex); } PermissionEvaluator permissionEvaluator = getSingleBeanOrNull(PermissionEvaluator.class); @@ -182,7 +182,7 @@ public class GlobalMethodSecurityConfiguration implements ImportAware, SmartInit try { return this.context.getBean(type); } - catch (NoSuchBeanDefinitionException e) { + catch (NoSuchBeanDefinitionException ex) { } return null; } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/builders/WebSecurity.java b/config/src/main/java/org/springframework/security/config/annotation/web/builders/WebSecurity.java index 1a42d57849..e35182977b 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/builders/WebSecurity.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/builders/WebSecurity.java @@ -311,26 +311,26 @@ public final class WebSecurity extends AbstractConfiguredSecurityBuilder> try { return context.getBean(type); } - catch (NoSuchBeanDefinitionException e) { + catch (NoSuchBeanDefinitionException ex) { return null; } } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java index c38d6fbc96..12a0fccc89 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java @@ -560,7 +560,7 @@ public final class SessionManagementConfigurer> try { return context.getBean(type); } - catch (NoSuchBeanDefinitionException e) { + catch (NoSuchBeanDefinitionException ex) { return null; } } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurer.java index e73875032d..2ae3b43bce 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurer.java @@ -506,7 +506,7 @@ public final class OAuth2ResourceServerConfigurer> try { return context.getBean(clazz); } - catch (NoSuchBeanDefinitionException e) { + catch (NoSuchBeanDefinitionException ex) { } return null; } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurer.java index 4e2334e98e..243b26b52a 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurer.java @@ -119,7 +119,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends A try { return this.context.getBean(SimpAnnotationMethodMessageHandler.class).getPathMatcher(); } - catch (NoSuchBeanDefinitionException e) { + catch (NoSuchBeanDefinitionException ex) { return new AntPathMatcher(); } } diff --git a/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerFactoryBean.java b/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerFactoryBean.java index 6baac6525a..188ead0fb3 100644 --- a/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerFactoryBean.java +++ b/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerFactoryBean.java @@ -51,9 +51,9 @@ public class AuthenticationManagerFactoryBean implements FactoryBean"); fail(); } - catch (BeanCreationException e) { - Throwable cause = ultimateCause(e); + catch (BeanCreationException ex) { + Throwable cause = ultimateCause(ex); assertThat(cause instanceof NoSuchBeanDefinitionException).isTrue(); NoSuchBeanDefinitionException nsbe = (NoSuchBeanDefinitionException) cause; assertThat(nsbe.getBeanName()).isEqualTo(BeanIds.AUTHENTICATION_MANAGER); @@ -71,11 +71,11 @@ public class InvalidConfigurationTests { } } - private Throwable ultimateCause(Throwable e) { - if (e.getCause() == null) { - return e; + private Throwable ultimateCause(Throwable ex) { + if (ex.getCause() == null) { + return ex; } - return ultimateCause(e.getCause()); + return ultimateCause(ex.getCause()); } private void setContext(String context) { diff --git a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfigurationTests.java index e2dc8e56bf..22eaa2005a 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfigurationTests.java @@ -113,7 +113,7 @@ public class GlobalMethodSecurityConfigurationTests { try { this.authenticationManager.authenticate(new UsernamePasswordAuthenticationToken("foo", "bar")); } - catch (AuthenticationException e) { + catch (AuthenticationException ex) { } assertThat(this.events.getEvents()).extracting(Object::getClass) diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpX509Tests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpX509Tests.java index 74cc76cd4d..f179ec95c5 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpX509Tests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpX509Tests.java @@ -120,8 +120,8 @@ public class NamespaceHttpX509Tests { CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); return (T) certFactory.generateCertificate(is); } - catch (Exception e) { - throw new IllegalArgumentException(e); + catch (Exception ex) { + throw new IllegalArgumentException(ex); } } @@ -244,8 +244,8 @@ public class NamespaceHttpX509Tests { try { return ((X500Name) certificate.getSubjectDN()).getCommonName(); } - catch (Exception e) { - throw new IllegalArgumentException(e); + catch (Exception ex) { + throw new IllegalArgumentException(ex); } } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java index 0850eb24ca..ae3318db30 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java @@ -209,8 +209,8 @@ public class ServletApiConfigurerTests { try { return (T) FieldUtils.getFieldValue(target, fieldName); } - catch (Exception e) { - throw new RuntimeException(e); + catch (Exception ex) { + throw new RuntimeException(ex); } } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/X509ConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/X509ConfigurerTests.java index e497365b44..0de22b0bb0 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/X509ConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/X509ConfigurerTests.java @@ -94,8 +94,8 @@ public class X509ConfigurerTests { CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); return (T) certFactory.generateCertificate(is); } - catch (Exception e) { - throw new IllegalArgumentException(e); + catch (Exception ex) { + throw new IllegalArgumentException(ex); } } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java index 4a6223ef00..0205de29b3 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java @@ -256,8 +256,8 @@ public class Saml2LoginConfigurerTests { iout.finish(); return new String(out.toByteArray(), StandardCharsets.UTF_8); } - catch (IOException e) { - throw new Saml2Exception("Unable to inflate string", e); + catch (IOException ex) { + throw new Saml2Exception("Unable to inflate string", ex); } } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/TestSaml2Credentials.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/TestSaml2Credentials.java index ddccf53692..fc99869575 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/TestSaml2Credentials.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/TestSaml2Credentials.java @@ -64,8 +64,8 @@ public class TestSaml2Credentials { return (X509Certificate) factory .generateCertificate(new ByteArrayInputStream(source.getBytes(StandardCharsets.UTF_8))); } - catch (Exception e) { - throw new IllegalArgumentException(e); + catch (Exception ex) { + throw new IllegalArgumentException(ex); } } diff --git a/config/src/test/java/org/springframework/security/config/doc/XmlParser.java b/config/src/test/java/org/springframework/security/config/doc/XmlParser.java index bcc90a63b9..263ee0451f 100644 --- a/config/src/test/java/org/springframework/security/config/doc/XmlParser.java +++ b/config/src/test/java/org/springframework/security/config/doc/XmlParser.java @@ -42,8 +42,8 @@ public class XmlParser implements AutoCloseable { return new XmlNode(dBuilder.parse(this.xml)); } - catch (IOException | ParserConfigurationException | SAXException e) { - throw new IllegalStateException(e); + catch (IOException | ParserConfigurationException | SAXException ex) { + throw new IllegalStateException(ex); } } diff --git a/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigTests.java b/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigTests.java index 1abb75a816..b4a7bdc8c7 100644 --- a/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigTests.java @@ -418,8 +418,8 @@ public class SessionManagementConfigTests { try { return (T) FieldUtils.getFieldValue(target, fieldName); } - catch (Exception e) { - throw new RuntimeException(e); + catch (Exception ex) { + throw new RuntimeException(ex); } } diff --git a/config/src/test/java/org/springframework/security/config/test/SpringTestContext.java b/config/src/test/java/org/springframework/security/config/test/SpringTestContext.java index d4f477eb25..9da52a47c7 100644 --- a/config/src/test/java/org/springframework/security/config/test/SpringTestContext.java +++ b/config/src/test/java/org/springframework/security/config/test/SpringTestContext.java @@ -65,7 +65,7 @@ public class SpringTestContext implements Closeable { try { this.context.close(); } - catch (Exception e) { + catch (Exception ex) { } } diff --git a/config/src/test/java/org/springframework/security/config/web/server/OAuth2ResourceServerSpecTests.java b/config/src/test/java/org/springframework/security/config/web/server/OAuth2ResourceServerSpecTests.java index eb4940ca2d..3f01bf9d14 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/OAuth2ResourceServerSpecTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/OAuth2ResourceServerSpecTests.java @@ -447,8 +447,8 @@ public class OAuth2ResourceServerSpecTests { KeyFactory factory = KeyFactory.getInstance("RSA"); rsaPublicKey = (RSAPublicKey) factory.generatePublic(spec); } - catch (NoSuchAlgorithmException | InvalidKeySpecException e) { - e.printStackTrace(); + catch (NoSuchAlgorithmException | InvalidKeySpecException ex) { + ex.printStackTrace(); } return rsaPublicKey; } diff --git a/config/src/test/java/org/springframework/security/config/web/server/ServerHttpSecurityTests.java b/config/src/test/java/org/springframework/security/config/web/server/ServerHttpSecurityTests.java index 44fe067da9..0769425fd7 100644 --- a/config/src/test/java/org/springframework/security/config/web/server/ServerHttpSecurityTests.java +++ b/config/src/test/java/org/springframework/security/config/web/server/ServerHttpSecurityTests.java @@ -470,7 +470,7 @@ public class ServerHttpSecurityTests { Object converter = ReflectionTestUtils.getField(filter, "authenticationConverter"); return converter.getClass().isAssignableFrom(ServerX509AuthenticationConverter.class); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException ex) { // field doesn't exist return false; } diff --git a/core/src/main/java/org/springframework/security/access/AccessDeniedException.java b/core/src/main/java/org/springframework/security/access/AccessDeniedException.java index 4d703b30c7..3bf6ceac5a 100644 --- a/core/src/main/java/org/springframework/security/access/AccessDeniedException.java +++ b/core/src/main/java/org/springframework/security/access/AccessDeniedException.java @@ -36,10 +36,10 @@ public class AccessDeniedException extends RuntimeException { * Constructs an AccessDeniedException with the specified message and * root cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public AccessDeniedException(String msg, Throwable t) { - super(msg, t); + public AccessDeniedException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/core/src/main/java/org/springframework/security/access/AuthorizationServiceException.java b/core/src/main/java/org/springframework/security/access/AuthorizationServiceException.java index 7fe3affa79..6952be563a 100644 --- a/core/src/main/java/org/springframework/security/access/AuthorizationServiceException.java +++ b/core/src/main/java/org/springframework/security/access/AuthorizationServiceException.java @@ -39,10 +39,10 @@ public class AuthorizationServiceException extends AccessDeniedException { * Constructs an AuthorizationServiceException with the specified message * and root cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public AuthorizationServiceException(String msg, Throwable t) { - super(msg, t); + public AuthorizationServiceException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/core/src/main/java/org/springframework/security/access/expression/ExpressionUtils.java b/core/src/main/java/org/springframework/security/access/expression/ExpressionUtils.java index 8a3a272eca..235ca28e9a 100644 --- a/core/src/main/java/org/springframework/security/access/expression/ExpressionUtils.java +++ b/core/src/main/java/org/springframework/security/access/expression/ExpressionUtils.java @@ -25,8 +25,9 @@ public final class ExpressionUtils { try { return expr.getValue(ctx, Boolean.class); } - catch (EvaluationException e) { - throw new IllegalArgumentException("Failed to evaluate expression '" + expr.getExpressionString() + "'", e); + catch (EvaluationException ex) { + throw new IllegalArgumentException("Failed to evaluate expression '" + expr.getExpressionString() + "'", + ex); } } diff --git a/core/src/main/java/org/springframework/security/access/expression/method/ExpressionBasedAnnotationAttributeFactory.java b/core/src/main/java/org/springframework/security/access/expression/method/ExpressionBasedAnnotationAttributeFactory.java index ef49f46259..8cef2cec59 100644 --- a/core/src/main/java/org/springframework/security/access/expression/method/ExpressionBasedAnnotationAttributeFactory.java +++ b/core/src/main/java/org/springframework/security/access/expression/method/ExpressionBasedAnnotationAttributeFactory.java @@ -54,8 +54,8 @@ public class ExpressionBasedAnnotationAttributeFactory implements PrePostInvocat : parser.parseExpression(preFilterAttribute); return new PreInvocationExpressionAttribute(preFilterExpression, filterObject, preAuthorizeExpression); } - catch (ParseException e) { - throw new IllegalArgumentException("Failed to parse expression '" + e.getExpressionString() + "'", e); + catch (ParseException ex) { + throw new IllegalArgumentException("Failed to parse expression '" + ex.getExpressionString() + "'", ex); } } @@ -73,8 +73,8 @@ public class ExpressionBasedAnnotationAttributeFactory implements PrePostInvocat return new PostInvocationExpressionAttribute(postFilterExpression, postAuthorizeExpression); } } - catch (ParseException e) { - throw new IllegalArgumentException("Failed to parse expression '" + e.getExpressionString() + "'", e); + catch (ParseException ex) { + throw new IllegalArgumentException("Failed to parse expression '" + ex.getExpressionString() + "'", ex); } return null; diff --git a/core/src/main/java/org/springframework/security/authentication/AccountExpiredException.java b/core/src/main/java/org/springframework/security/authentication/AccountExpiredException.java index b5a3c17062..e8ef659882 100644 --- a/core/src/main/java/org/springframework/security/authentication/AccountExpiredException.java +++ b/core/src/main/java/org/springframework/security/authentication/AccountExpiredException.java @@ -36,10 +36,10 @@ public class AccountExpiredException extends AccountStatusException { * Constructs a AccountExpiredException with the specified message and * root cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public AccountExpiredException(String msg, Throwable t) { - super(msg, t); + public AccountExpiredException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/core/src/main/java/org/springframework/security/authentication/AccountStatusException.java b/core/src/main/java/org/springframework/security/authentication/AccountStatusException.java index 56e6daa30b..59c68fe553 100644 --- a/core/src/main/java/org/springframework/security/authentication/AccountStatusException.java +++ b/core/src/main/java/org/springframework/security/authentication/AccountStatusException.java @@ -29,8 +29,8 @@ public abstract class AccountStatusException extends AuthenticationException { super(msg); } - public AccountStatusException(String msg, Throwable t) { - super(msg, t); + public AccountStatusException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/core/src/main/java/org/springframework/security/authentication/AuthenticationCredentialsNotFoundException.java b/core/src/main/java/org/springframework/security/authentication/AuthenticationCredentialsNotFoundException.java index 7224110fb0..91b5d616d8 100644 --- a/core/src/main/java/org/springframework/security/authentication/AuthenticationCredentialsNotFoundException.java +++ b/core/src/main/java/org/springframework/security/authentication/AuthenticationCredentialsNotFoundException.java @@ -41,10 +41,10 @@ public class AuthenticationCredentialsNotFoundException extends AuthenticationEx * Constructs an AuthenticationCredentialsNotFoundException with the * specified message and root cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public AuthenticationCredentialsNotFoundException(String msg, Throwable t) { - super(msg, t); + public AuthenticationCredentialsNotFoundException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/core/src/main/java/org/springframework/security/authentication/AuthenticationServiceException.java b/core/src/main/java/org/springframework/security/authentication/AuthenticationServiceException.java index b87f01d647..69d7233bdf 100644 --- a/core/src/main/java/org/springframework/security/authentication/AuthenticationServiceException.java +++ b/core/src/main/java/org/springframework/security/authentication/AuthenticationServiceException.java @@ -42,10 +42,10 @@ public class AuthenticationServiceException extends AuthenticationException { * Constructs an AuthenticationServiceException with the specified * message and root cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public AuthenticationServiceException(String msg, Throwable t) { - super(msg, t); + public AuthenticationServiceException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/core/src/main/java/org/springframework/security/authentication/BadCredentialsException.java b/core/src/main/java/org/springframework/security/authentication/BadCredentialsException.java index 6f8dc3d485..e202ef7b5a 100644 --- a/core/src/main/java/org/springframework/security/authentication/BadCredentialsException.java +++ b/core/src/main/java/org/springframework/security/authentication/BadCredentialsException.java @@ -38,10 +38,10 @@ public class BadCredentialsException extends AuthenticationException { * Constructs a BadCredentialsException with the specified message and * root cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public BadCredentialsException(String msg, Throwable t) { - super(msg, t); + public BadCredentialsException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/core/src/main/java/org/springframework/security/authentication/CredentialsExpiredException.java b/core/src/main/java/org/springframework/security/authentication/CredentialsExpiredException.java index 0387996518..8e532169ae 100644 --- a/core/src/main/java/org/springframework/security/authentication/CredentialsExpiredException.java +++ b/core/src/main/java/org/springframework/security/authentication/CredentialsExpiredException.java @@ -36,10 +36,10 @@ public class CredentialsExpiredException extends AccountStatusException { * Constructs a CredentialsExpiredException with the specified message * and root cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public CredentialsExpiredException(String msg, Throwable t) { - super(msg, t); + public CredentialsExpiredException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/core/src/main/java/org/springframework/security/authentication/DefaultAuthenticationEventPublisher.java b/core/src/main/java/org/springframework/security/authentication/DefaultAuthenticationEventPublisher.java index 50b5ffffea..6b4a344daa 100644 --- a/core/src/main/java/org/springframework/security/authentication/DefaultAuthenticationEventPublisher.java +++ b/core/src/main/java/org/springframework/security/authentication/DefaultAuthenticationEventPublisher.java @@ -155,7 +155,7 @@ public class DefaultAuthenticationEventPublisher Assert.isAssignable(AbstractAuthenticationFailureEvent.class, clazz); addMapping((String) exceptionClass, (Class) clazz); } - catch (ClassNotFoundException e) { + catch (ClassNotFoundException ex) { throw new RuntimeException("Failed to load authentication event class " + eventClass); } } @@ -194,7 +194,7 @@ public class DefaultAuthenticationEventPublisher this.defaultAuthenticationFailureEventConstructor = defaultAuthenticationFailureEventClass .getConstructor(Authentication.class, AuthenticationException.class); } - catch (NoSuchMethodException e) { + catch (NoSuchMethodException ex) { throw new RuntimeException("Default Authentication Failure event class " + defaultAuthenticationFailureEventClass.getName() + " has no suitable constructor"); } @@ -206,7 +206,7 @@ public class DefaultAuthenticationEventPublisher .getConstructor(Authentication.class, AuthenticationException.class); this.exceptionMappings.put(exceptionClass, constructor); } - catch (NoSuchMethodException e) { + catch (NoSuchMethodException ex) { throw new RuntimeException( "Authentication event class " + eventClass.getName() + " has no suitable constructor"); } diff --git a/core/src/main/java/org/springframework/security/authentication/DisabledException.java b/core/src/main/java/org/springframework/security/authentication/DisabledException.java index bb87e72f6f..31a75ce0cc 100644 --- a/core/src/main/java/org/springframework/security/authentication/DisabledException.java +++ b/core/src/main/java/org/springframework/security/authentication/DisabledException.java @@ -36,10 +36,10 @@ public class DisabledException extends AccountStatusException { * Constructs a DisabledException with the specified message and root * cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public DisabledException(String msg, Throwable t) { - super(msg, t); + public DisabledException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/core/src/main/java/org/springframework/security/authentication/InsufficientAuthenticationException.java b/core/src/main/java/org/springframework/security/authentication/InsufficientAuthenticationException.java index 34f84ca351..0e072b527a 100644 --- a/core/src/main/java/org/springframework/security/authentication/InsufficientAuthenticationException.java +++ b/core/src/main/java/org/springframework/security/authentication/InsufficientAuthenticationException.java @@ -46,10 +46,10 @@ public class InsufficientAuthenticationException extends AuthenticationException * Constructs an InsufficientAuthenticationException with the specified * message and root cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public InsufficientAuthenticationException(String msg, Throwable t) { - super(msg, t); + public InsufficientAuthenticationException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/core/src/main/java/org/springframework/security/authentication/LockedException.java b/core/src/main/java/org/springframework/security/authentication/LockedException.java index f0aa3b5231..9b2272b08f 100644 --- a/core/src/main/java/org/springframework/security/authentication/LockedException.java +++ b/core/src/main/java/org/springframework/security/authentication/LockedException.java @@ -36,10 +36,10 @@ public class LockedException extends AccountStatusException { * Constructs a LockedException with the specified message and root * cause. * @param msg the detail message. - * @param t root cause + * @param cause root cause */ - public LockedException(String msg, Throwable t) { - super(msg, t); + public LockedException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/core/src/main/java/org/springframework/security/authentication/ProviderManager.java b/core/src/main/java/org/springframework/security/authentication/ProviderManager.java index d7054dd37d..8d6bcce375 100644 --- a/core/src/main/java/org/springframework/security/authentication/ProviderManager.java +++ b/core/src/main/java/org/springframework/security/authentication/ProviderManager.java @@ -188,14 +188,14 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar break; } } - catch (AccountStatusException | InternalAuthenticationServiceException e) { - prepareException(e, authentication); + catch (AccountStatusException | InternalAuthenticationServiceException ex) { + prepareException(ex, authentication); // SEC-546: Avoid polling additional providers if auth failure is due to // invalid account status - throw e; + throw ex; } - catch (AuthenticationException e) { - lastException = e; + catch (AuthenticationException ex) { + lastException = ex; } } @@ -205,15 +205,15 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar parentResult = this.parent.authenticate(authentication); result = parentResult; } - catch (ProviderNotFoundException e) { + catch (ProviderNotFoundException ex) { // ignore as we will throw below if no other exception occurred prior to // calling parent and the parent // may throw ProviderNotFound even though a provider in the child already // handled the request } - catch (AuthenticationException e) { - parentException = e; - lastException = e; + catch (AuthenticationException ex) { + parentException = ex; + lastException = ex; } } diff --git a/core/src/main/java/org/springframework/security/authentication/jaas/AbstractJaasAuthenticationProvider.java b/core/src/main/java/org/springframework/security/authentication/jaas/AbstractJaasAuthenticationProvider.java index 9d6e36907d..1b801f22b7 100644 --- a/core/src/main/java/org/springframework/security/authentication/jaas/AbstractJaasAuthenticationProvider.java +++ b/core/src/main/java/org/springframework/security/authentication/jaas/AbstractJaasAuthenticationProvider.java @@ -256,8 +256,8 @@ public abstract class AbstractJaasAuthenticationProvider implements Authenticati + "The LoginContext is unavailable"); } } - catch (LoginException e) { - this.log.warn("Error error logging out of LoginContext", e); + catch (LoginException ex) { + this.log.warn("Error error logging out of LoginContext", ex); } } } diff --git a/core/src/main/java/org/springframework/security/authentication/jaas/DefaultLoginExceptionResolver.java b/core/src/main/java/org/springframework/security/authentication/jaas/DefaultLoginExceptionResolver.java index f106e4f6e7..5b5a261a44 100644 --- a/core/src/main/java/org/springframework/security/authentication/jaas/DefaultLoginExceptionResolver.java +++ b/core/src/main/java/org/springframework/security/authentication/jaas/DefaultLoginExceptionResolver.java @@ -30,8 +30,8 @@ import org.springframework.security.core.AuthenticationException; public class DefaultLoginExceptionResolver implements LoginExceptionResolver { @Override - public AuthenticationException resolveException(LoginException e) { - return new AuthenticationServiceException(e.getMessage(), e); + public AuthenticationException resolveException(LoginException ex) { + return new AuthenticationServiceException(ex.getMessage(), ex); } } diff --git a/core/src/main/java/org/springframework/security/authentication/jaas/JaasAuthenticationProvider.java b/core/src/main/java/org/springframework/security/authentication/jaas/JaasAuthenticationProvider.java index b458ddefd4..f5b20e8653 100644 --- a/core/src/main/java/org/springframework/security/authentication/jaas/JaasAuthenticationProvider.java +++ b/core/src/main/java/org/springframework/security/authentication/jaas/JaasAuthenticationProvider.java @@ -223,7 +223,7 @@ public class JaasAuthenticationProvider extends AbstractJaasAuthenticationProvid return new URL("file", "", loginConfigPath).toString(); } - catch (IOException e) { + catch (IOException ex) { // SEC-1700: May be inside a jar return this.loginConfig.getURL().toString(); } diff --git a/core/src/main/java/org/springframework/security/authentication/jaas/LoginExceptionResolver.java b/core/src/main/java/org/springframework/security/authentication/jaas/LoginExceptionResolver.java index e086ef35a0..cdaaed8dfa 100644 --- a/core/src/main/java/org/springframework/security/authentication/jaas/LoginExceptionResolver.java +++ b/core/src/main/java/org/springframework/security/authentication/jaas/LoginExceptionResolver.java @@ -34,10 +34,10 @@ public interface LoginExceptionResolver { /** * Translates a Jaas LoginException to an SpringSecurityException. - * @param e The LoginException thrown by the configured LoginModule. + * @param ex The LoginException thrown by the configured LoginModule. * @return The AuthenticationException that the JaasAuthenticationProvider should * throw. */ - AuthenticationException resolveException(LoginException e); + AuthenticationException resolveException(LoginException ex); } diff --git a/core/src/main/java/org/springframework/security/converter/RsaKeyConverters.java b/core/src/main/java/org/springframework/security/converter/RsaKeyConverters.java index 94526af4f3..bf63a85819 100644 --- a/core/src/main/java/org/springframework/security/converter/RsaKeyConverters.java +++ b/core/src/main/java/org/springframework/security/converter/RsaKeyConverters.java @@ -82,8 +82,8 @@ public class RsaKeyConverters { try { return (RSAPrivateKey) keyFactory.generatePrivate(new PKCS8EncodedKeySpec(pkcs8)); } - catch (Exception e) { - throw new IllegalArgumentException(e); + catch (Exception ex) { + throw new IllegalArgumentException(ex); } }; } @@ -115,8 +115,8 @@ public class RsaKeyConverters { try { return (RSAPublicKey) keyFactory.generatePublic(new X509EncodedKeySpec(x509)); } - catch (Exception e) { - throw new IllegalArgumentException(e); + catch (Exception ex) { + throw new IllegalArgumentException(ex); } }; } @@ -130,8 +130,8 @@ public class RsaKeyConverters { try { return KeyFactory.getInstance("RSA"); } - catch (NoSuchAlgorithmException e) { - throw new IllegalStateException(e); + catch (NoSuchAlgorithmException ex) { + throw new IllegalStateException(ex); } } diff --git a/core/src/main/java/org/springframework/security/core/AuthenticationException.java b/core/src/main/java/org/springframework/security/core/AuthenticationException.java index 4826756b39..e634738b69 100644 --- a/core/src/main/java/org/springframework/security/core/AuthenticationException.java +++ b/core/src/main/java/org/springframework/security/core/AuthenticationException.java @@ -28,10 +28,10 @@ public abstract class AuthenticationException extends RuntimeException { * Constructs an {@code AuthenticationException} with the specified message and root * cause. * @param msg the detail message - * @param t the root cause + * @param cause the root cause */ - public AuthenticationException(String msg, Throwable t) { - super(msg, t); + public AuthenticationException(String msg, Throwable cause) { + super(msg, cause); } /** diff --git a/core/src/main/java/org/springframework/security/core/SpringSecurityCoreVersion.java b/core/src/main/java/org/springframework/security/core/SpringSecurityCoreVersion.java index 775298ce1f..fbe5526e5c 100644 --- a/core/src/main/java/org/springframework/security/core/SpringSecurityCoreVersion.java +++ b/core/src/main/java/org/springframework/security/core/SpringSecurityCoreVersion.java @@ -108,7 +108,7 @@ public class SpringSecurityCoreVersion { properties.load(SpringSecurityCoreVersion.class.getClassLoader() .getResourceAsStream("META-INF/spring-security.versions")); } - catch (IOException | NullPointerException e) { + catch (IOException | NullPointerException ex) { return null; } return properties.getProperty("org.springframework:spring-core"); diff --git a/core/src/main/java/org/springframework/security/core/token/Sha512DigestUtils.java b/core/src/main/java/org/springframework/security/core/token/Sha512DigestUtils.java index a2c16a14fa..a34998f6b9 100644 --- a/core/src/main/java/org/springframework/security/core/token/Sha512DigestUtils.java +++ b/core/src/main/java/org/springframework/security/core/token/Sha512DigestUtils.java @@ -43,8 +43,8 @@ public abstract class Sha512DigestUtils { try { return MessageDigest.getInstance("SHA-512"); } - catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e.getMessage()); + catch (NoSuchAlgorithmException ex) { + throw new RuntimeException(ex.getMessage()); } } diff --git a/core/src/main/java/org/springframework/security/core/userdetails/UsernameNotFoundException.java b/core/src/main/java/org/springframework/security/core/userdetails/UsernameNotFoundException.java index 2894852d33..22c3c1d8e5 100644 --- a/core/src/main/java/org/springframework/security/core/userdetails/UsernameNotFoundException.java +++ b/core/src/main/java/org/springframework/security/core/userdetails/UsernameNotFoundException.java @@ -38,10 +38,10 @@ public class UsernameNotFoundException extends AuthenticationException { * Constructs a {@code UsernameNotFoundException} with the specified message and root * cause. * @param msg the detail message. - * @param t root cause + * @param cause root cause */ - public UsernameNotFoundException(String msg, Throwable t) { - super(msg, t); + public UsernameNotFoundException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/core/src/main/java/org/springframework/security/jackson2/SecurityJackson2Modules.java b/core/src/main/java/org/springframework/security/jackson2/SecurityJackson2Modules.java index a4b4c9cf3c..03e24ae4a7 100644 --- a/core/src/main/java/org/springframework/security/jackson2/SecurityJackson2Modules.java +++ b/core/src/main/java/org/springframework/security/jackson2/SecurityJackson2Modules.java @@ -107,9 +107,9 @@ public final class SecurityJackson2Modules { instance = securityModule.newInstance(); } } - catch (Exception e) { + catch (Exception ex) { if (logger.isDebugEnabled()) { - logger.debug("Cannot load module " + className, e); + logger.debug("Cannot load module " + className, ex); } } return instance; diff --git a/core/src/main/java/org/springframework/security/util/MethodInvocationUtils.java b/core/src/main/java/org/springframework/security/util/MethodInvocationUtils.java index 01fd674677..ef05c2d84f 100644 --- a/core/src/main/java/org/springframework/security/util/MethodInvocationUtils.java +++ b/core/src/main/java/org/springframework/security/util/MethodInvocationUtils.java @@ -137,7 +137,7 @@ public final class MethodInvocationUtils { try { method = clazz.getMethod(methodName, classArgs); } - catch (NoSuchMethodException e) { + catch (NoSuchMethodException ex) { return null; } 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 9182ec5214..986d1dc92c 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 @@ -117,21 +117,21 @@ public class RoleHierarchyImplTests { roleHierarchyImpl.setHierarchy("ROLE_A > ROLE_A"); fail("Cycle in role hierarchy was not detected!"); } - catch (CycleInRoleHierarchyException e) { + catch (CycleInRoleHierarchyException ex) { } try { roleHierarchyImpl.setHierarchy("ROLE_A > ROLE_B\nROLE_B > ROLE_A"); fail("Cycle in role hierarchy was not detected!"); } - catch (CycleInRoleHierarchyException e) { + catch (CycleInRoleHierarchyException ex) { } try { roleHierarchyImpl.setHierarchy("ROLE_A > ROLE_B\nROLE_B > ROLE_C\nROLE_C > ROLE_A"); fail("Cycle in role hierarchy was not detected!"); } - catch (CycleInRoleHierarchyException e) { + catch (CycleInRoleHierarchyException ex) { } try { @@ -139,14 +139,14 @@ public class RoleHierarchyImplTests { "ROLE_A > ROLE_B\nROLE_B > ROLE_C\nROLE_C > ROLE_E\nROLE_E > ROLE_D\nROLE_D > ROLE_B"); fail("Cycle in role hierarchy was not detected!"); } - catch (CycleInRoleHierarchyException e) { + catch (CycleInRoleHierarchyException ex) { } try { roleHierarchyImpl.setHierarchy("ROLE_C > ROLE_B\nROLE_B > ROLE_A\nROLE_A > ROLE_B"); fail("Cycle in role hierarchy was not detected!"); } - catch (CycleInRoleHierarchyException e) { + catch (CycleInRoleHierarchyException ex) { } } @@ -157,7 +157,7 @@ public class RoleHierarchyImplTests { try { roleHierarchyImpl.setHierarchy("ROLE_A > ROLE_B\nROLE_A > ROLE_C\nROLE_C > ROLE_D\nROLE_B > ROLE_D"); } - catch (CycleInRoleHierarchyException e) { + catch (CycleInRoleHierarchyException ex) { fail("A cycle in role hierarchy was incorrectly detected!"); } } diff --git a/core/src/test/java/org/springframework/security/authentication/ProviderManagerTests.java b/core/src/test/java/org/springframework/security/authentication/ProviderManagerTests.java index f8616313af..711ffccfac 100644 --- a/core/src/test/java/org/springframework/security/authentication/ProviderManagerTests.java +++ b/core/src/test/java/org/springframework/security/authentication/ProviderManagerTests.java @@ -271,8 +271,8 @@ public class ProviderManagerTests { mgr.authenticate(authReq); fail("Expected exception"); } - catch (BadCredentialsException e) { - assertThat(e).isSameAs(expected); + catch (BadCredentialsException ex) { + assertThat(ex).isSameAs(expected); } } @@ -289,8 +289,8 @@ public class ProviderManagerTests { mgr.authenticate(authReq); fail("Expected exception"); } - catch (LockedException e) { - assertThat(e).isSameAs(expected); + catch (LockedException ex) { + assertThat(ex).isSameAs(expected); } verify(publisher).publishAuthenticationFailure(expected, authReq); } @@ -329,18 +329,18 @@ public class ProviderManagerTests { childMgr.authenticate(authReq); fail("Expected exception"); } - catch (BadCredentialsException e) { - assertThat(e).isSameAs(badCredentialsExParent); + catch (BadCredentialsException ex) { + assertThat(ex).isSameAs(badCredentialsExParent); } verify(publisher).publishAuthenticationFailure(badCredentialsExParent, authReq); // Parent // publishes verifyNoMoreInteractions(publisher); // Child should not publish (duplicate event) } - private AuthenticationProvider createProviderWhichThrows(final AuthenticationException e) { + private AuthenticationProvider createProviderWhichThrows(final AuthenticationException ex) { AuthenticationProvider provider = mock(AuthenticationProvider.class); given(provider.supports(any(Class.class))).willReturn(true); - given(provider.authenticate(any(Authentication.class))).willThrow(e); + given(provider.authenticate(any(Authentication.class))).willThrow(ex); return provider; } diff --git a/core/src/test/java/org/springframework/security/authentication/jaas/JaasAuthenticationProviderTests.java b/core/src/test/java/org/springframework/security/authentication/jaas/JaasAuthenticationProviderTests.java index 4fd27e898b..cf7f5681e4 100644 --- a/core/src/test/java/org/springframework/security/authentication/jaas/JaasAuthenticationProviderTests.java +++ b/core/src/test/java/org/springframework/security/authentication/jaas/JaasAuthenticationProviderTests.java @@ -77,7 +77,7 @@ public class JaasAuthenticationProviderTests { this.jaasProvider.authenticate(new UsernamePasswordAuthenticationToken("user", "asdf")); fail("LoginException should have been thrown for the bad password"); } - catch (AuthenticationException e) { + catch (AuthenticationException ex) { } assertThat(this.eventCheck.failedEvent).as("Failure event not fired").isNotNull(); @@ -92,7 +92,7 @@ public class JaasAuthenticationProviderTests { this.jaasProvider.authenticate(new UsernamePasswordAuthenticationToken("asdf", "password")); fail("LoginException should have been thrown for the bad user"); } - catch (AuthenticationException e) { + catch (AuthenticationException ex) { } assertThat(this.eventCheck.failedEvent).as("Failure event not fired").isNotNull(); @@ -241,9 +241,9 @@ public class JaasAuthenticationProviderTests { try { this.jaasProvider.authenticate(new UsernamePasswordAuthenticationToken("user", "password")); } - catch (LockedException e) { + catch (LockedException ex) { } - catch (Exception e) { + catch (Exception ex) { fail("LockedException should have been thrown and caught"); } } diff --git a/core/src/test/java/org/springframework/security/authentication/jaas/SecurityContextLoginModuleTests.java b/core/src/test/java/org/springframework/security/authentication/jaas/SecurityContextLoginModuleTests.java index dd992af4b0..3f27e71d85 100644 --- a/core/src/test/java/org/springframework/security/authentication/jaas/SecurityContextLoginModuleTests.java +++ b/core/src/test/java/org/springframework/security/authentication/jaas/SecurityContextLoginModuleTests.java @@ -75,7 +75,7 @@ public class SecurityContextLoginModuleTests { this.module.login(); fail("LoginException expected, there is no Authentication in the SecurityContext"); } - catch (LoginException e) { + catch (LoginException ex) { } } @@ -107,7 +107,7 @@ public class SecurityContextLoginModuleTests { this.module.login(); fail("LoginException expected, the authentication is null in the SecurityContext"); } - catch (Exception e) { + catch (Exception ex) { } } diff --git a/core/src/test/java/org/springframework/security/authentication/jaas/TestLoginModule.java b/core/src/test/java/org/springframework/security/authentication/jaas/TestLoginModule.java index c6aaf08ac7..ab0d94fe90 100644 --- a/core/src/test/java/org/springframework/security/authentication/jaas/TestLoginModule.java +++ b/core/src/test/java/org/springframework/security/authentication/jaas/TestLoginModule.java @@ -63,8 +63,8 @@ public class TestLoginModule implements LoginModule { this.password = new String(passwordCallback.getPassword()); this.user = nameCallback.getName(); } - catch (Exception e) { - throw new RuntimeException(e); + catch (Exception ex) { + throw new RuntimeException(ex); } } diff --git a/core/src/test/java/org/springframework/security/core/token/KeyBasedPersistenceTokenServiceTests.java b/core/src/test/java/org/springframework/security/core/token/KeyBasedPersistenceTokenServiceTests.java index 90fb209572..dacc3678c5 100644 --- a/core/src/test/java/org/springframework/security/core/token/KeyBasedPersistenceTokenServiceTests.java +++ b/core/src/test/java/org/springframework/security/core/token/KeyBasedPersistenceTokenServiceTests.java @@ -40,8 +40,8 @@ public class KeyBasedPersistenceTokenServiceTests { service.setSecureRandom(rnd); service.afterPropertiesSet(); } - catch (Exception e) { - throw new RuntimeException(e); + catch (Exception ex) { + throw new RuntimeException(ex); } return service; } diff --git a/crypto/src/main/java/org/springframework/security/crypto/argon2/Argon2PasswordEncoder.java b/crypto/src/main/java/org/springframework/security/crypto/argon2/Argon2PasswordEncoder.java index 75cf6b3202..cca1800628 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/argon2/Argon2PasswordEncoder.java +++ b/crypto/src/main/java/org/springframework/security/crypto/argon2/Argon2PasswordEncoder.java @@ -107,8 +107,8 @@ public class Argon2PasswordEncoder implements PasswordEncoder { try { decoded = Argon2EncodingUtils.decode(encodedPassword); } - catch (IllegalArgumentException e) { - this.logger.warn("Malformed password hash", e); + catch (IllegalArgumentException ex) { + this.logger.warn("Malformed password hash", ex); return false; } diff --git a/crypto/src/main/java/org/springframework/security/crypto/codec/Base64.java b/crypto/src/main/java/org/springframework/security/crypto/codec/Base64.java index b29021dc07..366b380a96 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/codec/Base64.java +++ b/crypto/src/main/java/org/springframework/security/crypto/codec/Base64.java @@ -248,7 +248,7 @@ public final class Base64 { try { decode(bytes); } - catch (InvalidBase64CharacterException e) { + catch (InvalidBase64CharacterException ex) { return false; } return true; diff --git a/crypto/src/main/java/org/springframework/security/crypto/codec/Utf8.java b/crypto/src/main/java/org/springframework/security/crypto/codec/Utf8.java index b82bcdce66..1a926e3985 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/codec/Utf8.java +++ b/crypto/src/main/java/org/springframework/security/crypto/codec/Utf8.java @@ -43,8 +43,8 @@ public final class Utf8 { return bytesCopy; } - catch (CharacterCodingException e) { - throw new IllegalArgumentException("Encoding failed", e); + catch (CharacterCodingException ex) { + throw new IllegalArgumentException("Encoding failed", ex); } } @@ -55,8 +55,8 @@ public final class Utf8 { try { return CHARSET.newDecoder().decode(ByteBuffer.wrap(bytes)).toString(); } - catch (CharacterCodingException e) { - throw new IllegalArgumentException("Decoding failed", e); + catch (CharacterCodingException ex) { + throw new IllegalArgumentException("Decoding failed", ex); } } diff --git a/crypto/src/main/java/org/springframework/security/crypto/encrypt/BouncyCastleAesCbcBytesEncryptor.java b/crypto/src/main/java/org/springframework/security/crypto/encrypt/BouncyCastleAesCbcBytesEncryptor.java index 62b51b2afe..24896cc71e 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/encrypt/BouncyCastleAesCbcBytesEncryptor.java +++ b/crypto/src/main/java/org/springframework/security/crypto/encrypt/BouncyCastleAesCbcBytesEncryptor.java @@ -74,8 +74,8 @@ public class BouncyCastleAesCbcBytesEncryptor extends BouncyCastleAesBytesEncryp try { bytesWritten += blockCipher.doFinal(buf, bytesWritten); } - catch (InvalidCipherTextException e) { - throw new IllegalStateException("unable to encrypt/decrypt", e); + catch (InvalidCipherTextException ex) { + throw new IllegalStateException("unable to encrypt/decrypt", ex); } if (bytesWritten == buf.length) { return buf; diff --git a/crypto/src/main/java/org/springframework/security/crypto/encrypt/BouncyCastleAesGcmBytesEncryptor.java b/crypto/src/main/java/org/springframework/security/crypto/encrypt/BouncyCastleAesGcmBytesEncryptor.java index 46fcc569a1..cef2d1f977 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/encrypt/BouncyCastleAesGcmBytesEncryptor.java +++ b/crypto/src/main/java/org/springframework/security/crypto/encrypt/BouncyCastleAesGcmBytesEncryptor.java @@ -71,8 +71,8 @@ public class BouncyCastleAesGcmBytesEncryptor extends BouncyCastleAesBytesEncryp try { bytesWritten += blockCipher.doFinal(buf, bytesWritten); } - catch (InvalidCipherTextException e) { - throw new IllegalStateException("unable to encrypt/decrypt", e); + catch (InvalidCipherTextException ex) { + throw new IllegalStateException("unable to encrypt/decrypt", ex); } if (bytesWritten == buf.length) { return buf; diff --git a/crypto/src/main/java/org/springframework/security/crypto/encrypt/CipherUtils.java b/crypto/src/main/java/org/springframework/security/crypto/encrypt/CipherUtils.java index 753a7b535f..e1a3666115 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/encrypt/CipherUtils.java +++ b/crypto/src/main/java/org/springframework/security/crypto/encrypt/CipherUtils.java @@ -56,11 +56,11 @@ final class CipherUtils { SecretKeyFactory factory = SecretKeyFactory.getInstance(algorithm); return factory.generateSecret(keySpec); } - catch (NoSuchAlgorithmException e) { - throw new IllegalArgumentException("Not a valid encryption algorithm", e); + catch (NoSuchAlgorithmException ex) { + throw new IllegalArgumentException("Not a valid encryption algorithm", ex); } - catch (InvalidKeySpecException e) { - throw new IllegalArgumentException("Not a valid secret key", e); + catch (InvalidKeySpecException ex) { + throw new IllegalArgumentException("Not a valid secret key", ex); } } @@ -71,11 +71,11 @@ final class CipherUtils { try { return Cipher.getInstance(algorithm); } - catch (NoSuchAlgorithmException e) { - throw new IllegalArgumentException("Not a valid encryption algorithm", e); + catch (NoSuchAlgorithmException ex) { + throw new IllegalArgumentException("Not a valid encryption algorithm", ex); } - catch (NoSuchPaddingException e) { - throw new IllegalStateException("Should not happen", e); + catch (NoSuchPaddingException ex) { + throw new IllegalStateException("Should not happen", ex); } } @@ -86,8 +86,8 @@ final class CipherUtils { try { return cipher.getParameters().getParameterSpec(parameterSpecClass); } - catch (InvalidParameterSpecException e) { - throw new IllegalArgumentException("Unable to access parameter", e); + catch (InvalidParameterSpecException ex) { + throw new IllegalArgumentException("Unable to access parameter", ex); } } @@ -117,11 +117,11 @@ final class CipherUtils { cipher.init(mode, secretKey); } } - catch (InvalidKeyException e) { - throw new IllegalArgumentException("Unable to initialize due to invalid secret key", e); + catch (InvalidKeyException ex) { + throw new IllegalArgumentException("Unable to initialize due to invalid secret key", ex); } - catch (InvalidAlgorithmParameterException e) { - throw new IllegalStateException("Unable to initialize due to invalid decryption parameter spec", e); + catch (InvalidAlgorithmParameterException ex) { + throw new IllegalStateException("Unable to initialize due to invalid decryption parameter spec", ex); } } @@ -133,11 +133,11 @@ final class CipherUtils { try { return cipher.doFinal(input); } - catch (IllegalBlockSizeException e) { - throw new IllegalStateException("Unable to invoke Cipher due to illegal block size", e); + catch (IllegalBlockSizeException ex) { + throw new IllegalStateException("Unable to invoke Cipher due to illegal block size", ex); } - catch (BadPaddingException e) { - throw new IllegalStateException("Unable to invoke Cipher due to bad padding", e); + catch (BadPaddingException ex) { + throw new IllegalStateException("Unable to invoke Cipher due to bad padding", ex); } } diff --git a/crypto/src/main/java/org/springframework/security/crypto/password/Digester.java b/crypto/src/main/java/org/springframework/security/crypto/password/Digester.java index 7e4755512c..5add570e41 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/password/Digester.java +++ b/crypto/src/main/java/org/springframework/security/crypto/password/Digester.java @@ -64,8 +64,8 @@ final class Digester { try { return MessageDigest.getInstance(algorithm); } - catch (NoSuchAlgorithmException e) { - throw new IllegalStateException("No such hashing algorithm", e); + catch (NoSuchAlgorithmException ex) { + throw new IllegalStateException("No such hashing algorithm", ex); } } diff --git a/crypto/src/main/java/org/springframework/security/crypto/password/LdapShaPasswordEncoder.java b/crypto/src/main/java/org/springframework/security/crypto/password/LdapShaPasswordEncoder.java index d5f42a92ad..8e0a7ec7de 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/password/LdapShaPasswordEncoder.java +++ b/crypto/src/main/java/org/springframework/security/crypto/password/LdapShaPasswordEncoder.java @@ -104,7 +104,7 @@ public class LdapShaPasswordEncoder implements PasswordEncoder { sha = MessageDigest.getInstance("SHA"); sha.update(Utf8.encode(rawPassword)); } - catch (java.security.NoSuchAlgorithmException e) { + catch (java.security.NoSuchAlgorithmException ex) { throw new IllegalStateException("No SHA implementation available!"); } diff --git a/crypto/src/main/java/org/springframework/security/crypto/password/Pbkdf2PasswordEncoder.java b/crypto/src/main/java/org/springframework/security/crypto/password/Pbkdf2PasswordEncoder.java index 2b4f5465fe..f777424072 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/password/Pbkdf2PasswordEncoder.java +++ b/crypto/src/main/java/org/springframework/security/crypto/password/Pbkdf2PasswordEncoder.java @@ -112,8 +112,8 @@ public class Pbkdf2PasswordEncoder implements PasswordEncoder { try { SecretKeyFactory.getInstance(algorithmName); } - catch (NoSuchAlgorithmException e) { - throw new IllegalArgumentException("Invalid algorithm '" + algorithmName + "'.", e); + catch (NoSuchAlgorithmException ex) { + throw new IllegalArgumentException("Invalid algorithm '" + algorithmName + "'.", ex); } this.algorithm = algorithmName; } @@ -163,8 +163,8 @@ public class Pbkdf2PasswordEncoder implements PasswordEncoder { SecretKeyFactory skf = SecretKeyFactory.getInstance(this.algorithm); return EncodingUtils.concatenate(salt, skf.generateSecret(spec).getEncoded()); } - catch (GeneralSecurityException e) { - throw new IllegalStateException("Could not create hash", e); + catch (GeneralSecurityException ex) { + throw new IllegalStateException("Could not create hash", ex); } } diff --git a/crypto/src/test/java/org/springframework/security/crypto/encrypt/CryptoAssumptions.java b/crypto/src/test/java/org/springframework/security/crypto/encrypt/CryptoAssumptions.java index 4c238552fd..fc77e011de 100644 --- a/crypto/src/test/java/org/springframework/security/crypto/encrypt/CryptoAssumptions.java +++ b/crypto/src/test/java/org/springframework/security/crypto/encrypt/CryptoAssumptions.java @@ -41,11 +41,11 @@ public class CryptoAssumptions { Cipher.getInstance(cipherAlgorithm.toString()); aes256Available = Cipher.getMaxAllowedKeyLength("AES") >= 256; } - catch (NoSuchAlgorithmException e) { - throw new AssumptionViolatedException(cipherAlgorithm + " not available, skipping test", e); + catch (NoSuchAlgorithmException ex) { + throw new AssumptionViolatedException(cipherAlgorithm + " not available, skipping test", ex); } - catch (NoSuchPaddingException e) { - throw new AssumptionViolatedException(cipherAlgorithm + " padding not available, skipping test", e); + catch (NoSuchPaddingException ex) { + throw new AssumptionViolatedException(cipherAlgorithm + " padding not available, skipping test", ex); } Assume.assumeTrue("AES key length of 256 not allowed, skipping test", aes256Available); diff --git a/docs/manual/src/docs/asciidoc/_includes/reactive/oauth2/resource-server.adoc b/docs/manual/src/docs/asciidoc/_includes/reactive/oauth2/resource-server.adoc index d4c0f5f441..1c774d33f5 100644 --- a/docs/manual/src/docs/asciidoc/_includes/reactive/oauth2/resource-server.adoc +++ b/docs/manual/src/docs/asciidoc/_includes/reactive/oauth2/resource-server.adoc @@ -552,9 +552,9 @@ ReactiveJwtDecoder jwtDecoder() { ---- [[webflux-oauth2resourceserver-opaque-minimaldependencies]] === Minimal Dependencies for Introspection -As described in <> most of Resource Server support is collected in `spring-security-oauth2-resource-server`. -However unless a custom <> is provided, the Resource Server will fallback to ReactiveOpaqueTokenIntrospector. -Meaning that both `spring-security-oauth2-resource-server` and `oauth2-oidc-sdk` are necessary in order to have a working minimal Resource Server that supports opaque Bearer Tokens. +As described in <> most of Resource Server support is collected in `spring-security-oauth2-resource-server`. +However unless a custom <> is provided, the Resource Server will fallback to ReactiveOpaqueTokenIntrospector. +Meaning that both `spring-security-oauth2-resource-server` and `oauth2-oidc-sdk` are necessary in order to have a working minimal Resource Server that supports opaque Bearer Tokens. Please refer to `spring-security-oauth2-resource-server` in order to determin the correct version for `oauth2-oidc-sdk`. [[webflux-oauth2resourceserver-opaque-minimalconfiguration]] @@ -925,8 +925,8 @@ public class JwtOpaqueTokenIntrospector implements ReactiveOpaqueTokenIntrospect public Mono convert(JWT jwt) { try { return Mono.just(jwt.getJWTClaimsSet()); - } catch (Exception e) { - return Mono.error(e); + } catch (Exception ex) { + return Mono.error(ex); } } } diff --git a/docs/manual/src/docs/asciidoc/_includes/servlet/architecture/exception-translation-filter.adoc b/docs/manual/src/docs/asciidoc/_includes/servlet/architecture/exception-translation-filter.adoc index 5fa7ecc452..67cad58ddf 100644 --- a/docs/manual/src/docs/asciidoc/_includes/servlet/architecture/exception-translation-filter.adoc +++ b/docs/manual/src/docs/asciidoc/_includes/servlet/architecture/exception-translation-filter.adoc @@ -36,8 +36,8 @@ The pseudocode for `ExceptionTranslationFilter` looks something like this: ---- try { filterChain.doFilter(request, response); // <1> -} catch (AccessDeniedException | AuthenticationException e) { - if (!authenticated || e instanceof AuthenticationException) { +} catch (AccessDeniedException | AuthenticationException ex) { + if (!authenticated || ex instanceof AuthenticationException) { startAuthentication(); // <2> } else { accessDenied(); // <3> diff --git a/docs/manual/src/docs/asciidoc/_includes/servlet/integrations/servlet-api.adoc b/docs/manual/src/docs/asciidoc/_includes/servlet/integrations/servlet-api.adoc index 9e957f39a0..e57d545c15 100644 --- a/docs/manual/src/docs/asciidoc/_includes/servlet/integrations/servlet-api.adoc +++ b/docs/manual/src/docs/asciidoc/_includes/servlet/integrations/servlet-api.adoc @@ -75,7 +75,7 @@ For example, the following would attempt to authenticate with the username "user ---- try { httpServletRequest.login("user","password"); -} catch(ServletException e) { +} catch(ServletException ex) { // fail to authenticate } ---- @@ -111,8 +111,8 @@ async.start(new Runnable() { asyncResponse.setStatus(HttpServletResponse.SC_OK); asyncResponse.getWriter().write(String.valueOf(authentication)); async.complete(); - } catch(Exception e) { - throw new RuntimeException(e); + } catch(Exception ex) { + throw new RuntimeException(ex); } } }); @@ -174,8 +174,8 @@ new Thread("AsyncThread") { // Write to and commit the httpServletResponse httpServletResponse.getOutputStream().flush(); - } catch (Exception e) { - e.printStackTrace(); + } catch (Exception ex) { + ex.printStackTrace(); } } }.start(); diff --git a/docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-resourceserver.adoc b/docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-resourceserver.adoc index f3844ed84a..42d71a85fc 100644 --- a/docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-resourceserver.adoc +++ b/docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-resourceserver.adoc @@ -1055,9 +1055,9 @@ To do so, remember that `NimbusJwtDecoder` ships with a constructor that takes N [[oauth2resourceserver-opaque-minimaldependencies]] === Minimal Dependencies for Introspection -As described in <> most of Resource Server support is collected in `spring-security-oauth2-resource-server`. -However unless a custom <> is provided, the Resource Server will fallback to NimbusOpaqueTokenIntrospector. -Meaning that both `spring-security-oauth2-resource-server` and `oauth2-oidc-sdk` are necessary in order to have a working minimal Resource Server that supports opaque Bearer Tokens. +As described in <> most of Resource Server support is collected in `spring-security-oauth2-resource-server`. +However unless a custom <> is provided, the Resource Server will fallback to NimbusOpaqueTokenIntrospector. +Meaning that both `spring-security-oauth2-resource-server` and `oauth2-oidc-sdk` are necessary in order to have a working minimal Resource Server that supports opaque Bearer Tokens. Please refer to `spring-security-oauth2-resource-server` in order to determin the correct version for `oauth2-oidc-sdk`. [[oauth2resourceserver-opaque-minimalconfiguration]] @@ -1626,8 +1626,8 @@ public class JwtOpaqueTokenIntrospector implements OpaqueTokenIntrospector { try { Jwt jwt = this.jwtDecoder.decode(token); return new DefaultOAuth2AuthenticatedPrincipal(jwt.getClaims(), NO_AUTHORITIES); - } catch (JwtException e) { - throw new OAuth2IntrospectionException(e); + } catch (JwtException ex) { + throw new OAuth2IntrospectionException(ex); } } @@ -1899,8 +1899,8 @@ public class TenantJWSKeySelector private JWSKeySelector fromUri(String uri) { try { return JWSAlgorithmFamilyJWSKeySelector.fromJWKSetURL(new URL(uri)); <4> - } catch (Exception e) { - throw new IllegalArgumentException(e); + } catch (Exception ex) { + throw new IllegalArgumentException(ex); } } } diff --git a/etc/checkstyle/checkstyle-suppressions.xml b/etc/checkstyle/checkstyle-suppressions.xml index 8a54814b09..3ec4e39adc 100644 --- a/etc/checkstyle/checkstyle-suppressions.xml +++ b/etc/checkstyle/checkstyle-suppressions.xml @@ -3,7 +3,6 @@ "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "https://checkstyle.org/dtds/suppressions_1_2.dtd"> - diff --git a/itest/context/src/main/java/org/springframework/security/integration/python/PythonInterpreterPreInvocationAdvice.java b/itest/context/src/main/java/org/springframework/security/integration/python/PythonInterpreterPreInvocationAdvice.java index 8ae2b7fbd9..69bcb94e8d 100644 --- a/itest/context/src/main/java/org/springframework/security/integration/python/PythonInterpreterPreInvocationAdvice.java +++ b/itest/context/src/main/java/org/springframework/security/integration/python/PythonInterpreterPreInvocationAdvice.java @@ -52,8 +52,8 @@ public class PythonInterpreterPreInvocationAdvice implements PreInvocationAuthor try { python.execfile(scriptResource.getInputStream()); } - catch (IOException e) { - throw new IllegalArgumentException("Couldn't run python script, " + script, e); + catch (IOException ex) { + throw new IllegalArgumentException("Couldn't run python script, " + script, ex); } PyObject allowed = python.get("allow"); diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/DefaultSpringSecurityContextSourceTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/DefaultSpringSecurityContextSourceTests.java index 7465a78637..31844b4587 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/DefaultSpringSecurityContextSourceTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/DefaultSpringSecurityContextSourceTests.java @@ -85,7 +85,7 @@ public class DefaultSpringSecurityContextSourceTests { try { ctx = this.contextSource.getContext("uid=Bob,ou=people,dc=springframework,dc=org", "bobspassword"); } - catch (Exception e) { + catch (Exception ex) { } assertThat(ctx).isNotNull(); // com.sun.jndi.ldap.LdapPoolManager.showStats(System.out); diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSContainerTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSContainerTests.java index eebf38e583..b297fe66cd 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSContainerTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSContainerTests.java @@ -69,12 +69,12 @@ public class ApacheDSContainerTests { try { server1.destroy(); } - catch (Throwable t) { + catch (Throwable ex) { } try { server2.destroy(); } - catch (Throwable t) { + catch (Throwable ex) { } } } @@ -95,12 +95,12 @@ public class ApacheDSContainerTests { try { server1.destroy(); } - catch (Throwable t) { + catch (Throwable ex) { } try { server2.destroy(); } - catch (Throwable t) { + catch (Throwable ex) { } } } @@ -116,8 +116,8 @@ public class ApacheDSContainerTests { server.afterPropertiesSet(); fail("Expected an IllegalArgumentException to be thrown."); } - catch (IllegalArgumentException e) { - assertThat(e).hasMessage("When LdapOverSsl is enabled, the keyStoreFile property must be set."); + catch (IllegalArgumentException ex) { + assertThat(ex).hasMessage("When LdapOverSsl is enabled, the keyStoreFile property must be set."); } } @@ -143,9 +143,9 @@ public class ApacheDSContainerTests { server.afterPropertiesSet(); fail("Expected a RuntimeException to be thrown."); } - catch (RuntimeException e) { - assertThat(e).hasMessage("Server startup failed"); - assertThat(e).hasRootCauseInstanceOf(UnrecoverableKeyException.class); + catch (RuntimeException ex) { + assertThat(ex).hasMessage("Server startup failed"); + assertThat(ex).hasRootCauseInstanceOf(UnrecoverableKeyException.class); } } @@ -187,7 +187,7 @@ public class ApacheDSContainerTests { try { server.destroy(); } - catch (Throwable t) { + catch (Throwable ex) { } } } diff --git a/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerLdifTests.java b/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerLdifTests.java index ef8c2b440f..f9f9ed4441 100644 --- a/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerLdifTests.java +++ b/ldap/src/integration-test/java/org/springframework/security/ldap/server/UnboundIdContainerLdifTests.java @@ -75,9 +75,9 @@ public class UnboundIdContainerLdifTests { this.appCtx = new AnnotationConfigApplicationContext(MalformedLdifConfig.class); failBecauseExceptionWasNotThrown(IllegalStateException.class); } - catch (Exception e) { - assertThat(e.getCause()).isInstanceOf(IllegalStateException.class); - assertThat(e.getMessage()).contains("Unable to load LDIF classpath:test-server-malformed.txt"); + catch (Exception ex) { + assertThat(ex.getCause()).isInstanceOf(IllegalStateException.class); + assertThat(ex.getMessage()).contains("Unable to load LDIF classpath:test-server-malformed.txt"); } } @@ -87,9 +87,9 @@ public class UnboundIdContainerLdifTests { this.appCtx = new AnnotationConfigApplicationContext(MissingLdifConfig.class); failBecauseExceptionWasNotThrown(IllegalStateException.class); } - catch (Exception e) { - assertThat(e.getCause()).isInstanceOf(IllegalStateException.class); - assertThat(e.getMessage()).contains("Unable to load LDIF classpath:does-not-exist.ldif"); + catch (Exception ex) { + assertThat(ex.getCause()).isInstanceOf(IllegalStateException.class); + assertThat(ex.getMessage()).contains("Unable to load LDIF classpath:does-not-exist.ldif"); } } diff --git a/ldap/src/main/java/org/springframework/security/ldap/LdapUtils.java b/ldap/src/main/java/org/springframework/security/ldap/LdapUtils.java index 0f24974075..6bcb430b03 100644 --- a/ldap/src/main/java/org/springframework/security/ldap/LdapUtils.java +++ b/ldap/src/main/java/org/springframework/security/ldap/LdapUtils.java @@ -53,8 +53,8 @@ public final class LdapUtils { ctx.close(); } } - catch (NamingException e) { - logger.error("Failed to close context.", e); + catch (NamingException ex) { + logger.error("Failed to close context.", ex); } } @@ -64,8 +64,8 @@ public final class LdapUtils { ne.close(); } } - catch (NamingException e) { - logger.error("Failed to close enumeration.", e); + catch (NamingException ex) { + logger.error("Failed to close enumeration.", ex); } } @@ -177,9 +177,9 @@ public final class LdapUtils { try { return new URI(url); } - catch (URISyntaxException e) { + catch (URISyntaxException ex) { IllegalArgumentException iae = new IllegalArgumentException("Unable to parse url: " + url); - iae.initCause(e); + iae.initCause(ex); throw iae; } } diff --git a/ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java b/ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java index 5a7465437a..6dcb0ba823 100644 --- a/ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java +++ b/ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java @@ -197,8 +197,8 @@ public class SpringSecurityLdapTemplate extends LdapTemplate { extractStringAttributeValues(adapter, record, attr.getID()); } } - catch (NamingException x) { - org.springframework.ldap.support.LdapUtils.convertLdapException(x); + catch (NamingException ex) { + org.springframework.ldap.support.LdapUtils.convertLdapException(ex); } } else { @@ -316,7 +316,7 @@ public class SpringSecurityLdapTemplate extends LdapTemplate { results.add(dca); } } - catch (PartialResultException e) { + catch (PartialResultException ex) { LdapUtils.closeEnumeration(resultsEnum); logger.info("Ignoring PartialResultException"); } diff --git a/ldap/src/main/java/org/springframework/security/ldap/authentication/BindAuthenticator.java b/ldap/src/main/java/org/springframework/security/ldap/authentication/BindAuthenticator.java index d45b72df7e..ccac1f3822 100644 --- a/ldap/src/main/java/org/springframework/security/ldap/authentication/BindAuthenticator.java +++ b/ldap/src/main/java/org/springframework/security/ldap/authentication/BindAuthenticator.java @@ -127,20 +127,20 @@ public class BindAuthenticator extends AbstractLdapAuthenticator { return result; } - catch (NamingException e) { + catch (NamingException ex) { // This will be thrown if an invalid user name is used and the method may // be called multiple times to try different names, so we trap the exception // unless a subclass wishes to implement more specialized behaviour. - if ((e instanceof org.springframework.ldap.AuthenticationException) - || (e instanceof org.springframework.ldap.OperationNotSupportedException)) { - handleBindException(userDnStr, username, e); + if ((ex instanceof org.springframework.ldap.AuthenticationException) + || (ex instanceof org.springframework.ldap.OperationNotSupportedException)) { + handleBindException(userDnStr, username, ex); } else { - throw e; + throw ex; } } - catch (javax.naming.NamingException e) { - throw LdapUtils.convertLdapException(e); + catch (javax.naming.NamingException ex) { + throw LdapUtils.convertLdapException(ex); } finally { LdapUtils.closeContext(ctx); diff --git a/ldap/src/main/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProvider.java b/ldap/src/main/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProvider.java index baafbe38fd..73a90b0315 100644 --- a/ldap/src/main/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProvider.java +++ b/ldap/src/main/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProvider.java @@ -165,12 +165,12 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends AbstractLda ctx = bindAsUser(username, password); return searchForUser(ctx, username); } - catch (CommunicationException e) { - throw badLdapConnection(e); + catch (CommunicationException ex) { + throw badLdapConnection(ex); } - catch (NamingException e) { - this.logger.error("Failed to locate directory entry for authenticated user: " + username, e); - throw badCredentials(e); + catch (NamingException ex) { + this.logger.error("Failed to locate directory entry for authenticated user: " + username, ex); + throw badCredentials(ex); } finally { LdapUtils.closeContext(ctx); @@ -222,13 +222,13 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends AbstractLda try { return this.contextFactory.createContext(env); } - catch (NamingException e) { - if ((e instanceof AuthenticationException) || (e instanceof OperationNotSupportedException)) { - handleBindException(bindPrincipal, e); - throw badCredentials(e); + catch (NamingException ex) { + if ((ex instanceof AuthenticationException) || (ex instanceof OperationNotSupportedException)) { + handleBindException(bindPrincipal, ex); + throw badCredentials(ex); } else { - throw LdapUtils.convertLdapException(e); + throw LdapUtils.convertLdapException(ex); } } } diff --git a/ldap/src/main/java/org/springframework/security/ldap/ppolicy/PasswordPolicyControlExtractor.java b/ldap/src/main/java/org/springframework/security/ldap/ppolicy/PasswordPolicyControlExtractor.java index b69802d368..4cf3364ca9 100644 --- a/ldap/src/main/java/org/springframework/security/ldap/ppolicy/PasswordPolicyControlExtractor.java +++ b/ldap/src/main/java/org/springframework/security/ldap/ppolicy/PasswordPolicyControlExtractor.java @@ -38,8 +38,8 @@ public class PasswordPolicyControlExtractor { try { ctrls = ctx.getResponseControls(); } - catch (javax.naming.NamingException e) { - logger.error("Failed to obtain response controls", e); + catch (javax.naming.NamingException ex) { + logger.error("Failed to obtain response controls", ex); } for (int i = 0; ctrls != null && i < ctrls.length; i++) { diff --git a/ldap/src/main/java/org/springframework/security/ldap/ppolicy/PasswordPolicyResponseControl.java b/ldap/src/main/java/org/springframework/security/ldap/ppolicy/PasswordPolicyResponseControl.java index 42cb34e11f..da45f0db7f 100755 --- a/ldap/src/main/java/org/springframework/security/ldap/ppolicy/PasswordPolicyResponseControl.java +++ b/ldap/src/main/java/org/springframework/security/ldap/ppolicy/PasswordPolicyResponseControl.java @@ -84,8 +84,8 @@ public class PasswordPolicyResponseControl extends PasswordPolicyControl { try { decoder.decode(); } - catch (IOException e) { - throw new DataRetrievalFailureException("Failed to parse control value", e); + catch (IOException ex) { + throw new DataRetrievalFailureException("Failed to parse control value", ex); } } @@ -340,8 +340,8 @@ public class PasswordPolicyResponseControl extends PasswordPolicyControl { // try { // number = ((Long)decoder.decodeNumeric(new ByteArrayInputStream(content), // content.length)).intValue(); - // } catch(IOException e) { - // throw new LdapDataAccessException("Failed to parse number ", e); + // } catch(IOException ex) { + // throw new LdapDataAccessException("Failed to parse number ", ex); // } // // if(contentTag == 0) { diff --git a/ldap/src/main/java/org/springframework/security/ldap/server/ApacheDSContainer.java b/ldap/src/main/java/org/springframework/security/ldap/server/ApacheDSContainer.java index 9e1ff976f1..50bec4a81c 100644 --- a/ldap/src/main/java/org/springframework/security/ldap/server/ApacheDSContainer.java +++ b/ldap/src/main/java/org/springframework/security/ldap/server/ApacheDSContainer.java @@ -259,29 +259,18 @@ public class ApacheDSContainer implements InitializingBean, DisposableBean, Life this.service.startup(); this.server.start(); } - catch (Exception e) { - throw new RuntimeException("Server startup failed", e); + catch (Exception ex) { + throw new RuntimeException("Server startup failed", ex); } try { this.service.getAdminSession().lookup(this.partition.getSuffixDn()); } - catch (LdapNameNotFoundException e) { - try { - LdapDN dn = new LdapDN(this.root); - Assert.isTrue(this.root.startsWith("dc="), "root must start with dc="); - String dc = this.root.substring(3, this.root.indexOf(',')); - ServerEntry entry = this.service.newEntry(dn); - entry.add("objectClass", "top", "domain", "extensibleObject"); - entry.add("dc", dc); - this.service.getAdminSession().add(entry); - } - catch (Exception e1) { - this.logger.error("Failed to create dc entry", e1); - } + catch (LdapNameNotFoundException ex) { + handleLdapNameNotFoundException(); } - catch (Exception e) { - this.logger.error("Lookup failed", e); + catch (Exception ex) { + this.logger.error("Lookup failed", ex); } SocketAcceptor socketAcceptor = this.server.getSocketAcceptor(this.transport); @@ -293,8 +282,23 @@ public class ApacheDSContainer implements InitializingBean, DisposableBean, Life try { importLdifs(); } - catch (Exception e) { - throw new RuntimeException("Failed to import LDIF file(s)", e); + catch (Exception ex) { + throw new RuntimeException("Failed to import LDIF file(s)", ex); + } + } + + private void handleLdapNameNotFoundException() { + try { + LdapDN dn = new LdapDN(this.root); + Assert.isTrue(this.root.startsWith("dc="), "root must start with dc="); + String dc = this.root.substring(3, this.root.indexOf(',')); + ServerEntry entry = this.service.newEntry(dn); + entry.add("objectClass", "top", "domain", "extensibleObject"); + entry.add("dc", dc); + this.service.getAdminSession().add(entry); + } + catch (Exception ex) { + this.logger.error("Failed to create dc entry", ex); } } @@ -309,8 +313,8 @@ public class ApacheDSContainer implements InitializingBean, DisposableBean, Life this.server.stop(); this.service.shutdown(); } - catch (Exception e) { - this.logger.error("Shutdown failed", e); + catch (Exception ex) { + this.logger.error("Shutdown failed", ex); return; } @@ -350,7 +354,7 @@ public class ApacheDSContainer implements InitializingBean, DisposableBean, Life try { ldifFile = ldifs[0].getFile().getAbsolutePath(); } - catch (IOException e) { + catch (IOException ex) { ldifFile = ldifs[0].getURI().toString(); } this.logger.info("Loading LDIF file: " + ldifFile); diff --git a/ldap/src/main/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManager.java b/ldap/src/main/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManager.java index a6beab4808..c8c04669bd 100644 --- a/ldap/src/main/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManager.java +++ b/ldap/src/main/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManager.java @@ -295,7 +295,7 @@ public class LdapUserDetailsManager implements UserDetailsManager { } return true; } - catch (org.springframework.ldap.NameNotFoundException e) { + catch (org.springframework.ldap.NameNotFoundException ex) { return false; } } @@ -436,7 +436,7 @@ public class LdapUserDetailsManager implements UserDetailsManager { try { ctx.reconnect(null); } - catch (javax.naming.AuthenticationException e) { + catch (javax.naming.AuthenticationException ex) { throw new BadCredentialsException("Authentication for password change failed."); } @@ -459,7 +459,7 @@ public class LdapUserDetailsManager implements UserDetailsManager { try { return ctx.extendedOperation(request); } - catch (javax.naming.AuthenticationException e) { + catch (javax.naming.AuthenticationException ex) { throw new BadCredentialsException("Authentication for password change failed."); } }); @@ -563,7 +563,7 @@ public class LdapUserDetailsManager implements UserDetailsManager { try { dest.write(src); } - catch (IOException e) { + catch (IOException ex) { throw new IllegalArgumentException("Failed to BER encode provided value of type: " + type); } } diff --git a/ldap/src/test/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProviderTests.java b/ldap/src/test/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProviderTests.java index 17436f2945..c80407f9af 100644 --- a/ldap/src/test/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProviderTests.java +++ b/ldap/src/test/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProviderTests.java @@ -365,11 +365,11 @@ public class ActiveDirectoryLdapAuthenticationProviderTests { this.provider.contextFactory = createContextFactoryThrowing(new CommunicationException(msg)); this.provider.authenticate(this.joe); } - catch (InternalAuthenticationServiceException e) { + catch (InternalAuthenticationServiceException ex) { // Since GH-8418 ldap communication exception is wrapped into // InternalAuthenticationServiceException. // This test is about the wrapped exception, so we throw it. - throw e.getCause(); + throw ex.getCause(); } } @@ -419,11 +419,11 @@ public class ActiveDirectoryLdapAuthenticationProviderTests { } } - ContextFactory createContextFactoryThrowing(final NamingException e) { + ContextFactory createContextFactoryThrowing(final NamingException ex) { return new ContextFactory() { @Override DirContext createContext(Hashtable env) throws NamingException { - throw e; + throw ex; } }; } diff --git a/messaging/src/main/java/org/springframework/security/messaging/context/SecurityContextChannelInterceptor.java b/messaging/src/main/java/org/springframework/security/messaging/context/SecurityContextChannelInterceptor.java index bfff7c659d..e30c1809c4 100644 --- a/messaging/src/main/java/org/springframework/security/messaging/context/SecurityContextChannelInterceptor.java +++ b/messaging/src/main/java/org/springframework/security/messaging/context/SecurityContextChannelInterceptor.java @@ -151,7 +151,7 @@ public final class SecurityContextChannelInterceptor extends ChannelInterceptorA SecurityContextHolder.setContext(originalContext); } } - catch (Throwable t) { + catch (Throwable ex) { SecurityContextHolder.clearContext(); } } diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/JdbcOAuth2AuthorizedClientService.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/JdbcOAuth2AuthorizedClientService.java index 82977f5b43..6b456e9589 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/JdbcOAuth2AuthorizedClientService.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/JdbcOAuth2AuthorizedClientService.java @@ -139,7 +139,7 @@ public class JdbcOAuth2AuthorizedClientService implements OAuth2AuthorizedClient try { insertAuthorizedClient(authorizedClient, principal); } - catch (DuplicateKeyException e) { + catch (DuplicateKeyException ex) { updateAuthorizedClient(authorizedClient, principal); } } diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProvider.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProvider.java index 5e0b4764e2..2981891b44 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProvider.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProvider.java @@ -176,7 +176,7 @@ public class OidcAuthorizationCodeAuthenticationProvider implements Authenticati try { nonceHash = createHash(requestNonce); } - catch (NoSuchAlgorithmException e) { + catch (NoSuchAlgorithmException ex) { OAuth2Error oauth2Error = new OAuth2Error(INVALID_NONCE_ERROR_CODE); throw new OAuth2AuthenticationException(oauth2Error, oauth2Error.toString()); } diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeReactiveAuthenticationManager.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeReactiveAuthenticationManager.java index b91a27f38e..c924a77504 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeReactiveAuthenticationManager.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeReactiveAuthenticationManager.java @@ -228,7 +228,7 @@ public class OidcAuthorizationCodeReactiveAuthenticationManager implements React try { nonceHash = createHash(requestNonce); } - catch (NoSuchAlgorithmException e) { + catch (NoSuchAlgorithmException ex) { OAuth2Error oauth2Error = new OAuth2Error(INVALID_NONCE_ERROR_CODE); throw new OAuth2AuthenticationException(oauth2Error, oauth2Error.toString()); } diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java index e244de0e8d..875c7ca257 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/registration/ClientRegistrations.java @@ -204,17 +204,17 @@ public final class ClientRegistrations { try { return supplier.get(); } - catch (HttpClientErrorException e) { - if (!e.getStatusCode().is4xxClientError()) { - throw e; + catch (HttpClientErrorException ex) { + if (!ex.getStatusCode().is4xxClientError()) { + throw ex; } // else try another endpoint } - catch (IllegalArgumentException | IllegalStateException e) { - throw e; + catch (IllegalArgumentException | IllegalStateException ex) { + throw ex; } - catch (RuntimeException e) { - throw new IllegalArgumentException(errorMessage, e); + catch (RuntimeException ex) { + throw new IllegalArgumentException(errorMessage, ex); } } throw new IllegalArgumentException(errorMessage); @@ -225,8 +225,8 @@ public final class ClientRegistrations { try { return parser.apply(new JSONObject(body)); } - catch (ParseException e) { - throw new RuntimeException(e); + catch (ParseException ex) { + throw new RuntimeException(ex); } } diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/DefaultOAuth2AuthorizationRequestResolver.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/DefaultOAuth2AuthorizationRequestResolver.java index 2a959215e2..bd32fe322b 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/DefaultOAuth2AuthorizationRequestResolver.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/DefaultOAuth2AuthorizationRequestResolver.java @@ -263,7 +263,7 @@ public final class DefaultOAuth2AuthorizationRequestResolver implements OAuth2Au attributes.put(OidcParameterNames.NONCE, nonce); additionalParameters.put(OidcParameterNames.NONCE, nonceHash); } - catch (NoSuchAlgorithmException e) { + catch (NoSuchAlgorithmException ex) { } } @@ -292,7 +292,7 @@ public final class DefaultOAuth2AuthorizationRequestResolver implements OAuth2Au additionalParameters.put(PkceParameterNames.CODE_CHALLENGE, codeChallenge); additionalParameters.put(PkceParameterNames.CODE_CHALLENGE_METHOD, "S256"); } - catch (NoSuchAlgorithmException e) { + catch (NoSuchAlgorithmException ex) { additionalParameters.put(PkceParameterNames.CODE_CHALLENGE, codeVerifier); } } diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/server/DefaultServerOAuth2AuthorizationRequestResolver.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/server/DefaultServerOAuth2AuthorizationRequestResolver.java index 09cb3603dc..a30ce7849b 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/server/DefaultServerOAuth2AuthorizationRequestResolver.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/server/DefaultServerOAuth2AuthorizationRequestResolver.java @@ -261,7 +261,7 @@ public class DefaultServerOAuth2AuthorizationRequestResolver implements ServerOA attributes.put(OidcParameterNames.NONCE, nonce); additionalParameters.put(OidcParameterNames.NONCE, nonceHash); } - catch (NoSuchAlgorithmException e) { + catch (NoSuchAlgorithmException ex) { } } @@ -290,7 +290,7 @@ public class DefaultServerOAuth2AuthorizationRequestResolver implements ServerOA additionalParameters.put(PkceParameterNames.CODE_CHALLENGE, codeChallenge); additionalParameters.put(PkceParameterNames.CODE_CHALLENGE_METHOD, "S256"); } - catch (NoSuchAlgorithmException e) { + catch (NoSuchAlgorithmException ex) { additionalParameters.put(PkceParameterNames.CODE_CHALLENGE, codeVerifier); } } diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProviderTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProviderTests.java index 2be0abc377..1d4e471c55 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProviderTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProviderTests.java @@ -114,7 +114,7 @@ public class OidcAuthorizationCodeAuthenticationProviderTests { attributes.put(OidcParameterNames.NONCE, nonce); additionalParameters.put(OidcParameterNames.NONCE, this.nonceHash); } - catch (NoSuchAlgorithmException e) { + catch (NoSuchAlgorithmException ex) { } this.authorizationRequest = TestOAuth2AuthorizationRequests.request().scope("openid", "profile", "email") .attributes(attributes).additionalParameters(additionalParameters).build(); diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeReactiveAuthenticationManagerTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeReactiveAuthenticationManagerTests.java index 86935d9027..eb87575457 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeReactiveAuthenticationManagerTests.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeReactiveAuthenticationManagerTests.java @@ -369,7 +369,7 @@ public class OidcAuthorizationCodeReactiveAuthenticationManagerTests { attributes.put(OidcParameterNames.NONCE, nonce); additionalParameters.put(OidcParameterNames.NONCE, this.nonceHash); } - catch (NoSuchAlgorithmException e) { + catch (NoSuchAlgorithmException ex) { } OAuth2AuthorizationRequest authorizationRequest = OAuth2AuthorizationRequest.authorizationCode().state("state") .clientId(clientRegistration.getClientId()) diff --git a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtDecoderProviderConfigurationUtils.java b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtDecoderProviderConfigurationUtils.java index 9565b95a3a..bdb52efd06 100644 --- a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtDecoderProviderConfigurationUtils.java +++ b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtDecoderProviderConfigurationUtils.java @@ -82,13 +82,13 @@ class JwtDecoderProviderConfigurationUtils { return configuration; } - catch (IllegalArgumentException e) { - throw e; + catch (IllegalArgumentException ex) { + throw ex; } - catch (RuntimeException e) { - if (!(e instanceof HttpClientErrorException - && ((HttpClientErrorException) e).getStatusCode().is4xxClientError())) { - throw new IllegalArgumentException(errorMessage, e); + catch (RuntimeException ex) { + if (!(ex instanceof HttpClientErrorException + && ((HttpClientErrorException) ex).getStatusCode().is4xxClientError())) { + throw new IllegalArgumentException(errorMessage, ex); } // else try another endpoint } diff --git a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoder.java b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoder.java index 4fa7bac01a..a6d7e383ca 100644 --- a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoder.java +++ b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoder.java @@ -250,11 +250,11 @@ public final class NimbusReactiveJwtDecoder implements ReactiveJwtDecoder { try { return jwtProcessor.process(parsedToken, context); } - catch (BadJOSEException e) { - throw new BadJwtException("Failed to validate the token", e); + catch (BadJOSEException ex) { + throw new BadJwtException("Failed to validate the token", ex); } - catch (JOSEException e) { - throw new JwtException("Failed to validate the token", e); + catch (JOSEException ex) { + throw new JwtException("Failed to validate the token", ex); } } diff --git a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/ReactiveRemoteJWKSource.java b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/ReactiveRemoteJWKSource.java index b3652ae3be..bb2e249598 100644 --- a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/ReactiveRemoteJWKSource.java +++ b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/ReactiveRemoteJWKSource.java @@ -103,8 +103,8 @@ class ReactiveRemoteJWKSource implements ReactiveJWKSource { try { return JWKSet.parse(body); } - catch (ParseException e) { - throw new RuntimeException(e); + catch (ParseException ex) { + throw new RuntimeException(ex); } } diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jose/TestKeys.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jose/TestKeys.java index 23e9bb5d1f..e980ba4ca5 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jose/TestKeys.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jose/TestKeys.java @@ -39,8 +39,8 @@ public class TestKeys { try { kf = KeyFactory.getInstance("RSA"); } - catch (NoSuchAlgorithmException e) { - throw new IllegalStateException(e); + catch (NoSuchAlgorithmException ex) { + throw new IllegalStateException(ex); } } @@ -63,8 +63,8 @@ public class TestKeys { try { return (RSAPublicKey) kf.generatePublic(spec); } - catch (InvalidKeySpecException e) { - throw new IllegalArgumentException(e); + catch (InvalidKeySpecException ex) { + throw new IllegalArgumentException(ex); } } @@ -101,8 +101,8 @@ public class TestKeys { try { return (RSAPrivateKey) kf.generatePrivate(spec); } - catch (InvalidKeySpecException e) { - throw new IllegalArgumentException(e); + catch (InvalidKeySpecException ex) { + throw new IllegalArgumentException(ex); } } diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderTests.java index eeecac5df6..b554ab2669 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderTests.java @@ -607,9 +607,9 @@ public class NimbusJwtDecoderTests { try { return signedJWT.getJWTClaimsSet(); } - catch (ParseException e) { + catch (ParseException ex) { // Payload not a JSON object - throw new BadJWTException(e.getMessage(), e); + throw new BadJWTException(ex.getMessage(), ex); } } diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java index e6ab652181..7449f4381f 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/NimbusReactiveJwtDecoderTests.java @@ -500,8 +500,8 @@ public class NimbusReactiveJwtDecoderTests { try { return JWKSet.parse(jwkSet); } - catch (ParseException e) { - throw new IllegalArgumentException(e); + catch (ParseException ex) { + throw new IllegalArgumentException(ex); } } diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerAuthenticationManagerResolver.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerAuthenticationManagerResolver.java index fe230c6605..9ae5945975 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerAuthenticationManagerResolver.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerAuthenticationManagerResolver.java @@ -140,8 +140,8 @@ public final class JwtIssuerAuthenticationManagerResolver implements Authenticat return issuer; } } - catch (Exception e) { - throw new InvalidBearerTokenException(e.getMessage(), e); + catch (Exception ex) { + throw new InvalidBearerTokenException(ex.getMessage(), ex); } throw new InvalidBearerTokenException("Missing issuer"); } diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerReactiveAuthenticationManagerResolver.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerReactiveAuthenticationManagerResolver.java index aa72fcd8c5..422f70c0b3 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerReactiveAuthenticationManagerResolver.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtIssuerReactiveAuthenticationManagerResolver.java @@ -145,8 +145,8 @@ public final class JwtIssuerReactiveAuthenticationManagerResolver return issuer; } } - catch (Exception e) { - throw new InvalidBearerTokenException(e.getMessage(), e); + catch (Exception ex) { + throw new InvalidBearerTokenException(ex.getMessage(), ex); } }); } diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtReactiveAuthenticationManager.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtReactiveAuthenticationManager.java index a246841a66..81018df14e 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtReactiveAuthenticationManager.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtReactiveAuthenticationManager.java @@ -70,12 +70,12 @@ public final class JwtReactiveAuthenticationManager implements ReactiveAuthentic this.jwtAuthenticationConverter = jwtAuthenticationConverter; } - private AuthenticationException onError(JwtException e) { - if (e instanceof BadJwtException) { - return new InvalidBearerTokenException(e.getMessage(), e); + private AuthenticationException onError(JwtException ex) { + if (ex instanceof BadJwtException) { + return new InvalidBearerTokenException(ex.getMessage(), ex); } else { - return new AuthenticationServiceException(e.getMessage(), e); + return new AuthenticationServiceException(ex.getMessage(), ex); } } diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManager.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManager.java index 8745906907..fe57778e28 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManager.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OpaqueTokenReactiveAuthenticationManager.java @@ -91,12 +91,12 @@ public class OpaqueTokenReactiveAuthenticationManager implements ReactiveAuthent }).onErrorMap(OAuth2IntrospectionException.class, this::onError); } - private AuthenticationException onError(OAuth2IntrospectionException e) { - if (e instanceof BadOpaqueTokenException) { - return new InvalidBearerTokenException(e.getMessage(), e); + private AuthenticationException onError(OAuth2IntrospectionException ex) { + if (ex instanceof BadOpaqueTokenException) { + return new InvalidBearerTokenException(ex.getMessage(), ex); } else { - return new AuthenticationServiceException(e.getMessage(), e); + return new AuthenticationServiceException(ex.getMessage(), ex); } } diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospector.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospector.java index 5c7ccf0b04..6b37ddbeb4 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospector.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospector.java @@ -191,8 +191,8 @@ public class NimbusReactiveOpaqueTokenIntrospector implements ReactiveOpaqueToke } } - private OAuth2IntrospectionException onError(Throwable e) { - return new OAuth2IntrospectionException(e.getMessage(), e); + private OAuth2IntrospectionException onError(Throwable ex) { + return new OAuth2IntrospectionException(ex.getMessage(), ex); } } diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/core/TestOAuth2AuthenticatedPrincipals.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/core/TestOAuth2AuthenticatedPrincipals.java index dd548a22b4..907bc3e9f5 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/core/TestOAuth2AuthenticatedPrincipals.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/core/TestOAuth2AuthenticatedPrincipals.java @@ -65,8 +65,8 @@ public class TestOAuth2AuthenticatedPrincipals { try { return new URL(url); } - catch (IOException e) { - throw new UncheckedIOException(e); + catch (IOException ex) { + throw new UncheckedIOException(ex); } } diff --git a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospectorTests.java b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospectorTests.java index 69a96f5cba..45e3194ee1 100644 --- a/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospectorTests.java +++ b/oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospectorTests.java @@ -224,12 +224,12 @@ public class NimbusReactiveOpaqueTokenIntrospectorTests { return webClient; } - private WebClient mockResponse(Throwable t) { + private WebClient mockResponse(Throwable ex) { WebClient real = WebClient.builder().build(); WebClient.RequestBodyUriSpec spec = spy(real.post()); WebClient webClient = spy(WebClient.class); given(webClient.post()).willReturn(spec); - given(spec.exchange()).willThrow(t); + given(spec.exchange()).willThrow(ex); return webClient; } diff --git a/openid/src/main/java/org/springframework/security/openid/AuthenticationCancelledException.java b/openid/src/main/java/org/springframework/security/openid/AuthenticationCancelledException.java index 2e9435ae63..4d72b1449f 100644 --- a/openid/src/main/java/org/springframework/security/openid/AuthenticationCancelledException.java +++ b/openid/src/main/java/org/springframework/security/openid/AuthenticationCancelledException.java @@ -33,8 +33,8 @@ public class AuthenticationCancelledException extends AuthenticationException { super(msg); } - public AuthenticationCancelledException(String msg, Throwable t) { - super(msg, t); + public AuthenticationCancelledException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/openid/src/main/java/org/springframework/security/openid/OpenID4JavaConsumer.java b/openid/src/main/java/org/springframework/security/openid/OpenID4JavaConsumer.java index 391e8e152e..21dd846338 100644 --- a/openid/src/main/java/org/springframework/security/openid/OpenID4JavaConsumer.java +++ b/openid/src/main/java/org/springframework/security/openid/OpenID4JavaConsumer.java @@ -84,8 +84,8 @@ public class OpenID4JavaConsumer implements OpenIDConsumer { try { discoveries = this.consumerManager.discover(identityUrl); } - catch (DiscoveryException e) { - throw new OpenIDConsumerException("Error during discovery", e); + catch (DiscoveryException ex) { + throw new OpenIDConsumerException("Error during discovery", ex); } DiscoveryInformation information = this.consumerManager.associate(discoveries); @@ -112,8 +112,8 @@ public class OpenID4JavaConsumer implements OpenIDConsumer { authReq.addExtension(fetchRequest); } } - catch (MessageException | ConsumerException e) { - throw new OpenIDConsumerException("Error processing ConsumerManager authentication", e); + catch (MessageException | ConsumerException ex) { + throw new OpenIDConsumerException("Error processing ConsumerManager authentication", ex); } return authReq.getDestinationUrl(true); @@ -153,8 +153,8 @@ public class OpenID4JavaConsumer implements OpenIDConsumer { try { verification = this.consumerManager.verify(receivingURL.toString(), openidResp, discovered); } - catch (MessageException | AssociationException | DiscoveryException e) { - throw new OpenIDConsumerException("Error verifying openid response", e); + catch (MessageException | AssociationException | DiscoveryException ex) { + throw new OpenIDConsumerException("Error verifying openid response", ex); } // examine the verification result and extract the verified identifier @@ -201,8 +201,8 @@ public class OpenID4JavaConsumer implements OpenIDConsumer { } } } - catch (MessageException e) { - throw new OpenIDConsumerException("Attribute retrieval failed", e); + catch (MessageException ex) { + throw new OpenIDConsumerException("Attribute retrieval failed", ex); } if (this.logger.isDebugEnabled()) { diff --git a/openid/src/main/java/org/springframework/security/openid/OpenIDAuthenticationFilter.java b/openid/src/main/java/org/springframework/security/openid/OpenIDAuthenticationFilter.java index 36adebf2c8..a8d65af41c 100644 --- a/openid/src/main/java/org/springframework/security/openid/OpenIDAuthenticationFilter.java +++ b/openid/src/main/java/org/springframework/security/openid/OpenIDAuthenticationFilter.java @@ -100,8 +100,8 @@ public class OpenIDAuthenticationFilter extends AbstractAuthenticationProcessing try { this.consumer = new OpenID4JavaConsumer(); } - catch (ConsumerException e) { - throw new IllegalArgumentException("Failed to initialize OpenID", e); + catch (ConsumerException ex) { + throw new IllegalArgumentException("Failed to initialize OpenID", ex); } } @@ -143,8 +143,8 @@ public class OpenIDAuthenticationFilter extends AbstractAuthenticationProcessing // Indicate to parent class that authentication is continuing. return null; } - catch (OpenIDConsumerException e) { - this.logger.debug("Failed to consume claimedIdentity: " + claimedIdentity, e); + catch (OpenIDConsumerException ex) { + this.logger.debug("Failed to consume claimedIdentity: " + claimedIdentity, ex); throw new AuthenticationServiceException( "Unable to process claimed identity '" + claimedIdentity + "'"); } @@ -185,8 +185,8 @@ public class OpenIDAuthenticationFilter extends AbstractAuthenticationProcessing realmBuffer.append("/"); mapping = realmBuffer.toString(); } - catch (MalformedURLException e) { - this.logger.warn("returnToUrl was not a valid URL: [" + returnToUrl + "]", e); + catch (MalformedURLException ex) { + this.logger.warn("returnToUrl was not a valid URL: [" + returnToUrl + "]", ex); } } @@ -293,10 +293,10 @@ public class OpenIDAuthenticationFilter extends AbstractAuthenticationProcessing try { return URLEncoder.encode(value, "UTF-8"); } - catch (UnsupportedEncodingException e) { + catch (UnsupportedEncodingException ex) { Error err = new AssertionError( "The Java platform guarantees UTF-8 support, but it seemingly is not present."); - err.initCause(e); + err.initCause(ex); throw err; } } diff --git a/openid/src/main/java/org/springframework/security/openid/OpenIDConsumerException.java b/openid/src/main/java/org/springframework/security/openid/OpenIDConsumerException.java index 66f0b7fb4d..46bb355281 100644 --- a/openid/src/main/java/org/springframework/security/openid/OpenIDConsumerException.java +++ b/openid/src/main/java/org/springframework/security/openid/OpenIDConsumerException.java @@ -31,8 +31,8 @@ public class OpenIDConsumerException extends Exception { super(message); } - public OpenIDConsumerException(String message, Throwable t) { - super(message, t); + public OpenIDConsumerException(String message, Throwable cause) { + super(message, cause); } } diff --git a/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationProviderTests.java b/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationProviderTests.java index a25391b8c0..aac025770f 100644 --- a/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationProviderTests.java +++ b/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationProviderTests.java @@ -231,7 +231,7 @@ public class OpenIDAuthenticationProviderTests { provider.afterPropertiesSet(); fail("IllegalArgumentException expected, ssoAuthoritiesPopulator is null"); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException ex) { // expected } diff --git a/remoting/src/main/java/org/springframework/security/remoting/dns/JndiDnsResolver.java b/remoting/src/main/java/org/springframework/security/remoting/dns/JndiDnsResolver.java index e196323ba1..d0be53f5f0 100644 --- a/remoting/src/main/java/org/springframework/security/remoting/dns/JndiDnsResolver.java +++ b/remoting/src/main/java/org/springframework/security/remoting/dns/JndiDnsResolver.java @@ -80,8 +80,8 @@ public class JndiDnsResolver implements DnsResolver { // only the first. return dnsRecord.get().toString(); } - catch (NamingException e) { - throw new DnsLookupException("DNS lookup failed for: " + hostname, e); + catch (NamingException ex) { + throw new DnsLookupException("DNS lookup failed for: " + hostname, ex); } } @@ -120,8 +120,8 @@ public class JndiDnsResolver implements DnsResolver { } } } - catch (NamingException e) { - throw new DnsLookupException("DNS lookup failed for service " + serviceType + " at " + domain, e); + catch (NamingException ex) { + throw new DnsLookupException("DNS lookup failed for service " + serviceType + " at " + domain, ex); } // remove the "." at the end @@ -137,11 +137,11 @@ public class JndiDnsResolver implements DnsResolver { return dnsResult.get(recordType); } - catch (NamingException e) { - if (e instanceof NameNotFoundException) { - throw new DnsEntryNotFoundException("DNS entry not found for:" + query, e); + catch (NamingException ex) { + if (ex instanceof NameNotFoundException) { + throw new DnsEntryNotFoundException("DNS entry not found for:" + query, ex); } - throw new DnsLookupException("DNS lookup failed for: " + query, e); + throw new DnsLookupException("DNS lookup failed for: " + query, ex); } } @@ -156,8 +156,8 @@ public class JndiDnsResolver implements DnsResolver { try { ictx = new InitialDirContext(env); } - catch (NamingException e) { - throw new DnsLookupException("Cannot create InitialDirContext for DNS lookup", e); + catch (NamingException ex) { + throw new DnsLookupException("Cannot create InitialDirContext for DNS lookup", ex); } return ictx; } diff --git a/remoting/src/test/java/org/springframework/security/remoting/rmi/ContextPropagatingRemoteInvocationTests.java b/remoting/src/test/java/org/springframework/security/remoting/rmi/ContextPropagatingRemoteInvocationTests.java index 6a2f084c93..bfb1143fe6 100644 --- a/remoting/src/test/java/org/springframework/security/remoting/rmi/ContextPropagatingRemoteInvocationTests.java +++ b/remoting/src/test/java/org/springframework/security/remoting/rmi/ContextPropagatingRemoteInvocationTests.java @@ -69,7 +69,7 @@ public class ContextPropagatingRemoteInvocationTests { remoteInvocation.invoke(TargetObject.class.newInstance()); fail("Expected IllegalArgumentException"); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException ex) { // expected } diff --git a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/core/OpenSamlInitializationService.java b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/core/OpenSamlInitializationService.java index ba98b28ad8..640618266e 100644 --- a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/core/OpenSamlInitializationService.java +++ b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/core/OpenSamlInitializationService.java @@ -119,8 +119,8 @@ public class OpenSamlInitializationService { try { InitializationService.initialize(); } - catch (Exception e) { - throw new Saml2Exception(e); + catch (Exception ex) { + throw new Saml2Exception(ex); } BasicParserPool parserPool = new BasicParserPool(); @@ -139,8 +139,8 @@ public class OpenSamlInitializationService { try { parserPool.initialize(); } - catch (Exception e) { - throw new Saml2Exception(e); + catch (Exception ex) { + throw new Saml2Exception(ex); } XMLObjectProviderRegistrySupport.setParserPool(parserPool); diff --git a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProvider.java b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProvider.java index 6c5be4d1bb..bf3a61c329 100644 --- a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProvider.java +++ b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProvider.java @@ -282,11 +282,11 @@ public final class OpenSamlAuthenticationProvider implements AuthenticationProvi process(token, response); return this.authenticationConverter.apply(token).convert(response); } - catch (Saml2AuthenticationException e) { - throw e; + catch (Saml2AuthenticationException ex) { + throw ex; } - catch (Exception e) { - throw authException(Saml2ErrorCodes.INTERNAL_VALIDATION_ERROR, e.getMessage(), e); + catch (Exception ex) { + throw authException(Saml2ErrorCodes.INTERNAL_VALIDATION_ERROR, ex.getMessage(), ex); } } @@ -309,8 +309,8 @@ public final class OpenSamlAuthenticationProvider implements AuthenticationProvi Element element = document.getDocumentElement(); return (Response) this.responseUnmarshaller.unmarshall(element); } - catch (Exception e) { - throw authException(Saml2ErrorCodes.MALFORMED_RESPONSE_DATA, e.getMessage(), e); + catch (Exception ex) { + throw authException(Saml2ErrorCodes.MALFORMED_RESPONSE_DATA, ex.getMessage(), ex); } } @@ -371,10 +371,10 @@ public final class OpenSamlAuthenticationProvider implements AuthenticationProvi try { profileValidator.validate(response.getSignature()); } - catch (Exception e) { + catch (Exception ex) { validationExceptions.put(Saml2ErrorCodes.INVALID_SIGNATURE, authException(Saml2ErrorCodes.INVALID_SIGNATURE, - "Invalid signature for SAML Response [" + response.getID() + "]: ", e)); + "Invalid signature for SAML Response [" + response.getID() + "]: ", ex)); } try { @@ -389,10 +389,10 @@ public final class OpenSamlAuthenticationProvider implements AuthenticationProvi "Invalid signature for SAML Response [" + response.getID() + "]")); } } - catch (Exception e) { + catch (Exception ex) { validationExceptions.put(Saml2ErrorCodes.INVALID_SIGNATURE, authException(Saml2ErrorCodes.INVALID_SIGNATURE, - "Invalid signature for SAML Response [" + response.getID() + "]: ", e)); + "Invalid signature for SAML Response [" + response.getID() + "]: ", ex)); } } @@ -421,8 +421,8 @@ public final class OpenSamlAuthenticationProvider implements AuthenticationProvi Assertion assertion = decrypter.decrypt(encryptedAssertion); assertions.add(assertion); } - catch (DecryptionException e) { - throw authException(Saml2ErrorCodes.DECRYPTION_ERROR, e.getMessage(), e); + catch (DecryptionException ex) { + throw authException(Saml2ErrorCodes.DECRYPTION_ERROR, ex.getMessage(), ex); } } response.getAssertions().addAll(assertions); @@ -457,11 +457,11 @@ public final class OpenSamlAuthenticationProvider implements AuthenticationProvi authException(Saml2ErrorCodes.INVALID_ASSERTION, message)); } } - catch (Exception e) { + catch (Exception ex) { String message = String.format("Invalid assertion [%s] for SAML response [%s]: %s", assertion.getID(), - ((Response) assertion.getParent()).getID(), e.getMessage()); + ((Response) assertion.getParent()).getID(), ex.getMessage()); validationExceptions.put(Saml2ErrorCodes.INVALID_ASSERTION, - authException(Saml2ErrorCodes.INVALID_ASSERTION, message, e)); + authException(Saml2ErrorCodes.INVALID_ASSERTION, message, ex)); } } @@ -494,8 +494,8 @@ public final class OpenSamlAuthenticationProvider implements AuthenticationProvi assertion.getSubject().setNameID(nameId); return nameId; } - catch (DecryptionException e) { - throw authException(Saml2ErrorCodes.DECRYPTION_ERROR, e.getMessage(), e); + catch (DecryptionException ex) { + throw authException(Saml2ErrorCodes.DECRYPTION_ERROR, ex.getMessage(), ex); } } @@ -549,8 +549,8 @@ public final class OpenSamlAuthenticationProvider implements AuthenticationProvi Element element = marshaller.marshall(xsAny); return SerializeSupport.nodeToString(element); } - catch (MarshallingException e) { - throw new Saml2Exception(e); + catch (MarshallingException ex) { + throw new Saml2Exception(ex); } } return xsAny.getTextContent(); diff --git a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationRequestFactory.java b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationRequestFactory.java index b92852e308..e5a57b44f6 100644 --- a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationRequestFactory.java +++ b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationRequestFactory.java @@ -242,8 +242,8 @@ public class OpenSamlAuthenticationRequestFactory implements Saml2Authentication SignatureSupport.signObject(authnRequest, parameters); return authnRequest; } - catch (MarshallingException | SignatureException | SecurityException e) { - throw new Saml2Exception(e); + catch (MarshallingException | SignatureException | SecurityException ex) { + throw new Saml2Exception(ex); } } @@ -280,8 +280,8 @@ public class OpenSamlAuthenticationRequestFactory implements Saml2Authentication result.put("Signature", b64Signature); return result; } - catch (SecurityException e) { - throw new Saml2Exception(e); + catch (SecurityException ex) { + throw new Saml2Exception(ex); } } @@ -290,8 +290,8 @@ public class OpenSamlAuthenticationRequestFactory implements Saml2Authentication Element element = this.marshaller.marshall(authnRequest); return SerializeSupport.nodeToString(element); } - catch (MarshallingException e) { - throw new Saml2Exception(e); + catch (MarshallingException ex) { + throw new Saml2Exception(ex); } } diff --git a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/Saml2Utils.java b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/Saml2Utils.java index df0779d9ed..0f88d3a1b0 100644 --- a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/Saml2Utils.java +++ b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/Saml2Utils.java @@ -51,8 +51,8 @@ final class Saml2Utils { deflater.finish(); return b.toByteArray(); } - catch (IOException e) { - throw new Saml2Exception("Unable to deflate string", e); + catch (IOException ex) { + throw new Saml2Exception("Unable to deflate string", ex); } } @@ -64,8 +64,8 @@ final class Saml2Utils { iout.finish(); return new String(out.toByteArray(), StandardCharsets.UTF_8); } - catch (IOException e) { - throw new Saml2Exception("Unable to inflate string", e); + catch (IOException ex) { + throw new Saml2Exception("Unable to inflate string", ex); } } diff --git a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/metadata/OpenSamlMetadataResolver.java b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/metadata/OpenSamlMetadataResolver.java index aa85c3bf82..0684e0b866 100644 --- a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/metadata/OpenSamlMetadataResolver.java +++ b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/metadata/OpenSamlMetadataResolver.java @@ -111,7 +111,7 @@ public final class OpenSamlMetadataResolver implements Saml2MetadataResolver { try { x509Certificate.setValue(new String(Base64.getEncoder().encode(certificate.getEncoded()))); } - catch (CertificateEncodingException e) { + catch (CertificateEncodingException ex) { throw new Saml2Exception("Cannot encode certificate " + certificate.toString()); } @@ -145,8 +145,8 @@ public final class OpenSamlMetadataResolver implements Saml2MetadataResolver { Element element = this.entityDescriptorMarshaller.marshall(entityDescriptor); return SerializeSupport.prettyPrintXML(element); } - catch (Exception e) { - throw new Saml2Exception(e); + catch (Exception ex) { + throw new Saml2Exception(ex); } } diff --git a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter.java b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter.java index c7919aec63..9616db50e7 100644 --- a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter.java +++ b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter.java @@ -187,8 +187,8 @@ public class OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter try { return KeyInfoSupport.getCertificates(keyDescriptor.getKeyInfo()); } - catch (CertificateException e) { - throw new Saml2Exception(e); + catch (CertificateException ex) { + throw new Saml2Exception(ex); } } @@ -198,8 +198,8 @@ public class OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter Element element = document.getDocumentElement(); return (EntityDescriptor) this.unmarshaller.unmarshall(element); } - catch (Exception e) { - throw new Saml2Exception(e); + catch (Exception ex) { + throw new Saml2Exception(ex); } } diff --git a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrations.java b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrations.java index 4c0a33710d..3945668c7a 100644 --- a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrations.java +++ b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrations.java @@ -60,11 +60,11 @@ public final class RelyingPartyRegistrations { try { return rest.getForObject(metadataLocation, RelyingPartyRegistration.Builder.class); } - catch (RestClientException e) { - if (e.getCause() instanceof Saml2Exception) { - throw (Saml2Exception) e.getCause(); + catch (RestClientException ex) { + if (ex.getCause() instanceof Saml2Exception) { + throw (Saml2Exception) ex.getCause(); } - throw new Saml2Exception(e); + throw new Saml2Exception(ex); } } diff --git a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/web/Saml2AuthenticationTokenConverter.java b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/web/Saml2AuthenticationTokenConverter.java index 5c13e0e61e..b86475ba97 100644 --- a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/web/Saml2AuthenticationTokenConverter.java +++ b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/web/Saml2AuthenticationTokenConverter.java @@ -99,8 +99,8 @@ public final class Saml2AuthenticationTokenConverter implements AuthenticationCo iout.finish(); return new String(out.toByteArray(), StandardCharsets.UTF_8); } - catch (IOException e) { - throw new Saml2Exception("Unable to inflate string", e); + catch (IOException ex) { + throw new Saml2Exception("Unable to inflate string", ex); } } diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2Utils.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2Utils.java index fd412e4183..e03ab37e41 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2Utils.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2Utils.java @@ -48,8 +48,8 @@ public final class Saml2Utils { deflater.finish(); return b.toByteArray(); } - catch (IOException e) { - throw new Saml2Exception("Unable to deflate string", e); + catch (IOException ex) { + throw new Saml2Exception("Unable to deflate string", ex); } } @@ -61,8 +61,8 @@ public final class Saml2Utils { iout.finish(); return new String(out.toByteArray(), StandardCharsets.UTF_8); } - catch (IOException e) { - throw new Saml2Exception("Unable to inflate string", e); + catch (IOException ex) { + throw new Saml2Exception("Unable to inflate string", ex); } } diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/TestSaml2X509Credentials.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/TestSaml2X509Credentials.java index b6b67df762..8c0b447071 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/TestSaml2X509Credentials.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/TestSaml2X509Credentials.java @@ -61,8 +61,8 @@ public final class TestSaml2X509Credentials { try { return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(certBytes); } - catch (CertificateException e) { - throw new Saml2Exception(e); + catch (CertificateException ex) { + throw new Saml2Exception(ex); } } @@ -70,8 +70,8 @@ public final class TestSaml2X509Credentials { try { return KeySupport.decodePrivateKey(key.getBytes(StandardCharsets.UTF_8), new char[0]); } - catch (KeyException e) { - throw new Saml2Exception(e); + catch (KeyException ex) { + throw new Saml2Exception(ex); } } diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/credentials/TestSaml2X509Credentials.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/credentials/TestSaml2X509Credentials.java index 5f57547185..e577cef76e 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/credentials/TestSaml2X509Credentials.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/credentials/TestSaml2X509Credentials.java @@ -61,8 +61,8 @@ public final class TestSaml2X509Credentials { try { return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(certBytes); } - catch (CertificateException e) { - throw new Saml2Exception(e); + catch (CertificateException ex) { + throw new Saml2Exception(ex); } } @@ -70,8 +70,8 @@ public final class TestSaml2X509Credentials { try { return KeySupport.decodePrivateKey(key.getBytes(StandardCharsets.UTF_8), new char[0]); } - catch (KeyException e) { - throw new Saml2Exception(e); + catch (KeyException ex) { + throw new Saml2Exception(ex); } } diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProviderTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProviderTests.java index 04adbb8968..b4afd923c2 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProviderTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProviderTests.java @@ -436,8 +436,8 @@ public class OpenSamlAuthenticationProviderTests { Element element = marshaller.marshall(object); return SerializeSupport.nodeToString(element); } - catch (MarshallingException e) { - throw new Saml2Exception(e); + catch (MarshallingException ex) { + throw new Saml2Exception(ex); } } diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationRequestFactoryTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationRequestFactoryTests.java index d8715a4f5c..7a40ec0b9a 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationRequestFactoryTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationRequestFactoryTests.java @@ -226,8 +226,8 @@ public class OpenSamlAuthenticationRequestFactoryTests { Element element = document.getDocumentElement(); return (AuthnRequest) this.unmarshaller.unmarshall(element); } - catch (Exception e) { - throw new Saml2Exception(e); + catch (Exception ex) { + throw new Saml2Exception(ex); } } diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/TestOpenSamlObjects.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/TestOpenSamlObjects.java index 6cb77f7558..a2cfaf4b74 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/TestOpenSamlObjects.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/TestOpenSamlObjects.java @@ -210,8 +210,8 @@ final class TestOpenSamlObjects { try { SignatureSupport.signObject(signable, parameters); } - catch (MarshallingException | SignatureException | SecurityException e) { - throw new Saml2Exception(e); + catch (MarshallingException | SignatureException | SecurityException ex) { + throw new Saml2Exception(ex); } return signable; @@ -228,8 +228,8 @@ final class TestOpenSamlObjects { try { SignatureSupport.signObject(signable, parameters); } - catch (MarshallingException | SignatureException | SecurityException e) { - throw new Saml2Exception(e); + catch (MarshallingException | SignatureException | SecurityException ex) { + throw new Saml2Exception(ex); } return signable; @@ -241,8 +241,8 @@ final class TestOpenSamlObjects { try { return encrypter.encrypt(assertion); } - catch (EncryptionException e) { - throw new Saml2Exception("Unable to encrypt assertion.", e); + catch (EncryptionException ex) { + throw new Saml2Exception("Unable to encrypt assertion.", ex); } } @@ -253,8 +253,8 @@ final class TestOpenSamlObjects { try { return encrypter.encrypt(assertion); } - catch (EncryptionException e) { - throw new Saml2Exception("Unable to encrypt assertion.", e); + catch (EncryptionException ex) { + throw new Saml2Exception("Unable to encrypt assertion.", ex); } } @@ -264,8 +264,8 @@ final class TestOpenSamlObjects { try { return encrypter.encrypt(nameId); } - catch (EncryptionException e) { - throw new Saml2Exception("Unable to encrypt nameID.", e); + catch (EncryptionException ex) { + throw new Saml2Exception("Unable to encrypt nameID.", ex); } } @@ -276,8 +276,8 @@ final class TestOpenSamlObjects { try { return encrypter.encrypt(nameId); } - catch (EncryptionException e) { - throw new Saml2Exception("Unable to encrypt nameID.", e); + catch (EncryptionException ex) { + throw new Saml2Exception("Unable to encrypt nameID.", ex); } } diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverterTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverterTests.java index 0d5733b82e..c0c1051882 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverterTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverterTests.java @@ -130,8 +130,8 @@ public class OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverterTests { InputStream certificate = new ByteArrayInputStream(Base64.getDecoder().decode(data.getBytes())); return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(certificate); } - catch (Exception e) { - throw new IllegalArgumentException(e); + catch (Exception ex) { + throw new IllegalArgumentException(ex); } } diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/servlet/filter/Saml2WebSsoAuthenticationFilterTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/servlet/filter/Saml2WebSsoAuthenticationFilterTests.java index 25d7f416aa..c88a00b68b 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/servlet/filter/Saml2WebSsoAuthenticationFilterTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/servlet/filter/Saml2WebSsoAuthenticationFilterTests.java @@ -92,9 +92,9 @@ public class Saml2WebSsoAuthenticationFilterTests { this.filter.attemptAuthentication(this.request, this.response); failBecauseExceptionWasNotThrown(Saml2AuthenticationException.class); } - catch (Exception e) { - assertThat(e).isInstanceOf(Saml2AuthenticationException.class); - assertThat(e.getMessage()).isEqualTo("No relying party registration found"); + catch (Exception ex) { + assertThat(ex).isInstanceOf(Saml2AuthenticationException.class); + assertThat(ex.getMessage()).isEqualTo("No relying party registration found"); } } diff --git a/taglibs/src/main/java/org/springframework/security/taglibs/authz/AbstractAuthorizeTag.java b/taglibs/src/main/java/org/springframework/security/taglibs/authz/AbstractAuthorizeTag.java index b848fe63bf..7033d4d7d7 100644 --- a/taglibs/src/main/java/org/springframework/security/taglibs/authz/AbstractAuthorizeTag.java +++ b/taglibs/src/main/java/org/springframework/security/taglibs/authz/AbstractAuthorizeTag.java @@ -129,10 +129,8 @@ public abstract class AbstractAuthorizeTag { accessExpression = handler.getExpressionParser().parseExpression(getAccess()); } - catch (ParseException e) { - IOException ioException = new IOException(); - ioException.initCause(e); - throw ioException; + catch (ParseException ex) { + throw new IOException(ex); } return ExpressionUtils.evaluateAsBoolean(accessExpression, createExpressionEvaluationContext(handler)); diff --git a/taglibs/src/main/java/org/springframework/security/taglibs/authz/AuthenticationTag.java b/taglibs/src/main/java/org/springframework/security/taglibs/authz/AuthenticationTag.java index 993877a851..e65e4e00b7 100644 --- a/taglibs/src/main/java/org/springframework/security/taglibs/authz/AuthenticationTag.java +++ b/taglibs/src/main/java/org/springframework/security/taglibs/authz/AuthenticationTag.java @@ -102,8 +102,8 @@ public class AuthenticationTag extends TagSupport { BeanWrapperImpl wrapper = new BeanWrapperImpl(auth); result = wrapper.getPropertyValue(this.property); } - catch (BeansException e) { - throw new JspException(e); + catch (BeansException ex) { + throw new JspException(ex); } } diff --git a/taglibs/src/main/java/org/springframework/security/taglibs/authz/JspAuthorizeTag.java b/taglibs/src/main/java/org/springframework/security/taglibs/authz/JspAuthorizeTag.java index 2cb8acdd86..81b852c3d4 100644 --- a/taglibs/src/main/java/org/springframework/security/taglibs/authz/JspAuthorizeTag.java +++ b/taglibs/src/main/java/org/springframework/security/taglibs/authz/JspAuthorizeTag.java @@ -79,8 +79,8 @@ public class JspAuthorizeTag extends AbstractAuthorizeTag implements Tag { return TagLibConfig.evalOrSkip(this.authorized); } - catch (IOException e) { - throw new JspException(e); + catch (IOException ex) { + throw new JspException(ex); } } @@ -101,8 +101,8 @@ public class JspAuthorizeTag extends AbstractAuthorizeTag implements Tag { this.pageContext.getOut().write(TagLibConfig.getSecuredUiSuffix()); } } - catch (IOException e) { - throw new JspException(e); + catch (IOException ex) { + throw new JspException(ex); } return EVAL_PAGE; diff --git a/taglibs/src/main/java/org/springframework/security/taglibs/csrf/AbstractCsrfTag.java b/taglibs/src/main/java/org/springframework/security/taglibs/csrf/AbstractCsrfTag.java index 88fbf28043..65509ddba4 100644 --- a/taglibs/src/main/java/org/springframework/security/taglibs/csrf/AbstractCsrfTag.java +++ b/taglibs/src/main/java/org/springframework/security/taglibs/csrf/AbstractCsrfTag.java @@ -39,8 +39,8 @@ abstract class AbstractCsrfTag extends TagSupport { try { this.pageContext.getOut().write(this.handleToken(token)); } - catch (IOException e) { - throw new JspException(e); + catch (IOException ex) { + throw new JspException(ex); } } diff --git a/test/src/main/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListener.java b/test/src/main/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListener.java index 97572bdf8e..c38cb5ad63 100644 --- a/test/src/main/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListener.java +++ b/test/src/main/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListener.java @@ -119,8 +119,8 @@ public class ReactorContextTestExecutionListener extends DelegatingTestExecution } @Override - public void onError(Throwable t) { - this.delegate.onError(t); + public void onError(Throwable ex) { + this.delegate.onError(ex); } @Override diff --git a/test/src/main/java/org/springframework/security/test/context/support/WithSecurityContextTestExecutionListener.java b/test/src/main/java/org/springframework/security/test/context/support/WithSecurityContextTestExecutionListener.java index c62ac3412f..af64400baa 100644 --- a/test/src/main/java/org/springframework/security/test/context/support/WithSecurityContextTestExecutionListener.java +++ b/test/src/main/java/org/springframework/security/test/context/support/WithSecurityContextTestExecutionListener.java @@ -119,8 +119,8 @@ public class WithSecurityContextTestExecutionListener extends AbstractTestExecut try { return factory.createSecurityContext(annotation); } - catch (RuntimeException e) { - throw new IllegalStateException("Unable to create SecurityContext using " + annotation, e); + catch (RuntimeException ex) { + throw new IllegalStateException("Unable to create SecurityContext using " + annotation, ex); } }; TestExecutionEvent initialize = withSecurityContext.setupBefore(); @@ -149,11 +149,11 @@ public class WithSecurityContextTestExecutionListener extends AbstractTestExecut try { return testContext.getApplicationContext().getAutowireCapableBeanFactory().createBean(clazz); } - catch (IllegalStateException e) { + catch (IllegalStateException ex) { return BeanUtils.instantiateClass(clazz); } - catch (Exception e) { - throw new RuntimeException(e); + catch (Exception ex) { + throw new RuntimeException(ex); } } diff --git a/web/src/main/java/org/springframework/security/web/FilterChainProxy.java b/web/src/main/java/org/springframework/security/web/FilterChainProxy.java index 821cd7c8f6..d6ba03070d 100644 --- a/web/src/main/java/org/springframework/security/web/FilterChainProxy.java +++ b/web/src/main/java/org/springframework/security/web/FilterChainProxy.java @@ -178,8 +178,8 @@ public class FilterChainProxy extends GenericFilterBean { request.setAttribute(FILTER_APPLIED, Boolean.TRUE); doFilterInternal(request, response, chain); } - catch (RequestRejectedException e) { - this.requestRejectedHandler.handle((HttpServletRequest) request, (HttpServletResponse) response, e); + catch (RequestRejectedException ex) { + this.requestRejectedHandler.handle((HttpServletRequest) request, (HttpServletResponse) response, ex); } finally { SecurityContextHolder.clearContext(); diff --git a/web/src/main/java/org/springframework/security/web/access/expression/ExpressionBasedFilterInvocationSecurityMetadataSource.java b/web/src/main/java/org/springframework/security/web/access/expression/ExpressionBasedFilterInvocationSecurityMetadataSource.java index 88f83e32ab..0a239f3da9 100644 --- a/web/src/main/java/org/springframework/security/web/access/expression/ExpressionBasedFilterInvocationSecurityMetadataSource.java +++ b/web/src/main/java/org/springframework/security/web/access/expression/ExpressionBasedFilterInvocationSecurityMetadataSource.java @@ -72,7 +72,7 @@ public final class ExpressionBasedFilterInvocationSecurityMetadataSource try { attributes.add(new WebExpressionConfigAttribute(parser.parseExpression(expression), postProcessor)); } - catch (ParseException e) { + catch (ParseException ex) { throw new IllegalArgumentException("Failed to parse expression '" + expression + "'"); } diff --git a/web/src/main/java/org/springframework/security/web/authentication/AuthenticationFilter.java b/web/src/main/java/org/springframework/security/web/authentication/AuthenticationFilter.java index 8a4f66b4b8..7353e906fb 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/AuthenticationFilter.java +++ b/web/src/main/java/org/springframework/security/web/authentication/AuthenticationFilter.java @@ -156,8 +156,8 @@ public class AuthenticationFilter extends OncePerRequestFilter { successfulAuthentication(request, response, filterChain, authenticationResult); } - catch (AuthenticationException e) { - unsuccessfulAuthentication(request, response, e); + catch (AuthenticationException ex) { + unsuccessfulAuthentication(request, response, ex); } } diff --git a/web/src/main/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilter.java b/web/src/main/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilter.java index 7045596f83..f47b58fcd9 100755 --- a/web/src/main/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilter.java +++ b/web/src/main/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilter.java @@ -109,9 +109,9 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi try { super.afterPropertiesSet(); } - catch (ServletException e) { + catch (ServletException ex) { // convert to RuntimeException for passivity on afterPropertiesSet signature - throw new RuntimeException(e); + throw new RuntimeException(ex); } Assert.notNull(this.authenticationManager, "An AuthenticationManager must be set"); } diff --git a/web/src/main/java/org/springframework/security/web/authentication/preauth/j2ee/WebXmlMappableAttributesRetriever.java b/web/src/main/java/org/springframework/security/web/authentication/preauth/j2ee/WebXmlMappableAttributesRetriever.java index 62fc83ba7d..0a99e9c476 100755 --- a/web/src/main/java/org/springframework/security/web/authentication/preauth/j2ee/WebXmlMappableAttributesRetriever.java +++ b/web/src/main/java/org/springframework/security/web/authentication/preauth/j2ee/WebXmlMappableAttributesRetriever.java @@ -118,15 +118,15 @@ public class WebXmlMappableAttributesRetriever doc = db.parse(aStream); return doc; } - catch (FactoryConfigurationError | IOException | SAXException | ParserConfigurationException e) { - throw new RuntimeException("Unable to parse document object", e); + catch (FactoryConfigurationError | IOException | SAXException | ParserConfigurationException ex) { + throw new RuntimeException("Unable to parse document object", ex); } finally { try { aStream.close(); } - catch (IOException e) { - this.logger.warn("Failed to close input stream for web.xml", e); + catch (IOException ex) { + this.logger.warn("Failed to close input stream for web.xml", ex); } } } diff --git a/web/src/main/java/org/springframework/security/web/authentication/preauth/websphere/DefaultWASUsernameAndGroupsExtractor.java b/web/src/main/java/org/springframework/security/web/authentication/preauth/websphere/DefaultWASUsernameAndGroupsExtractor.java index 91df4aab6c..fc6dabc9b2 100755 --- a/web/src/main/java/org/springframework/security/web/authentication/preauth/websphere/DefaultWASUsernameAndGroupsExtractor.java +++ b/web/src/main/java/org/springframework/security/web/authentication/preauth/websphere/DefaultWASUsernameAndGroupsExtractor.java @@ -137,9 +137,9 @@ final class DefaultWASUsernameAndGroupsExtractor implements WASUsernameAndGroups return new ArrayList(groups); } - catch (Exception e) { - logger.error("Exception occured while looking up groups for user", e); - throw new RuntimeException("Exception occured while looking up groups for user", e); + catch (Exception ex) { + logger.error("Exception occured while looking up groups for user", ex); + throw new RuntimeException("Exception occured while looking up groups for user", ex); } finally { try { @@ -147,8 +147,8 @@ final class DefaultWASUsernameAndGroupsExtractor implements WASUsernameAndGroups ic.close(); } } - catch (NamingException e) { - logger.debug("Exception occured while closing context", e); + catch (NamingException ex) { + logger.debug("Exception occured while closing context", ex); } } } @@ -157,23 +157,23 @@ final class DefaultWASUsernameAndGroupsExtractor implements WASUsernameAndGroups try { return method.invoke(instance, args); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException ex) { logger.error("Error while invoking method " + method.getClass().getName() + "." + method.getName() + "(" - + Arrays.asList(args) + ")", e); + + Arrays.asList(args) + ")", ex); throw new RuntimeException("Error while invoking method " + method.getClass().getName() + "." - + method.getName() + "(" + Arrays.asList(args) + ")", e); + + method.getName() + "(" + Arrays.asList(args) + ")", ex); } - catch (IllegalAccessException e) { + catch (IllegalAccessException ex) { logger.error("Error while invoking method " + method.getClass().getName() + "." + method.getName() + "(" - + Arrays.asList(args) + ")", e); + + Arrays.asList(args) + ")", ex); throw new RuntimeException("Error while invoking method " + method.getClass().getName() + "." - + method.getName() + "(" + Arrays.asList(args) + ")", e); + + method.getName() + "(" + Arrays.asList(args) + ")", ex); } - catch (InvocationTargetException e) { + catch (InvocationTargetException ex) { logger.error("Error while invoking method " + method.getClass().getName() + "." + method.getName() + "(" - + Arrays.asList(args) + ")", e); + + Arrays.asList(args) + ")", ex); throw new RuntimeException("Error while invoking method " + method.getClass().getName() + "." - + method.getName() + "(" + Arrays.asList(args) + ")", e); + + method.getName() + "(" + Arrays.asList(args) + ")", ex); } } @@ -187,14 +187,14 @@ final class DefaultWASUsernameAndGroupsExtractor implements WASUsernameAndGroups } return c.getDeclaredMethod(methodName, parameterTypes); } - catch (ClassNotFoundException e) { + catch (ClassNotFoundException ex) { logger.error("Required class" + className + " not found"); - throw new RuntimeException("Required class" + className + " not found", e); + throw new RuntimeException("Required class" + className + " not found", ex); } - catch (NoSuchMethodException e) { + catch (NoSuchMethodException ex) { logger.error("Required method " + methodName + " with parameter types (" + Arrays.asList(parameterTypeNames) + ") not found on class " + className); - throw new RuntimeException("Required class" + className + " not found", e); + throw new RuntimeException("Required class" + className + " not found", ex); } } @@ -242,9 +242,9 @@ final class DefaultWASUsernameAndGroupsExtractor implements WASUsernameAndGroups try { return Class.forName(className); } - catch (ClassNotFoundException e) { + catch (ClassNotFoundException ex) { logger.error("Required class " + className + " not found"); - throw new RuntimeException("Required class " + className + " not found", e); + throw new RuntimeException("Required class " + className + " not found", ex); } } diff --git a/web/src/main/java/org/springframework/security/web/authentication/rememberme/AbstractRememberMeServices.java b/web/src/main/java/org/springframework/security/web/authentication/rememberme/AbstractRememberMeServices.java index a65e6a4579..238a7545b4 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/rememberme/AbstractRememberMeServices.java +++ b/web/src/main/java/org/springframework/security/web/authentication/rememberme/AbstractRememberMeServices.java @@ -154,8 +154,8 @@ public abstract class AbstractRememberMeServices implements RememberMeServices, catch (AccountStatusException statusInvalid) { this.logger.debug("Invalid UserDetails: " + statusInvalid.getMessage()); } - catch (RememberMeAuthenticationException e) { - this.logger.debug(e.getMessage()); + catch (RememberMeAuthenticationException ex) { + this.logger.debug(ex.getMessage()); } cancelCookie(request, response); @@ -219,7 +219,7 @@ public abstract class AbstractRememberMeServices implements RememberMeServices, try { Base64.getDecoder().decode(cookieValue.getBytes()); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException ex) { throw new InvalidCookieException("Cookie token was not Base64 encoded; value was '" + cookieValue + "'"); } @@ -231,8 +231,8 @@ public abstract class AbstractRememberMeServices implements RememberMeServices, try { tokens[i] = URLDecoder.decode(tokens[i], StandardCharsets.UTF_8.toString()); } - catch (UnsupportedEncodingException e) { - this.logger.error(e.getMessage(), e); + catch (UnsupportedEncodingException ex) { + this.logger.error(ex.getMessage(), ex); } } @@ -250,8 +250,8 @@ public abstract class AbstractRememberMeServices implements RememberMeServices, try { sb.append(URLEncoder.encode(cookieTokens[i], StandardCharsets.UTF_8.toString())); } - catch (UnsupportedEncodingException e) { - this.logger.error(e.getMessage(), e); + catch (UnsupportedEncodingException ex) { + this.logger.error(ex.getMessage(), ex); } if (i < cookieTokens.length - 1) { diff --git a/web/src/main/java/org/springframework/security/web/authentication/rememberme/JdbcTokenRepositoryImpl.java b/web/src/main/java/org/springframework/security/web/authentication/rememberme/JdbcTokenRepositoryImpl.java index 363f9d8aeb..f9704fdab0 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/rememberme/JdbcTokenRepositoryImpl.java +++ b/web/src/main/java/org/springframework/security/web/authentication/rememberme/JdbcTokenRepositoryImpl.java @@ -100,8 +100,8 @@ public class JdbcTokenRepositoryImpl extends JdbcDaoSupport implements Persisten this.logger.error("Querying token for series '" + seriesId + "' returned more than one value. Series" + " should be unique"); } - catch (DataAccessException e) { - this.logger.error("Failed to load token for series " + seriesId, e); + catch (DataAccessException ex) { + this.logger.error("Failed to load token for series " + seriesId, ex); } return null; diff --git a/web/src/main/java/org/springframework/security/web/authentication/rememberme/PersistentTokenBasedRememberMeServices.java b/web/src/main/java/org/springframework/security/web/authentication/rememberme/PersistentTokenBasedRememberMeServices.java index 377a3567d1..2b612c7b38 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/rememberme/PersistentTokenBasedRememberMeServices.java +++ b/web/src/main/java/org/springframework/security/web/authentication/rememberme/PersistentTokenBasedRememberMeServices.java @@ -137,8 +137,8 @@ public class PersistentTokenBasedRememberMeServices extends AbstractRememberMeSe this.tokenRepository.updateToken(newToken.getSeries(), newToken.getTokenValue(), newToken.getDate()); addCookie(newToken, request, response); } - catch (Exception e) { - this.logger.error("Failed to update token: ", e); + catch (Exception ex) { + this.logger.error("Failed to update token: ", ex); throw new RememberMeAuthenticationException("Autologin failed due to data access problem"); } @@ -163,8 +163,8 @@ public class PersistentTokenBasedRememberMeServices extends AbstractRememberMeSe this.tokenRepository.createNewToken(persistentToken); addCookie(persistentToken, request, response); } - catch (Exception e) { - this.logger.error("Failed to save persistent token ", e); + catch (Exception ex) { + this.logger.error("Failed to save persistent token ", ex); } } diff --git a/web/src/main/java/org/springframework/security/web/authentication/rememberme/RememberMeAuthenticationException.java b/web/src/main/java/org/springframework/security/web/authentication/rememberme/RememberMeAuthenticationException.java index 0aeb3298db..a00174824b 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/rememberme/RememberMeAuthenticationException.java +++ b/web/src/main/java/org/springframework/security/web/authentication/rememberme/RememberMeAuthenticationException.java @@ -30,10 +30,10 @@ public class RememberMeAuthenticationException extends AuthenticationException { * Constructs a {@code RememberMeAuthenticationException} with the specified message * and root cause. * @param msg the detail message - * @param t the root cause + * @param cause the root cause */ - public RememberMeAuthenticationException(String msg, Throwable t) { - super(msg, t); + public RememberMeAuthenticationException(String msg, Throwable cause) { + super(msg, cause); } /** diff --git a/web/src/main/java/org/springframework/security/web/authentication/rememberme/TokenBasedRememberMeServices.java b/web/src/main/java/org/springframework/security/web/authentication/rememberme/TokenBasedRememberMeServices.java index 0fdf63e8d1..649d06726c 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/rememberme/TokenBasedRememberMeServices.java +++ b/web/src/main/java/org/springframework/security/web/authentication/rememberme/TokenBasedRememberMeServices.java @@ -148,7 +148,7 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices { try { digest = MessageDigest.getInstance("MD5"); } - catch (NoSuchAlgorithmException e) { + catch (NoSuchAlgorithmException ex) { throw new IllegalStateException("No MD5 algorithm available!"); } diff --git a/web/src/main/java/org/springframework/security/web/authentication/switchuser/SwitchUserFilter.java b/web/src/main/java/org/springframework/security/web/authentication/switchuser/SwitchUserFilter.java index d64dd01cc3..5f1dd45139 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/switchuser/SwitchUserFilter.java +++ b/web/src/main/java/org/springframework/security/web/authentication/switchuser/SwitchUserFilter.java @@ -177,9 +177,9 @@ public class SwitchUserFilter extends GenericFilterBean implements ApplicationEv // redirect to target url this.successHandler.onAuthenticationSuccess(request, response, targetUser); } - catch (AuthenticationException e) { - this.logger.debug("Switch User failed", e); - this.failureHandler.onAuthenticationFailure(request, response, e); + catch (AuthenticationException ex) { + this.logger.debug("Switch User failed", ex); + this.failureHandler.onAuthenticationFailure(request, response, ex); } return; @@ -310,7 +310,7 @@ public class SwitchUserFilter extends GenericFilterBean implements ApplicationEv // SEC-1763. Check first if we are already switched. currentAuth = attemptExitUser(request); } - catch (AuthenticationCredentialsNotFoundException e) { + catch (AuthenticationCredentialsNotFoundException ex) { currentAuth = SecurityContextHolder.getContext().getAuthentication(); } diff --git a/web/src/main/java/org/springframework/security/web/authentication/www/BasicAuthenticationConverter.java b/web/src/main/java/org/springframework/security/web/authentication/www/BasicAuthenticationConverter.java index 09281ac742..483ab89097 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/www/BasicAuthenticationConverter.java +++ b/web/src/main/java/org/springframework/security/web/authentication/www/BasicAuthenticationConverter.java @@ -94,7 +94,7 @@ public class BasicAuthenticationConverter implements AuthenticationConverter { try { decoded = Base64.getDecoder().decode(base64Token); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException ex) { throw new BadCredentialsException("Failed to decode basic authentication token"); } diff --git a/web/src/main/java/org/springframework/security/web/authentication/www/DigestAuthUtils.java b/web/src/main/java/org/springframework/security/web/authentication/www/DigestAuthUtils.java index 5800be6819..98472819e5 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/www/DigestAuthUtils.java +++ b/web/src/main/java/org/springframework/security/web/authentication/www/DigestAuthUtils.java @@ -214,7 +214,7 @@ final class DigestAuthUtils { try { digest = MessageDigest.getInstance("MD5"); } - catch (NoSuchAlgorithmException e) { + catch (NoSuchAlgorithmException ex) { throw new IllegalStateException("No MD5 algorithm available!"); } diff --git a/web/src/main/java/org/springframework/security/web/authentication/www/DigestAuthenticationFilter.java b/web/src/main/java/org/springframework/security/web/authentication/www/DigestAuthenticationFilter.java index d3a7ccc406..abda070507 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/www/DigestAuthenticationFilter.java +++ b/web/src/main/java/org/springframework/security/web/authentication/www/DigestAuthenticationFilter.java @@ -135,8 +135,8 @@ public class DigestAuthenticationFilter extends GenericFilterBean implements Mes digestAuth.validateAndDecode(this.authenticationEntryPoint.getKey(), this.authenticationEntryPoint.getRealmName()); } - catch (BadCredentialsException e) { - fail(request, response, e); + catch (BadCredentialsException ex) { + fail(request, response, ex); return; } @@ -374,7 +374,7 @@ public class DigestAuthenticationFilter extends GenericFilterBean implements Mes try { Base64.getDecoder().decode(this.nonce.getBytes()); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException ex) { throw new BadCredentialsException( DigestAuthenticationFilter.this.messages.getMessage("DigestAuthenticationFilter.nonceEncoding", new Object[] { this.nonce }, "Nonce is not encoded in Base64; received nonce {0}")); diff --git a/web/src/main/java/org/springframework/security/web/authentication/www/NonceExpiredException.java b/web/src/main/java/org/springframework/security/web/authentication/www/NonceExpiredException.java index a2716bbef2..8ac38137d0 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/www/NonceExpiredException.java +++ b/web/src/main/java/org/springframework/security/web/authentication/www/NonceExpiredException.java @@ -37,10 +37,10 @@ public class NonceExpiredException extends AuthenticationException { * Constructs a NonceExpiredException with the specified message and root * cause. * @param msg the detail message - * @param t root cause + * @param cause root cause */ - public NonceExpiredException(String msg, Throwable t) { - super(msg, t); + public NonceExpiredException(String msg, Throwable cause) { + super(msg, cause); } } diff --git a/web/src/main/java/org/springframework/security/web/context/HttpSessionSecurityContextRepository.java b/web/src/main/java/org/springframework/security/web/context/HttpSessionSecurityContextRepository.java index 763d2e7ad2..fbf238f45c 100644 --- a/web/src/main/java/org/springframework/security/web/context/HttpSessionSecurityContextRepository.java +++ b/web/src/main/java/org/springframework/security/web/context/HttpSessionSecurityContextRepository.java @@ -437,7 +437,7 @@ public class HttpSessionSecurityContextRepository implements SecurityContextRepo try { return this.request.getSession(true); } - catch (IllegalStateException e) { + catch (IllegalStateException ex) { // Response must already be committed, therefore can't create a new // session HttpSessionSecurityContextRepository.this.logger diff --git a/web/src/main/java/org/springframework/security/web/header/writers/HpkpHeaderWriter.java b/web/src/main/java/org/springframework/security/web/header/writers/HpkpHeaderWriter.java index 52fa0300ff..c3d3050f92 100644 --- a/web/src/main/java/org/springframework/security/web/header/writers/HpkpHeaderWriter.java +++ b/web/src/main/java/org/springframework/security/web/header/writers/HpkpHeaderWriter.java @@ -414,8 +414,8 @@ public final class HpkpHeaderWriter implements HeaderWriter { try { this.reportUri = new URI(reportUri); } - catch (URISyntaxException e) { - throw new IllegalArgumentException(e); + catch (URISyntaxException ex) { + throw new IllegalArgumentException(ex); } updateHpkpHeaderValue(); } diff --git a/web/src/main/java/org/springframework/security/web/jaasapi/JaasApiIntegrationFilter.java b/web/src/main/java/org/springframework/security/web/jaasapi/JaasApiIntegrationFilter.java index 8d857382b8..6473e80f9f 100644 --- a/web/src/main/java/org/springframework/security/web/jaasapi/JaasApiIntegrationFilter.java +++ b/web/src/main/java/org/springframework/security/web/jaasapi/JaasApiIntegrationFilter.java @@ -98,8 +98,8 @@ public class JaasApiIntegrationFilter extends GenericFilterBean { try { Subject.doAs(subject, continueChain); } - catch (PrivilegedActionException e) { - throw new ServletException(e.getMessage(), e); + catch (PrivilegedActionException ex) { + throw new ServletException(ex.getMessage(), ex); } } diff --git a/web/src/main/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPoint.java b/web/src/main/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPoint.java index ad85f52306..35f6856662 100644 --- a/web/src/main/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPoint.java +++ b/web/src/main/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPoint.java @@ -59,7 +59,7 @@ public class DelegatingServerAuthenticationEntryPoint implements ServerAuthentic } @Override - public Mono commence(ServerWebExchange exchange, AuthenticationException e) { + public Mono commence(ServerWebExchange exchange, AuthenticationException ex) { return Flux.fromIterable(this.entryPoints).filterWhen(entry -> isMatch(exchange, entry)).next() .map(entry -> entry.getEntryPoint()).doOnNext(it -> { if (logger.isDebugEnabled()) { @@ -69,7 +69,7 @@ public class DelegatingServerAuthenticationEntryPoint implements ServerAuthentic if (logger.isDebugEnabled()) { logger.debug("No match found. Using default entry point " + this.defaultEntryPoint); } - })).flatMap(entryPoint -> entryPoint.commence(exchange, e)); + })).flatMap(entryPoint -> entryPoint.commence(exchange, ex)); } private Mono isMatch(ServerWebExchange exchange, DelegateEntry entry) { diff --git a/web/src/main/java/org/springframework/security/web/server/ServerAuthenticationEntryPoint.java b/web/src/main/java/org/springframework/security/web/server/ServerAuthenticationEntryPoint.java index 108be16860..3abf0a4668 100644 --- a/web/src/main/java/org/springframework/security/web/server/ServerAuthenticationEntryPoint.java +++ b/web/src/main/java/org/springframework/security/web/server/ServerAuthenticationEntryPoint.java @@ -32,10 +32,10 @@ public interface ServerAuthenticationEntryPoint { /** * Initiates the authentication flow * @param exchange - * @param e + * @param ex * @return {@code Mono} to indicate when the request for authentication is * complete */ - Mono commence(ServerWebExchange exchange, AuthenticationException e); + Mono commence(ServerWebExchange exchange, AuthenticationException ex); } diff --git a/web/src/main/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverter.java b/web/src/main/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverter.java index 80d9546ee2..322cc712db 100644 --- a/web/src/main/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverter.java +++ b/web/src/main/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverter.java @@ -72,7 +72,7 @@ public class ServerHttpBasicAuthenticationConverter implements Function commence(ServerWebExchange exchange, AuthenticationException e) { + public Mono commence(ServerWebExchange exchange, AuthenticationException ex) { return Mono.fromRunnable(() -> { ServerHttpResponse response = exchange.getResponse(); response.setStatusCode(HttpStatus.UNAUTHORIZED); diff --git a/web/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPoint.java b/web/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPoint.java index a6995f45c9..d4eedc4512 100644 --- a/web/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPoint.java +++ b/web/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPoint.java @@ -62,7 +62,7 @@ public class RedirectServerAuthenticationEntryPoint implements ServerAuthenticat } @Override - public Mono commence(ServerWebExchange exchange, AuthenticationException e) { + public Mono commence(ServerWebExchange exchange, AuthenticationException ex) { return this.requestCache.saveRequest(exchange) .then(this.redirectStrategy.sendRedirect(exchange, this.location)); } diff --git a/web/src/main/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandler.java b/web/src/main/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandler.java index 58a2308a9c..6aef6e1c17 100644 --- a/web/src/main/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandler.java +++ b/web/src/main/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandler.java @@ -49,12 +49,12 @@ public class HttpStatusServerAccessDeniedHandler implements ServerAccessDeniedHa } @Override - public Mono handle(ServerWebExchange exchange, AccessDeniedException e) { + public Mono handle(ServerWebExchange exchange, AccessDeniedException ex) { return Mono.defer(() -> Mono.just(exchange.getResponse())).flatMap(response -> { response.setStatusCode(this.httpStatus); response.getHeaders().setContentType(MediaType.TEXT_PLAIN); DataBufferFactory dataBufferFactory = response.bufferFactory(); - DataBuffer buffer = dataBufferFactory.wrap(e.getMessage().getBytes(Charset.defaultCharset())); + DataBuffer buffer = dataBufferFactory.wrap(ex.getMessage().getBytes(Charset.defaultCharset())); return response.writeWith(Mono.just(buffer)).doOnError(error -> DataBufferUtils.release(buffer)); }); } diff --git a/web/src/main/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcher.java b/web/src/main/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcher.java index 445c5d3b40..d455e37977 100644 --- a/web/src/main/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcher.java +++ b/web/src/main/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcher.java @@ -76,8 +76,8 @@ public class MediaTypeServerWebExchangeMatcher implements ServerWebExchangeMatch try { httpRequestMediaTypes = resolveMediaTypes(exchange); } - catch (NotAcceptableStatusException e) { - this.logger.debug("Failed to parse MediaTypes, returning false", e); + catch (NotAcceptableStatusException ex) { + this.logger.debug("Failed to parse MediaTypes, returning false", ex); return MatchResult.notMatch(); } if (this.logger.isDebugEnabled()) { diff --git a/web/src/main/java/org/springframework/security/web/servlet/util/matcher/MvcRequestMatcher.java b/web/src/main/java/org/springframework/security/web/servlet/util/matcher/MvcRequestMatcher.java index 7db8ab5983..9a9afc8efa 100644 --- a/web/src/main/java/org/springframework/security/web/servlet/util/matcher/MvcRequestMatcher.java +++ b/web/src/main/java/org/springframework/security/web/servlet/util/matcher/MvcRequestMatcher.java @@ -82,7 +82,7 @@ public class MvcRequestMatcher implements RequestMatcher, RequestVariablesExtrac try { return this.introspector.getMatchableHandlerMapping(request); } - catch (Throwable t) { + catch (Throwable ex) { return null; } } diff --git a/web/src/main/java/org/springframework/security/web/session/SessionManagementFilter.java b/web/src/main/java/org/springframework/security/web/session/SessionManagementFilter.java index 710191e2a0..90aaac9fdb 100644 --- a/web/src/main/java/org/springframework/security/web/session/SessionManagementFilter.java +++ b/web/src/main/java/org/springframework/security/web/session/SessionManagementFilter.java @@ -95,11 +95,11 @@ public class SessionManagementFilter extends GenericFilterBean { try { this.sessionAuthenticationStrategy.onAuthentication(authentication, request, response); } - catch (SessionAuthenticationException e) { + catch (SessionAuthenticationException ex) { // The session strategy can reject the authentication - this.logger.debug("SessionAuthenticationStrategy rejected the authentication object", e); + this.logger.debug("SessionAuthenticationStrategy rejected the authentication object", ex); SecurityContextHolder.clearContext(); - this.failureHandler.onAuthenticationFailure(request, response, e); + this.failureHandler.onAuthenticationFailure(request, response, ex); return; } diff --git a/web/src/main/java/org/springframework/security/web/util/matcher/AntPathRequestMatcher.java b/web/src/main/java/org/springframework/security/web/util/matcher/AntPathRequestMatcher.java index 5005f6a140..c0af6461d4 100644 --- a/web/src/main/java/org/springframework/security/web/util/matcher/AntPathRequestMatcher.java +++ b/web/src/main/java/org/springframework/security/web/util/matcher/AntPathRequestMatcher.java @@ -249,7 +249,7 @@ public final class AntPathRequestMatcher implements RequestMatcher, RequestVaria try { return HttpMethod.valueOf(method); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException ex) { } return null; diff --git a/web/src/main/java/org/springframework/security/web/util/matcher/IpAddressMatcher.java b/web/src/main/java/org/springframework/security/web/util/matcher/IpAddressMatcher.java index 08792192b5..8a2198d66b 100644 --- a/web/src/main/java/org/springframework/security/web/util/matcher/IpAddressMatcher.java +++ b/web/src/main/java/org/springframework/security/web/util/matcher/IpAddressMatcher.java @@ -101,8 +101,8 @@ public final class IpAddressMatcher implements RequestMatcher { try { return InetAddress.getByName(address); } - catch (UnknownHostException e) { - throw new IllegalArgumentException("Failed to parse address" + address, e); + catch (UnknownHostException ex) { + throw new IllegalArgumentException("Failed to parse address" + address, ex); } } diff --git a/web/src/main/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcher.java b/web/src/main/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcher.java index e9272c3f5a..42a7041e72 100644 --- a/web/src/main/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcher.java +++ b/web/src/main/java/org/springframework/security/web/util/matcher/MediaTypeRequestMatcher.java @@ -201,8 +201,8 @@ public final class MediaTypeRequestMatcher implements RequestMatcher { try { httpRequestMediaTypes = this.contentNegotiationStrategy.resolveMediaTypes(new ServletWebRequest(request)); } - catch (HttpMediaTypeNotAcceptableException e) { - this.logger.debug("Failed to parse MediaTypes, returning false", e); + catch (HttpMediaTypeNotAcceptableException ex) { + this.logger.debug("Failed to parse MediaTypes, returning false", ex); return false; } if (this.logger.isDebugEnabled()) { diff --git a/web/src/main/java/org/springframework/security/web/util/matcher/RegexRequestMatcher.java b/web/src/main/java/org/springframework/security/web/util/matcher/RegexRequestMatcher.java index ed1d25e04f..e802925e18 100644 --- a/web/src/main/java/org/springframework/security/web/util/matcher/RegexRequestMatcher.java +++ b/web/src/main/java/org/springframework/security/web/util/matcher/RegexRequestMatcher.java @@ -120,7 +120,7 @@ public final class RegexRequestMatcher implements RequestMatcher { try { return HttpMethod.valueOf(method); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException ex) { } return null; diff --git a/web/src/test/java/org/springframework/security/web/authentication/AuthenticationFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/AuthenticationFilterTests.java index 50d37da710..db70ace427 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/AuthenticationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/AuthenticationFilterTests.java @@ -240,11 +240,11 @@ public class AuthenticationFilterTests { try { filter.doFilter(request, response, chain); } - catch (ServletException e) { + catch (ServletException ex) { verifyZeroInteractions(this.successHandler); assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); - throw e; + throw ex; } } diff --git a/web/src/test/java/org/springframework/security/web/authentication/UsernamePasswordAuthenticationFilterTests.java b/web/src/test/java/org/springframework/security/web/authentication/UsernamePasswordAuthenticationFilterTests.java index 5c00f97145..4f53e17eca 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/UsernamePasswordAuthenticationFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/UsernamePasswordAuthenticationFilterTests.java @@ -129,7 +129,7 @@ public class UsernamePasswordAuthenticationFilterTests { filter.attemptAuthentication(request, new MockHttpServletResponse()); fail("Expected AuthenticationException"); } - catch (AuthenticationException e) { + catch (AuthenticationException ex) { } } diff --git a/web/src/test/java/org/springframework/security/web/authentication/logout/HttpStatusReturningLogoutSuccessHandlerTests.java b/web/src/test/java/org/springframework/security/web/authentication/logout/HttpStatusReturningLogoutSuccessHandlerTests.java index f0ee41cc4f..d4e399c6b7 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/logout/HttpStatusReturningLogoutSuccessHandlerTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/logout/HttpStatusReturningLogoutSuccessHandlerTests.java @@ -69,8 +69,8 @@ public class HttpStatusReturningLogoutSuccessHandlerTests { try { new HttpStatusReturningLogoutSuccessHandler(null); } - catch (IllegalArgumentException e) { - assertThat(e).hasMessage("The provided HttpStatus must not be null."); + catch (IllegalArgumentException ex) { + assertThat(ex).hasMessage("The provided HttpStatus must not be null."); return; } diff --git a/web/src/test/java/org/springframework/security/web/authentication/preauth/Http403ForbiddenEntryPointTests.java b/web/src/test/java/org/springframework/security/web/authentication/preauth/Http403ForbiddenEntryPointTests.java index 9d4fa105b8..d23a331918 100644 --- a/web/src/test/java/org/springframework/security/web/authentication/preauth/Http403ForbiddenEntryPointTests.java +++ b/web/src/test/java/org/springframework/security/web/authentication/preauth/Http403ForbiddenEntryPointTests.java @@ -38,8 +38,8 @@ public class Http403ForbiddenEntryPointTests { assertThat(resp.getStatus()).withFailMessage("Incorrect status") .isEqualTo(HttpServletResponse.SC_FORBIDDEN); } - catch (IOException e) { - fail("Unexpected exception thrown: " + e); + catch (IOException ex) { + fail("Unexpected exception thrown: " + ex); } } diff --git a/web/src/test/java/org/springframework/security/web/util/ThrowableAnalyzerTests.java b/web/src/test/java/org/springframework/security/web/util/ThrowableAnalyzerTests.java index 82895a0cd0..a0cb2c9609 100644 --- a/web/src/test/java/org/springframework/security/web/util/ThrowableAnalyzerTests.java +++ b/web/src/test/java/org/springframework/security/web/util/ThrowableAnalyzerTests.java @@ -96,7 +96,7 @@ public class ThrowableAnalyzerTests { fail("IllegalArgumentExpected"); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException ex) { // ok } } @@ -231,7 +231,7 @@ public class ThrowableAnalyzerTests { ThrowableAnalyzer.verifyThrowableHierarchy(null, Throwable.class); fail("IllegalArgumentException expected"); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException ex) { // ok } } @@ -244,7 +244,7 @@ public class ThrowableAnalyzerTests { ThrowableAnalyzer.verifyThrowableHierarchy(throwable, InvocationTargetException.class); fail("IllegalArgumentException expected"); } - catch (IllegalArgumentException e) { + catch (IllegalArgumentException ex) { // ok } }