File tree Expand file tree Collapse file tree
main/java/com/marklogic/client
test/java/com/marklogic/client/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
2+ * Copyright (c) 2010-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
33 */
44package com .marklogic .client ;
55
66import com .marklogic .client .impl .FailedRequest ;
7+ import com .marklogic .client .impl .RESTServices ;
78
89/**
910 * Abstract class that implements functionality for errors returned from a MarkLogic REST API instance.
@@ -51,7 +52,7 @@ else if (failedRequest != null) {
5152 * @return the status code
5253 */
5354 public int getServerStatusCode () {
54- return (failedRequest == null ) ? null : failedRequest .getStatusCode ();
55+ return (failedRequest == null ) ? RESTServices . STATUS_UNKNOWN : failedRequest .getStatusCode ();
5556 }
5657 /**
5758 * Gets the HTTP status message (if any) associated with the error on the server.
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
2+ * Copyright (c) 2010-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
33 */
44package com .marklogic .client .impl ;
55
@@ -68,6 +68,7 @@ public interface RESTServices {
6868 String MIMETYPE_APPLICATION_XML = "application/xml" ;
6969 String MIMETYPE_MULTIPART_MIXED = "multipart/mixed" ;
7070
71+ int STATUS_UNKNOWN = -1 ;
7172 int STATUS_OK = 200 ;
7273 int STATUS_CREATED = 201 ;
7374 int STATUS_NO_CONTENT = 204 ;
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
2+ * Copyright (c) 2010-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
33 */
44package com .marklogic .client .test ;
55
66import com .marklogic .client .*;
77import com .marklogic .client .admin .QueryOptionsManager ;
88import com .marklogic .client .document .XMLDocumentManager ;
9+ import com .marklogic .client .impl .FailedRequest ;
910import com .marklogic .client .io .Format ;
1011import com .marklogic .client .io .StringHandle ;
1112import org .junit .jupiter .api .Test ;
@@ -100,4 +101,15 @@ public void testFailedRequestParsing() {
100101 fail ("Call failed with unexpected exception: " +e .getMessage ());
101102 }
102103 }
104+
105+ @ Test
106+ public void testNullFailedRequestInFailedRequestException () {
107+ FailedRequestException e = new FailedRequestException ("test" , (FailedRequest ) null );
108+ assertEquals ("test" , e .getMessage ());
109+ assertEquals (-1 , e .getServerStatusCode ());
110+ assertNull (e .getServerStatus ());
111+ assertNull (e .getServerMessageCode ());
112+ assertNull (e .getServerMessage ());
113+ assertNull (e .getServerStackTrace ());
114+ }
103115}
You can’t perform that action at this time.
0 commit comments