Browse Source

Declare remaining messageSelector parameters in JmsOperations as @⁠Nullable

Closes gh-35151
pull/35405/head
Sam Brannen 6 months ago
parent
commit
133f330850
  1. 12
      spring-jms/src/main/java/org/springframework/jms/core/JmsOperations.java
  2. 16
      spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate.java

12
spring-jms/src/main/java/org/springframework/jms/core/JmsOperations.java

@ -336,7 +336,7 @@ public interface JmsOperations { @@ -336,7 +336,7 @@ public interface JmsOperations {
* @throws JmsException checked JMSException converted to unchecked
*/
@Nullable
Object receiveSelectedAndConvert(String messageSelector) throws JmsException;
Object receiveSelectedAndConvert(@Nullable String messageSelector) throws JmsException;
/**
* Receive a message synchronously from the specified destination, but only
@ -351,7 +351,7 @@ public interface JmsOperations { @@ -351,7 +351,7 @@ public interface JmsOperations {
* @throws JmsException checked JMSException converted to unchecked
*/
@Nullable
Object receiveSelectedAndConvert(Destination destination, String messageSelector) throws JmsException;
Object receiveSelectedAndConvert(Destination destination, @Nullable String messageSelector) throws JmsException;
/**
* Receive a message synchronously from the specified destination, but only
@ -367,7 +367,7 @@ public interface JmsOperations { @@ -367,7 +367,7 @@ public interface JmsOperations {
* @throws JmsException checked JMSException converted to unchecked
*/
@Nullable
Object receiveSelectedAndConvert(String destinationName, String messageSelector) throws JmsException;
Object receiveSelectedAndConvert(String destinationName, @Nullable String messageSelector) throws JmsException;
//---------------------------------------------------------------------------------------
@ -468,7 +468,7 @@ public interface JmsOperations { @@ -468,7 +468,7 @@ public interface JmsOperations {
* @throws JmsException checked JMSException converted to unchecked
*/
@Nullable
<T> T browseSelected(String messageSelector, BrowserCallback<T> action) throws JmsException;
<T> T browseSelected(@Nullable String messageSelector, BrowserCallback<T> action) throws JmsException;
/**
* Browse selected messages in a JMS queue. The callback gives access to the JMS
@ -481,7 +481,7 @@ public interface JmsOperations { @@ -481,7 +481,7 @@ public interface JmsOperations {
* @throws JmsException checked JMSException converted to unchecked
*/
@Nullable
<T> T browseSelected(Queue queue, String messageSelector, BrowserCallback<T> action) throws JmsException;
<T> T browseSelected(Queue queue, @Nullable String messageSelector, BrowserCallback<T> action) throws JmsException;
/**
* Browse selected messages in a JMS queue. The callback gives access to the JMS
@ -495,6 +495,6 @@ public interface JmsOperations { @@ -495,6 +495,6 @@ public interface JmsOperations {
* @throws JmsException checked JMSException converted to unchecked
*/
@Nullable
<T> T browseSelected(String queueName, String messageSelector, BrowserCallback<T> action) throws JmsException;
<T> T browseSelected(String queueName, @Nullable String messageSelector, BrowserCallback<T> action) throws JmsException;
}

16
spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate.java

@ -763,13 +763,13 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations @@ -763,13 +763,13 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
@Override
@Nullable
public Message receiveSelected(final Destination destination, @Nullable final String messageSelector) throws JmsException {
public Message receiveSelected(Destination destination, @Nullable String messageSelector) throws JmsException {
return execute(session -> doReceive(session, destination, messageSelector), true);
}
@Override
@Nullable
public Message receiveSelected(final String destinationName, @Nullable final String messageSelector) throws JmsException {
public Message receiveSelected(String destinationName, @Nullable String messageSelector) throws JmsException {
return execute(session -> {
Destination destination = resolveDestinationName(session, destinationName);
return doReceive(session, destination, messageSelector);
@ -857,19 +857,19 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations @@ -857,19 +857,19 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
@Override
@Nullable
public Object receiveSelectedAndConvert(String messageSelector) throws JmsException {
public Object receiveSelectedAndConvert(@Nullable String messageSelector) throws JmsException {
return doConvertFromMessage(receiveSelected(messageSelector));
}
@Override
@Nullable
public Object receiveSelectedAndConvert(Destination destination, String messageSelector) throws JmsException {
public Object receiveSelectedAndConvert(Destination destination, @Nullable String messageSelector) throws JmsException {
return doConvertFromMessage(receiveSelected(destination, messageSelector));
}
@Override
@Nullable
public Object receiveSelectedAndConvert(String destinationName, String messageSelector) throws JmsException {
public Object receiveSelectedAndConvert(String destinationName, @Nullable String messageSelector) throws JmsException {
return doConvertFromMessage(receiveSelected(destinationName, messageSelector));
}
@ -1022,7 +1022,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations @@ -1022,7 +1022,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
@Override
@Nullable
public <T> T browseSelected(String messageSelector, BrowserCallback<T> action) throws JmsException {
public <T> T browseSelected(@Nullable String messageSelector, BrowserCallback<T> action) throws JmsException {
Queue defaultQueue = getDefaultQueue();
if (defaultQueue != null) {
return browseSelected(defaultQueue, messageSelector, action);
@ -1034,7 +1034,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations @@ -1034,7 +1034,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
@Override
@Nullable
public <T> T browseSelected(final Queue queue, @Nullable final String messageSelector, final BrowserCallback<T> action)
public <T> T browseSelected(Queue queue, @Nullable String messageSelector, BrowserCallback<T> action)
throws JmsException {
Assert.notNull(action, "Callback object must not be null");
@ -1051,7 +1051,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations @@ -1051,7 +1051,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
@Override
@Nullable
public <T> T browseSelected(final String queueName, @Nullable final String messageSelector, final BrowserCallback<T> action)
public <T> T browseSelected(String queueName, @Nullable String messageSelector, BrowserCallback<T> action)
throws JmsException {
Assert.notNull(action, "Callback object must not be null");

Loading…
Cancel
Save