Buggy code:
public abstract class AbstractMessageListenerContainer extends AbstractJmsListeningContainer { private volatile Object destination ; private volatile String messageSelector ; private volatile Object messageListener ; private boolean subscriptionDurable = false ; private String durableSubscriptionName ; private ExceptionListener exceptionListener ; private ErrorHandler errorHandler ; private boolean exposeListenerSession = true ; private boolean acceptMessagesWhileStopping = false ; public void setDestination ( Destination destination ) { } public Destination getDestination ( ) { } public void setDestinationName ( String destinationName ) { } public String getDestinationName ( ) { } protected String getDestinationDescription ( ) { } public void setMessageSelector ( String messageSelector ) { } public String getMessageSelector ( ) { } public void setMessageListener ( Object messageListener ) { } public Object getMessageListener ( ) { } protected void checkMessageListener ( Object messageListener ) { } protected String getDefaultSubscriptionName ( Object messageListener ) { } public void setSubscriptionDurable ( boolean subscriptionDurable ) { } public boolean isSubscriptionDurable ( ) { } public void setDurableSubscriptionName ( String durableSubscriptionName ) { } public String getDurableSubscriptionName ( ) { } public void setExceptionListener ( ExceptionListener exceptionListener ) { } public ExceptionListener getExceptionListener ( ) { } public void setErrorHandler ( ErrorHandler errorHandler ) { } public void setExposeListenerSession ( boolean exposeListenerSession ) { } public boolean isExposeListenerSession ( ) { } public void setAcceptMessagesWhileStopping ( boolean acceptMessagesWhileStopping ) { } public boolean isAcceptMessagesWhileStopping ( ) { } protected void validateConfiguration ( ) { } protected void executeListener ( Session session , Message message ) { } protected void doExecuteListener ( Session session , Message message ) throws JMSException { } protected void invokeListener ( Session session , Message message ) throws JMSException { } @ SuppressWarnings ( "unchecked" ) protected void doInvokeListener ( SessionAwareMessageListener listener , Session session , Message message ) throws JMSException { } protected void doInvokeListener ( MessageListener listener , Message message ) throws JMSException { } protected void commitIfNecessary ( Session session , Message message ) throws JMSException { if ( session . getTransacted ( ) ) { if ( isSessionLocallyTransacted ( session ) ) { JmsUtils . commitIfNecessary ( session ) ; } } else <START_BUG> if ( isClientAcknowledge ( session ) ) { <END_BUG> message . acknowledge ( ) ; } } protected void rollbackIfNecessary ( Session session ) throws JMSException { } protected void rollbackOnExceptionIfNecessary ( Session session , Throwable ex ) throws JMSException { } protected boolean isSessionLocallyTransacted ( Session session ) { } protected void handleListenerException ( Throwable ex ) { } protected void invokeExceptionListener ( JMSException ex ) { } protected void invokeErrorHandler ( Throwable ex ) { } private static class MessageRejectedWhileStoppingException extends RuntimeException { } }

Fix:
if ( ( message != null ) && ( isClientAcknowledge ( session ) ) ) {