Skip to content

fix(client): Correct verbosity of correlation warnings and fix the callback context map#1357

Merged
jamdavi merged 6 commits intomasterfrom
jamdavi/issue1349
Sep 15, 2021
Merged

fix(client): Correct verbosity of correlation warnings and fix the callback context map#1357
jamdavi merged 6 commits intomasterfrom
jamdavi/issue1349

Conversation

@jamdavi
Copy link
Copy Markdown
Contributor

@jamdavi jamdavi commented Sep 14, 2021

This addresses issue #1349 and fixes the following problems

  • Too many warning messages for the correlation callback not being set, which is optional
  • Fix NPE if no callback context is specified
  • Fix NPE if correlationId is null

@jamdavi
Copy link
Copy Markdown
Contributor Author

jamdavi commented Sep 14, 2021

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 4 pipeline(s).

correlationCallbackContexts.put(messageId, message.getCorrelatingMessageCallbackContext());
correlationCallbacks.get(messageId).onRequestQueued(message, packet, correlationCallbackContexts.get(messageId));
correlationCallbacks.put(correlationId, message.getCorrelatingMessageCallback());
if (message.getCorrelatingMessageCallbackContext() != null)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider calling and caching the result, so you don't have to call it twice.

Copy link
Copy Markdown

@DBY047 DBY047 Sep 14, 2021

Choose a reason for hiding this comment

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

I don't see the point of adding a check or correlationId to be != null . message.getCorrelationId(); can't return null.

Am-I missing something?

    /**
     * Getter for the correlationId property
     * @return The property value
     */
    public String getCorrelationId()    
    {
        // Codes_SRS_MESSAGE_34_045: [The function shall return the message's correlation ID.]
        if (correlationId == null)
        {
            return "";
        }

        return correlationId;
    }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah I see, yes, that method is changed on my end (as part of a larger refactor) to a Lombok Getter/Setter but it isn't guarded with @nonnull. Thanks for catching that as I wasn't in the master branch when I was looking at the code.

I've updated the branch I'm working on to keep this behavior.

@jamdavi
Copy link
Copy Markdown
Contributor Author

jamdavi commented Sep 14, 2021

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 4 pipeline(s).

@jamdavi
Copy link
Copy Markdown
Contributor Author

jamdavi commented Sep 14, 2021

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 4 pipeline(s).

@jamdavi
Copy link
Copy Markdown
Contributor Author

jamdavi commented Sep 15, 2021

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 4 pipeline(s).

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.

4 participants