Skip to content

Commit

Permalink
Merge pull request #45 from ucloud/fix/nullpoint
Browse files Browse the repository at this point in the history
fix(common): when response is not ok, fix nullpointer exception
  • Loading branch information
wangrzneu authored Dec 6, 2022
2 parents c1494d5 + f3c6a7d commit bb59466
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ public Response invoke(Request request, Class<? extends Response> clazz)
} catch (Exception e) {
throw new TransportException("http error", e);
}
String requestId = httpResponse.getLastHeader(HEADER_REQUEST_ID).getValue();

String requestId = "";
if (httpResponse.getLastHeader(HEADER_REQUEST_ID) != null) {
requestId = httpResponse.getLastHeader(HEADER_REQUEST_ID).getValue();
}

// check http status
StatusLine httpStatus = httpResponse.getStatusLine();
Expand Down

0 comments on commit bb59466

Please sign in to comment.