Update exception variable names

Consistently use `ex` for caught exception and `cause` for Exception
constructor arguments.

Issue gh-8945
This commit is contained in:
Phillip Webb
2020-07-28 23:53:30 -07:00
committed by Rob Winch
parent e9130489a6
commit 8d80166aaf
194 changed files with 635 additions and 633 deletions

View File

@@ -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);

View File

@@ -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) {
}
}
}

View File

@@ -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");
}
}