Skip to content

[ISSUE #411] Fix NPE when getAllSubscriptionGroup returns null#412

Closed
itxaiohanglover wants to merge 1 commit into
apache:masterfrom
itxaiohanglover:fix/subscription-group-wrapper-npe
Closed

[ISSUE #411] Fix NPE when getAllSubscriptionGroup returns null#412
itxaiohanglover wants to merge 1 commit into
apache:masterfrom
itxaiohanglover:fix/subscription-group-wrapper-npe

Conversation

@itxaiohanglover

Copy link
Copy Markdown

Which Issue(s) This PR Fixes

Fixes #411

Brief Description

When mqAdminExt.getAllSubscriptionGroup() returns null (e.g. broker not reachable, ACL denied, or 5.x Proxy mode where the call is not supported), the code at line 183 calls subscriptionGroupWrapper.getSubscriptionGroupTable() which throws:

Cannot invoke "SubscriptionGroupWrapper.getSubscriptionGroupTable()" because "subscriptionGroupWrapper" is null

Root cause: No null check on the return value of getAllSubscriptionGroup() before accessing its methods.

Fix:

  1. Add null check inside the broker loop — if getAllSubscriptionGroup returns null, log a warning and skip to the next broker instead of crashing.
  2. Fix the post-loop null check (line 197): the original condition subscriptionGroupWrapper != null && ...isEmpty() would fall through to line 202 and NPE if subscriptionGroupWrapper was null (e.g. empty broker table). Changed to subscriptionGroupWrapper == null || ...isEmpty() to handle both cases.

How Did You Test This Change?

Manual code review against the issue stack trace. The fix follows the same null-guard pattern already used elsewhere in the codebase (e.g. examineSubscriptionGroupConfig fallback at line 218).

When mqAdminExt.getAllSubscriptionGroup() returns null (e.g. broker
not reachable or ACL denied), the code calls
subscriptionGroupWrapper.getSubscriptionGroupTable() which throws NPE.

Add null check after getAllSubscriptionGroup call, skip to next broker
if null. Also fix post-loop check to handle null (empty broker table).
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no activity for 7 days. If you would like to continue working on this, please reopen the PR with updated changes.

@github-actions github-actions Bot added the stale label Jul 19, 2026
@github-actions github-actions Bot closed this Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

1 participant