Refine null-safety in the spring-jms module
Closes gh-34157
This commit is contained in:
parent
be11e73d2c
commit
9516d9b822
|
@ -289,7 +289,7 @@ public abstract class CollectionUtils {
|
|||
* or {@code null} if none or more than one such value found
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> @Nullable T findValueOfType(Collection<?> collection, @Nullable Class<T> type) {
|
||||
public static <T> @Nullable T findValueOfType(@Nullable Collection<?> collection, @Nullable Class<T> type) {
|
||||
if (isEmpty(collection)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ public abstract class ConnectionFactoryUtils {
|
|||
* @return the transactional Session, or {@code null} if none found
|
||||
* @throws JMSException in case of JMS failure
|
||||
*/
|
||||
@SuppressWarnings("NullAway")
|
||||
@SuppressWarnings("NullAway") // Dataflow analysis limitation
|
||||
public static @Nullable Session doGetTransactionalSession(
|
||||
ConnectionFactory connectionFactory, ResourceFactory resourceFactory, boolean startConnection)
|
||||
throws JMSException {
|
||||
|
|
|
@ -215,7 +215,6 @@ public class JmsResourceHolder extends ResourceHolderSupport {
|
|||
* Return this resource holder's Session of the given type
|
||||
* for the given connection, or {@code null} if none.
|
||||
*/
|
||||
@SuppressWarnings("NullAway")
|
||||
public <S extends Session> @Nullable S getSession(Class<S> sessionType, @Nullable Connection connection) {
|
||||
Deque<Session> sessions =
|
||||
(connection != null ? this.sessionsPerConnection.get(connection) : this.sessions);
|
||||
|
|
|
@ -323,7 +323,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
|
|||
* @throws jakarta.jms.JMSException if thrown by JMS API methods
|
||||
* @see #initConnection()
|
||||
*/
|
||||
@SuppressWarnings("NullAway")
|
||||
@SuppressWarnings("NullAway") // Lazy initialization
|
||||
protected Connection getConnection() throws JMSException {
|
||||
this.connectionLock.lock();
|
||||
try {
|
||||
|
|
|
@ -1434,7 +1434,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("NullAway")
|
||||
@SuppressWarnings("NullAway") // Lazy initialization
|
||||
private void initResourcesIfNecessary() throws JMSException {
|
||||
if (getCacheLevel() <= CACHE_CONNECTION) {
|
||||
updateRecoveryMarker();
|
||||
|
|
|
@ -312,7 +312,7 @@ public class SimpleMessageListenerContainer extends AbstractMessageListenerConta
|
|||
* @throws JMSException if thrown by JMS methods
|
||||
* @see #executeListener
|
||||
*/
|
||||
@SuppressWarnings("NullAway")
|
||||
@SuppressWarnings("NullAway") // Lambda
|
||||
protected MessageConsumer createListenerConsumer(final Session session) throws JMSException {
|
||||
Destination destination = getDestination();
|
||||
if (destination == null) {
|
||||
|
@ -341,7 +341,7 @@ public class SimpleMessageListenerContainer extends AbstractMessageListenerConta
|
|||
* @see #executeListener
|
||||
* @see #setExposeListenerSession
|
||||
*/
|
||||
@SuppressWarnings("NullAway")
|
||||
@SuppressWarnings("NullAway") // Dataflow analysis limitation
|
||||
protected void processMessage(Message message, Session session) {
|
||||
ConnectionFactory connectionFactory = getConnectionFactory();
|
||||
boolean exposeResource = (connectionFactory != null && isExposeListenerSession());
|
||||
|
|
Loading…
Reference in New Issue