Skip to content

Commit bb59466

Browse files
authored
Merge pull request #45 from ucloud/fix/nullpoint
fix(common): when response is not ok, fix nullpointer exception
2 parents c1494d5 + f3c6a7d commit bb59466

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ucloud-sdk-java-common/src/main/java/cn/ucloud/common/transport/DefaultTransport.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ public Response invoke(Request request, Class<? extends Response> clazz)
7979
} catch (Exception e) {
8080
throw new TransportException("http error", e);
8181
}
82-
String requestId = httpResponse.getLastHeader(HEADER_REQUEST_ID).getValue();
82+
83+
String requestId = "";
84+
if (httpResponse.getLastHeader(HEADER_REQUEST_ID) != null) {
85+
requestId = httpResponse.getLastHeader(HEADER_REQUEST_ID).getValue();
86+
}
8387

8488
// check http status
8589
StatusLine httpStatus = httpResponse.getStatusLine();

0 commit comments

Comments
 (0)