File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
src/main/resources/handlebars/Java/libraries Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -113,8 +113,14 @@ public class OAuth implements Interceptor {
113
113
114
114
// 401/403 most likely indicates that access token has expired. Unless it happens two times in a row.
115
115
if ( response != null && (response.code() == HTTP_UNAUTHORIZED || response.code() == HTTP_FORBIDDEN) && updateTokenAndRetryOnAuthorizationFailure ) {
116
- if (updateAccessToken(requestAccessToken)) {
117
- return retryingIntercept( chain, false );
116
+ try {
117
+ if (updateAccessToken(requestAccessToken)) {
118
+ response.body().close();
119
+ return retryingIntercept( chain, false );
120
+ }
121
+ } catch (Exception e) {
122
+ response.body().close();
123
+ throw e;
118
124
}
119
125
}
120
126
return response;
Original file line number Diff line number Diff line change @@ -113,8 +113,15 @@ public class OAuth implements Interceptor {
113
113
114
114
// 401/403 most likely indicates that access token has expired. Unless it happens two times in a row.
115
115
if ( response != null && (response.code() == HTTP_UNAUTHORIZED || response.code() == HTTP_FORBIDDEN) && updateTokenAndRetryOnAuthorizationFailure ) {
116
- if (updateAccessToken(requestAccessToken)) {
117
- return retryingIntercept( chain, false );
116
+ if ( response != null && (response.code() == HTTP_UNAUTHORIZED || response.code() == HTTP_FORBIDDEN) && updateTokenAndRetryOnAuthorizationFailure ) {
117
+ try {
118
+ if (updateAccessToken(requestAccessToken)) {
119
+ response.body().close();
120
+ return retryingIntercept( chain, false );
121
+ }
122
+ } catch (Exception e) {
123
+ response.body().close();
124
+ throw e;
118
125
}
119
126
}
120
127
return response;
You can’t perform that action at this time.
0 commit comments