java-server-sdk
java-server-sdk copied to clipboard
ApiException.getMessage throws NullPointerException when IOException occurs
Describe the bug
I'm noticing a NullPointerException when an IO error happens and I attempt to call the ApiException.getMessage method.
To reproduce
Trigger an IOException when using the java sdk. I'm triggering this using mock-server's withDropConnection feature.
Expected behavior I should not see an NPE.
SDK version
13.0.0
Language version, developer tools Java 17
OS/platform M1 Mac
Additional context
I believe the issue is because when an IO errors happens, the headers are null and this line in ApiException is what throws the NPE.
public String getMessage() {
return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s",
super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders().toString());
}
Hello @jlorenzen, thank you for reporting this issue. We will look into this and get back to you.
Filed internally as 213590.