Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApiException.getMessage throws NullPointerException when IOException occurs #30

Open
jlorenzen opened this issue Aug 21, 2023 · 1 comment
Labels
bug Something isn't working package: java-server-sdk

Comments

@jlorenzen
Copy link

jlorenzen commented Aug 21, 2023

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());
    }
@louis-launchdarkly
Copy link

Hello @jlorenzen, thank you for reporting this issue. We will look into this and get back to you.

Filed internally as 213590.

@tanderson-ld tanderson-ld transferred this issue from launchdarkly/java-server-sdk May 28, 2024
@tanderson-ld tanderson-ld added bug Something isn't working package: java-server-sdk labels May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package: java-server-sdk
Projects
None yet
Development

No branches or pull requests

3 participants