Skip to content

Commit

Permalink
Fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
jianghaolu committed Mar 21, 2016
1 parent 4d07844 commit 26c3d3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ public <THeader> ServiceResponseWithHeaders<T, THeader> buildWithHeaders(Respons
THeader headers = mapperAdapter.deserialize(
mapperAdapter.serialize(response.headers()),
headerType);
response.errorBody().close();
return new ServiceResponseWithHeaders<>(bodyResponse.getBody(), headers, bodyResponse.getResponse());
}

Expand All @@ -240,7 +239,6 @@ public <THeader> ServiceResponseWithHeaders<T, THeader> buildEmptyWithHeaders(Re
THeader headers = mapperAdapter.deserialize(
mapperAdapter.serialize(response.headers()),
headerType);
response.errorBody().close();
return new ServiceResponseWithHeaders<>(headers, bodyResponse.getHeadResponse());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ public Response intercept(Chain chain) throws IOException {
int tryCount = 0;
while (retryStrategy.shouldRetry(tryCount, response)) {
tryCount++;
response.body().close();
if (response.body() != null) {
response.body().close();
}
// retry the request
response = chain.proceed(request);
}
Expand Down

0 comments on commit 26c3d3a

Please sign in to comment.