Update exception variable names
Consistently use `ex` for caught exception and `cause` for Exception constructor arguments. Issue gh-8945
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user