Skip to content

Commit ccdaed5

Browse files
committed
Polishing contribution
Closes gh-34333
1 parent c41b014 commit ccdaed5

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

spring-messaging/src/main/java/org/springframework/messaging/simp/user/UserDestinationMessageHandler.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -280,11 +280,10 @@ public MessageSendingOperations<String> getMessagingTemplate() {
280280
return this.messagingTemplate;
281281
}
282282

283-
public void send(UserDestinationResult destinationResult, Message<?> message) throws MessagingException {
284-
Iterator<String> itr = destinationResult.getSessionIds().iterator();
285-
286-
for (String target : destinationResult.getTargetDestinations()) {
287-
String sessionId = (itr != null && itr.hasNext() ? itr.next() : null);
283+
public void send(UserDestinationResult result, Message<?> message) throws MessagingException {
284+
Iterator<String> itr = result.getSessionIds().iterator();
285+
for (String target : result.getTargetDestinations()) {
286+
String sessionId = (itr.hasNext() ? itr.next() : null);
288287
getTemplateToUse(sessionId).send(target, message);
289288
}
290289
}

spring-messaging/src/main/java/org/springframework/messaging/simp/user/UserDestinationResult.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -44,7 +44,11 @@ public class UserDestinationResult {
4444
private final Set<String> sessionIds;
4545

4646

47-
public UserDestinationResult(String sourceDestination, Set<String> targetDestinations,
47+
/**
48+
* Main constructor.
49+
*/
50+
public UserDestinationResult(
51+
String sourceDestination, Set<String> targetDestinations,
4852
String subscribeDestination, @Nullable String user) {
4953

5054
this(sourceDestination, targetDestinations, subscribeDestination, user, null);
@@ -114,7 +118,6 @@ public String getUser() {
114118
/**
115119
* Return the session id for the targetDestination.
116120
*/
117-
@Nullable
118121
public Set<String> getSessionIds() {
119122
return this.sessionIds;
120123
}

spring-messaging/src/test/java/org/springframework/messaging/simp/user/UserDestinationMessageHandlerTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)