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

Possible run-time exception on empty response topic #607

Open
jyoo980 opened this issue Dec 11, 2023 · 0 comments
Open

Possible run-time exception on empty response topic #607

jyoo980 opened this issue Dec 11, 2023 · 0 comments
Labels

Comments

@jyoo980
Copy link

jyoo980 commented Dec 11, 2023

I was looking at some code in RequestResponse.java

and noticed a call to get() here:

.topic(requestPublish.getResponseTopic().get())

will crash with a NoSuchElementException at run time if the response topic is ever an empty Optional. This appears to be a possibility, as getResponseTopic() returns an Optional.ofNullable of a nullable field responseTopic:

private final @Nullable MqttTopicImpl responseTopic;

public @NotNull Optional<MqttTopic> getResponseTopic() {
  return Optional.ofNullable(responseTopic);
}

I am happy to write a patch for this, if desired - thanks!

@jyoo980 jyoo980 added the bug label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant