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

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

View File

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

View File

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

View File

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

View File

@@ -231,7 +231,7 @@ public class OpenIDAuthenticationProviderTests {
provider.afterPropertiesSet();
fail("IllegalArgumentException expected, ssoAuthoritiesPopulator is null");
}
catch (IllegalArgumentException e) {
catch (IllegalArgumentException ex) {
// expected
}