The GitHub Actions job "Coverage" on 
rocketmq.git/fix/broker2client-get-consume-status-null-group has failed.
Run started by GitHub user zjncs (triggered by zjncs).

Head commit for run:
e1edaf7cecfe762fea80fe3b4352a2447ed880bd / zjncs <[email protected]>
[ISSUE #D4] Fix getConsumeStatus NPE for a group absent from ConsumerManager

Broker2Client.getConsumeStatus dereferences
getConsumerManager().getConsumerGroupInfo(group).getChannelInfoTable()
and only afterwards checks the result for null/empty. When the queried
consumer group has no consumer registered on this broker (the normal
case for an offline group), getConsumerGroupInfo returns null and the
method throws NPE — making the 'No Any Consumer online in the consumer
group' error branch unreachable for exactly the case it was written for.
The sibling resetOffset method checks the group info for null first.

Move the null check before the dereference: fetch the ConsumerGroupInfo,
fall into the existing error branch when it is absent or has no channel,
and only then read the channel table.

Reached from mqadmin getConsumerStatus (RequestCode
INVOKE_BROKER_TO_GET_CONSUMER_STATUS -> AdminBrokerProcessor
.getConsumerStatus -> this method), where the NPE currently surfaces as
a bare SYSTEM_ERROR with a null-pointer remark.

Test: Broker2ClientTest#testGetConsumeStatusGroupNotRegistered fails
with NPE on unpatched code and returns SYSTEM_ERROR with the intended
remark after the fix (class: 9/9).

Signed-off-by: zjncs <[email protected]>

Report URL: https://github.com/apache/rocketmq/actions/runs/34440649125

With regards,
GitHub Actions via GitBox

Reply via email to