Skip to content

Apply NullAbility to MQTT module #10274

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

Merged
merged 8 commits into from
Aug 4, 2025
Merged

Conversation

mjd507
Copy link
Contributor

@mjd507 mjd507 commented Jul 31, 2025

Related to: #10083

Message<?> toMessage(byte[] bytes, @Nullable Map<String, Object> headers);

@Override
byte @NonNull [] fromMessage(Message<?> message);
Copy link
Member

Choose a reason for hiding this comment

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

We don’t need @NonNull at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, yes. removed.

@@ -34,7 +36,7 @@ public class MqttMessageNotDeliveredEvent extends MqttMessageDeliveryEvent {

private final Throwable exception;

public MqttMessageNotDeliveredEvent(Object source, int messageId, String clientId,
public MqttMessageNotDeliveredEvent(Object source, int messageId, @Nullable String clientId,
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to revise clientId. It is not null this or other way.
See AbstractMqttClientManager.getClientId().
We should utilize that in the AbstractMqttMessageHandler.getClientId() as an if..else to return provided clientId or the one supplied by the clientManager

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed. i extract getClientId() to the top ClientManager interface. also getUrl().
for inbound/outbound adapters, in their ctors, if url/client not provided, will be assigned from the clientManager.

mjd507 added 3 commits August 2, 2025 19:34
Signed-off-by: Jiandong Ma <[email protected]>
Signed-off-by: Jiandong Ma <[email protected]>
mjd507 added 2 commits August 4, 2025 23:04
suppress with NullAway for `toMessageBuilder` in v3 inbound adapter.

Signed-off-by: Jiandong Ma <[email protected]>
@mjd507 mjd507 requested a review from artembilan August 4, 2025 15:55
@artembilan artembilan merged commit 86e86fe into spring-projects:main Aug 4, 2025
3 checks passed
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