diff --git a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/transport/DefaultTransport.java b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/transport/DefaultTransport.java index 105e67e9..ac31520c 100644 --- a/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/transport/DefaultTransport.java +++ b/ucloud-sdk-java-common/src/main/java/cn/ucloud/common/transport/DefaultTransport.java @@ -79,7 +79,11 @@ public Response invoke(Request request, Class 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();