Skip to content

Commit 0a852ca

Browse files
committed
avoid NPE when ClientResponseStatus comes back null from Jersey
1 parent 1ccbe88 commit 0a852ca

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/com/marklogic/client/impl/JerseyServices.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ public JerseyServices() {
173173
}
174174

175175
private FailedRequest extractErrorFields(ClientResponse response) {
176+
if ( response == null ) return null;
176177
InputStream is = response.getEntityInputStream();
177178
try {
178179
FailedRequest handler = FailedRequest.getFailedRequest(
@@ -1150,6 +1151,9 @@ else if (failure.getMessageCode().equals("RESTAPI-EMPTYBODY"))
11501151
"Empty request body sent to server", failure);
11511152
throw new FailedRequestException("Precondition Failed", failure);
11521153
}
1154+
if (status == null) {
1155+
throw new FailedRequestException("write failed: Unknown Reason", extractErrorFields(response));
1156+
}
11531157
if (status != ClientResponse.Status.CREATED
11541158
&& status != ClientResponse.Status.NO_CONTENT) {
11551159
throw new FailedRequestException("write failed: "

0 commit comments

Comments
 (0)