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

call equals on formatted strings since they will never be null #1211

Merged

Conversation

tsturzl
Copy link
Contributor

@tsturzl tsturzl commented Jan 11, 2024

(If this PR fixes a github issue, please add Fixes #<xyz>.)

Fixes #1210

Motivation

When running with TLS disabled PulsarServiceLookupHandler::isLookupMQTTBroker is calling localBrokerData.getPulsarServiceUrlTls() which returns null if TLS is disabled. This method then tried to call equals(..) on the returned value which is null causing a NullPointerException. This prevents MoP proxy from working properly, as it will never resolve the host and this loop will simply crash.

Modifications

Instead of calling equals on the values returned from localBrokerData, which can be null if missing in the metadata store, I instead call equals on the strings created which are compared against since those will never be null, but it's safe to pass null as an argument to String::equals. This prevents the NullPointerException with minimal change.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Documentation

Check the box below.

Need to update docs?

  • doc-required

    (If you need help on updating docs, create a doc issue)

  • no-need-doc

    (Please explain why)

  • doc

    (If this PR contains doc changes)

Copy link

@tsturzl:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@Technoboy- Technoboy- merged commit 62e93cb into streamnative:master Jan 17, 2024
41 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MoP proxy does not function properly when running without TLS
2 participants