Buggy code:
public class Andes { private static Log log = LogFactory . getLog ( Andes . class ) ; private static Andes instance = new Andes ( ) ; private final int PURGE_TIMEOUT_SECONDS ; private final FlowControlManager flowControlManager ; private InboundEventManager inboundEventManager ; private AndesContextInformationManager contextInformationManager ; private MessagingEngine messagingEngine ; private AndesSubscriptionManager subscriptionManager ; public static Andes getInstance ( ) { } private Andes ( ) { } void initialise ( SubscriptionStore subscriptionStore , MessagingEngine messagingEngine , AndesContextInformationManager contextInformationManager , AndesSubscriptionManager subscriptionManager ) { } public void messageReceived ( AndesMessage message , AndesChannel andesChannel ) { } public void ackReceived ( AndesAckData ackData ) throws AndesException { } public void clientConnectionClosed ( UUID channelID ) { } public void clientConnectionCreated ( UUID channelID ) { } public void closeLocalSubscription ( InboundSubscriptionEvent subscriptionEvent ) throws AndesException { <START_BUG> subscriptionEvent . prepareForNewSubscription ( subscriptionManager ) ; <END_BUG> inboundEventManager . publishStateEvent ( subscriptionEvent ) ; try { subscriptionEvent . waitForCompletion ( ) ; } catch ( SubscriptionAlreadyExistsException e ) { Andes . log . error ( "Error<seq2seq4repair_space>occurred<seq2seq4repair_space>while<seq2seq4repair_space>closing<seq2seq4repair_space>subscription<seq2seq4repair_space>" , e ) ; } } public void openLocalSubscription ( InboundSubscriptionEvent subscriptionEvent ) throws AndesException , SubscriptionAlreadyExistsException { } public void startMessageDelivery ( ) throws Exception { } public void stopMessageDelivery ( ) { } void shutDown ( ) { } void startMessageExpirationWorker ( ) { } void stopMessageExpirationWorker ( ) { } public int purgeQueue ( InboundQueueEvent queueEvent , boolean isTopic ) throws AndesException { } public void deleteMessages ( List < AndesRemovableMetadata > messagesToRemove , boolean moveToDeadLetterChannel ) throws AndesException { } public void createQueue ( InboundQueueEvent queueEvent ) throws AndesException { } public void deleteQueue ( InboundQueueEvent queueEvent ) throws AndesException { } public AndesMessagePart getMessageContentChunk ( long messageID , int offsetInMessage ) throws AndesException { } public AndesMessageMetadata getMessageMetaData ( long messageID ) throws AndesException { } public void messageRejected ( AndesMessageMetadata metadata ) throws AndesException { } public void updateMetaDataInformation ( String currentQueueName , List < AndesMessageMetadata > metadataList ) throws AndesException { } public void reQueueMessage ( AndesMessageMetadata messageMetadata , LocalSubscription subscription ) throws AndesException { } public void moveMessageToDeadLetterChannel ( long messageId , String destinationQueueName ) throws AndesException { } public void clearMessagesFromQueueInMemory ( String destination , Long purgedTimestamp ) throws AndesException { } public AndesMessagePart getContent ( long messageId , int offsetValue ) throws AndesException { } public long getMessageCountOfQueue ( String queueName ) throws AndesException { } public List < AndesMessageMetadata > getMetaDataList ( final String queueName , long firstMsgId , long lastMsgID ) throws AndesException { } public List < AndesMessageMetadata > getNextNMessageMetadataFromQueue ( final String queueName , long firstMsgId , int count ) throws AndesException { } public List < AndesRemovableMetadata > getExpiredMessages ( int limit ) throws AndesException { } public long generateNewMessageId ( ) { } public AndesChannel createChannel ( FlowControlListener listener ) { } public void deleteChannel ( AndesChannel channel ) { } public void addBinding ( InboundBindingEvent bindingsEvent ) throws AndesException { } public void removeBinding ( InboundBindingEvent bindingEvent ) throws AndesException { } public void createExchange ( InboundExchangeEvent exchangeEvent ) throws AndesException { } public void deleteExchange ( InboundExchangeEvent exchangeEvent ) throws AndesException { } public boolean checkIfQueueDeletable ( InboundQueueEvent queueEvent ) throws AndesException { } }

Fix:
subscriptionEvent . prepareForCloseSubscription ( subscriptionManager ) ;