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

Added null checks to fix NPEs uncovered during testing #111

Closed
wants to merge 2 commits into from

Conversation

david-streamlio
Copy link
Contributor

@david-streamlio david-streamlio commented Jul 31, 2023

Found two separate locations in which an internal variable is referenced before checking to see is it is null or not. Both of these missing checks resulted in NullPointerExceptions during testing.

@david-streamlio david-streamlio changed the title Added null checks to fix NPEs uncovered during CTS testing Added null checks to fix NPEs uncovered during testing Jul 31, 2023
@@ -1095,7 +1099,9 @@ void acknowledgeInternal() throws JMSException {
return;
}
try {
consumer.acknowledge(receivedPulsarMessage, this, pulsarConsumer);
if (consumer != null) {
consumer.acknowledge(receivedPulsarMessage, this, pulsarConsumer);
Copy link
Collaborator

Choose a reason for hiding this comment

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

in this case we should throw an IllegalStateException here.

how did you see an error here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suspected that an IllegalStateException was the better approach, so I can make that change. As for how I ended up here, I am still trying to figure that out, but I suspect it has something to do with not closing the PulsarSession and/or PulsarConnection object between calls.

Copy link
Collaborator

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

Lgtm

@delete-merged-branch delete-merged-branch bot deleted the null-check branch August 22, 2023 13:55
@eolivelli eolivelli closed this Apr 16, 2024
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.

2 participants