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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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