Skip to content

Fix potential NullPointerException in JMSReplySender.sendBack()#1839

Open
Sunny-Hasho wants to merge 1 commit into
wso2:masterfrom
Sunny-Hasho:fix-jms-reply-sender-npe
Open

Fix potential NullPointerException in JMSReplySender.sendBack()#1839
Sunny-Hasho wants to merge 1 commit into
wso2:masterfrom
Sunny-Hasho:fix-jms-reply-sender-npe

Conversation

@Sunny-Hasho

Copy link
Copy Markdown

Purpose

Fix a potential NullPointerException in JMSReplySender.sendBack() when JMS connection or session creation fails before producer and session are initialized.

Goals

Ensure the finally block in sendBack() does not throw a NullPointerException that masks the original JMS error.

Approach

Added null checks for producer and session before calling .close() in the finally block of JMSReplySender.sendBack().

Both producer and session are initialized to null at the start of the method. If an exception is thrown during getConnection(), getSession(), or createProducer(), these variables remain null. The finally block then calls .close() on a null reference, causing a NullPointerException that hides the original error.

Release note

Fixed a potential NullPointerException in JMS inbound endpoint reply sender when connection setup fails.

Documentation

N/A — No public API or configuration change.

Automation tests

  • Unit tests
    No new tests required. Existing JMSReplySenderTest tests continue to pass. No change in method signatures or behavior.
  • Integration tests
    N/A

Security checks

@Sunny-Hasho
Sunny-Hasho requested a review from arunans23 as a code owner July 7, 2026 18:05
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sunny-Hasho, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3246bf31-ade2-4db1-b331-3700a1073930

📥 Commits

Reviewing files that changed from the base of the PR and between 77b3ee1 and 5709310.

📒 Files selected for processing (1)
  • components/inbound-endpoints/org.wso2.carbon.inbound.endpoint/src/main/java/org/wso2/carbon/inbound/endpoint/protocol/jms/JMSReplySender.java
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sunny-Hasho

Copy link
Copy Markdown
Author

Hi @RakhithaRR , could you please take a look at this quick NullPointerException fix when you have a moment? Thanks!

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.

1 participant