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

Misleading exception when endpoint isn't configured. java.lang.NullPointerException: "this.httpClient" is null #589

Open
e3ndr opened this issue Apr 6, 2024 · 0 comments
Labels
SDK Issue pertains to the SDK itself and not specific to any service

Comments

@e3ndr
Copy link

e3ndr commented Apr 6, 2024

This is a low-priority issue, but when calling the API without an endpoint the SDK appears to not be configuring the http client, rather than throwing an error early-on informing the user that an endpoint is required. This only occurs on 3.x, 2.x properly throws an error for the missing endpoint early-on.

Code to reproduce:

        this.containerClient = ContainerInstanceClient
            .builder()
            // .endpoint("https://compute-containers.us-ashburn-1.oci.oraclecloud.com") // Omit to reproduce.
            .build(provider);
            
        // Call any API now.

Stacktrace:

Caused by: java.lang.NullPointerException: Cannot invoke "com.oracle.bmc.http.client.HttpClient.createRequest(com.oracle.bmc.http.client.Method)" because "this.httpClient" is null
 	at com.oracle.bmc.http.internal.ClientCall.method(ClientCall.java:173)
 	at com.oracle.bmc.containerinstances.ContainerInstanceClient.createContainerInstance(ContainerInstanceClient.java:202)
 	... 5 more

It should also be noted that the Oracle docs that give the SDK copy/paste examples don't tell you that you need to configure the endpoint.

@bhagwatvyas bhagwatvyas added the SDK Issue pertains to the SDK itself and not specific to any service label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SDK Issue pertains to the SDK itself and not specific to any service
Projects
None yet
Development

No branches or pull requests

2 participants