Update exception variable names
Consistently use `ex` for caught exception and `cause` for Exception constructor arguments. Issue gh-8945
This commit is contained in:
@@ -62,8 +62,8 @@ public class InvalidConfigurationTests {
|
||||
setContext("<http auto-config='true' />");
|
||||
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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class SpringTestContext implements Closeable {
|
||||
try {
|
||||
this.context.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user