The GitHub Actions job "License checker" on 
rocketmq.git/fix/topic-publish-info-select-empty-queue-list has failed.
Run started by GitHub user zjncs (triggered by zjncs).

Head commit for run:
133dce6d11cb6dbd333819c6399fa858c40344c3 / zjncs <[email protected]>
[ISSUE #D2] Return null when selecting from a route-less TopicPublishInfo

TopicPublishInfo exposes three selectOneMessageQueue overloads with
inconsistent contracts: the QueueFilter variant returns null when the
queue list is null or empty, while the no-arg and lastBrokerName
variants dereference the list and throw a raw NullPointerException
(null list) or ArithmeticException (empty list, x % 0). A topic whose
route exists but has no writable queue legitimately produces such an
info object (topicRouteData2TopicPublishInfo adds nothing when every
QueueData is read-only), and MQFaultStrategy falls back to the unguarded
no-arg variant, e.g. in the async-send retry path where onExceptionImpl
only null-checks the info instead of checking ok() like every send
entry point does.

Align both variants with the QueueFilter variant (return null), and make
onExceptionImpl apply the same ok() contract so a route-less info keeps
the 'retry the same broker' default instead of feeding the selector.

Tests: TopicPublishInfoTest (new). Fail-before on unpatched develop:
- selectOneMessageQueue with empty/null list: ArithmeticException / by
  zero, NullPointerException at List.size()
- selectOneMessageQueue(lastBrokerName) with empty/null list: same.
Pass-after: TopicPublishInfoTest 5/5 and SelectMessageQueueRetryTest
1/1 unchanged.

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

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

With regards,
GitHub Actions via GitBox

Reply via email to