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

handle SocketOptions not being set #455

Merged
merged 1 commit into from
Aug 8, 2023
Merged

handle SocketOptions not being set #455

merged 1 commit into from
Aug 8, 2023

Conversation

jmklix
Copy link
Member

@jmklix jmklix commented Aug 8, 2023

Issue #, if available:
awslabs/aws-crt-java#650

Description of changes:
create new SocketOptions if it doesn't exist to avoid null pointer exception

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -360,6 +360,9 @@ public AwsIotMqttConnectionBuilder withProtocolOperationTimeoutMs(int protocolOp
* @return {@link AwsIotMqttConnectionBuilder}
*/
public AwsIotMqttConnectionBuilder withTimeoutMs(int timeoutMs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for this to be called before withSocketOptions() is called? If so, it's possible a customer may set withTimeoutMs() using this which is then overridden by the withSocketOptions(). Maybe we should also add a null check to withSocketOptions() and if it's not null, copy over the timeout from it to the newly set socket options. Or that may be overcomplicating things and we just allow the timeout to be overwritten if the customer somehow decides to use both.

@jmklix jmklix merged commit a198a0e into main Aug 8, 2023
23 checks passed
@jmklix jmklix deleted the issue_650 branch August 8, 2023 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

withTimeoutMs will throw a null pointer exception if there is no SocketOptions previously set
2 participants