我不确定我的代码会在哪里导致错误:
com.sun.jersey.api.client.ClientHandlerException: java.io.IOException: Stream closed.
at com.sun.jersey.api.client.ClientResponse.bufferEntity(ClientResponse.java:583)
at moveit.PipelineMetadata.checkPipelineRunStatus(PipelineMetadata.java:1013)
它失败的代码行是:
ObjectMapper mapper = new ObjectMapper();
在代码中的这一部分:
ClientResponse response = webServiceConnect(siteLine) + "/status?rev=0").accept("application/json")
.get(ClientResponse.class);
// Pipeline not found
if (response.getStatus() == 500) {
throw new NoPipelineFoundException("Pipeline not found : " + response.getStatus());
}
// Other error
if (response.getStatus() != 200 && response.getStatus() != 500) {
throw new RuntimeException("Failed : HTTP error code : " + response.getStatus());
}
response.bufferEntity();
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
pipelineStatus = mapper.readValue(response.getEntity(String.class), PipelineStatus.class);
pipelineRunStatus = pipelineStatus.status;
return pipelineRunStatus;
我的代码是否有问题,或者这可能是网络服务器的超时问题?