Buggy code:
public Collection < LocalSubscription > getActiveLocalSubscribers ( String destination , boolean isTopic ) throws AndesException { } public List < LocalSubscription > getAllActiveSubscriptions4MsgDestination ( String messageDest , boolean isTopic ) { } public Collection < LocalSubscription > getActiveLocalSubscribersForQueuesAndTopics ( String destination ) throws AndesException { } public LocalSubscription getLocalSubscriptionForChannelId ( UUID channelID ) throws AndesException { } public int numberOfSubscriptionsForDestinationAtNode ( String destination , String nodeID ) throws AndesException { } public List < AndesSubscription > getActiveClusterSubscribersForNode ( String nodeID , boolean isTopic ) { } public List < LocalSubscription > getActiveLocalSubscribers ( boolean isTopic ) { } public List < LocalSubscription > getActiveNonDurableLocalSubscribers ( boolean isTopic ) { } public int numberOfSubscriptionsInCluster ( String destination , boolean isTopic ) throws AndesException { } public Map < String , LocalSubscription > getLocalSubscriptionMap ( String destination , boolean isTopic ) { } public List < AndesSubscription > getClusterSubscriptionList ( String destination , boolean isTopic ) { } public List < AndesSubscription > getActiveClusterSubscriptionList ( String destination , boolean isTopic ) { } public List < AndesSubscription > replaceClusterSubscriptionListOfDestination ( String destination , List < AndesSubscription > newSubList , boolean isTopic ) { } public List < LocalSubscription > getListOfLocalSubscriptionsBoundToQueue ( String queueName ) throws AndesException { } public List < AndesSubscription > getListOfClusterSubscriptionsBoundToQueue ( String queueName ) throws AndesException { } public Set < String > getNodesHavingSubscriptionsForQueue ( String queueName ) throws AndesException { } public Set < String > getNodesHavingSubscriptionsForTopic ( String topicName ) throws AndesException { } private List < AndesSubscription > getSubscriptionsOfNode ( String nodeID , List < AndesSubscription > subscriptionList ) { } public Map < String , Integer > getSubscriptionCountInformation ( String destination , boolean isTopic ) throws AndesException { } public synchronized void createDisconnectOrRemoveClusterSubscription ( AndesSubscription subscription , SubscriptionChange type ) throws AndesException { } private synchronized void createDisconnectOrRemoveClusterSubscriptionUsingNativeMethod ( AndesSubscription subscription , SubscriptionChange type ) throws AndesException { } private synchronized void createDisconnectOrRemoveClusterSubscriptionUsingBitmap ( AndesSubscription subscription , SubscriptionChange type ) throws AndesException { } private void printSubscriptionMap ( Map < String , List < AndesSubscription > > map ) { } private void printLocalSubscriptionMap ( Map < String , Map < String , LocalSubscription > > map ) { } public synchronized void createDisconnectOrRemoveLocalSubscription ( LocalSubscription subscription , SubscriptionChange type ) throws AndesException , SubscriptionAlreadyExistsException { Boolean allowSharedSubscribers = AndesConfigurationManager . readValue ( ALLOW_SHARED_SHARED_SUBSCRIBERS ) ; boolean durableSubExists = false ; boolean hasExternalSubscriptions = false ; if ( subscription . isDurable ( ) ) { for ( Map . Entry < String , List < AndesSubscription > > entry : clusterQueueSubscriptionMap . entrySet ( ) ) { List < AndesSubscription > existingSubscriptions = entry . getValue ( ) ; if ( ( existingSubscriptions != null ) && ( ! ( existingSubscriptions . isEmpty ( ) ) ) ) { for ( AndesSubscription sub : existingSubscriptions ) { if ( ( sub . isDurable ( ) ) && ( sub . getTargetQueue ( ) . equals ( subscription . getTargetQueue ( ) ) ) ) { durableSubExists = true ; if ( ( subscription . isBoundToTopic ( ) ) && ( sub . hasExternalSubscriptions ( ) ) ) { hasExternalSubscriptions = true ; break ; } } } } if ( hasExternalSubscriptions ) { break ; } } if ( ( ! hasExternalSubscriptions ) && ( type == ( SubscriptionChange . DISCONNECTED ) ) ) { if ( ! allowSharedSubscribers ) { throw new AndesException ( ( ( ( "There<seq2seq4repair_space>is<seq2seq4repair_space>no<seq2seq4repair_space>active<seq2seq4repair_space>subscriber<seq2seq4repair_space>to<seq2seq4repair_space>close<seq2seq4repair_space>subscribed<seq2seq4repair_space>to<seq2seq4repair_space>" + ( subscription . getSubscribedDestination ( ) ) ) + "<seq2seq4repair_space>with<seq2seq4repair_space>the<seq2seq4repair_space>queue<seq2seq4repair_space>" ) + ( subscription . getTargetQueue ( ) ) ) ) ; } } else if ( hasExternalSubscriptions && ( type == ( SubscriptionChange . ADDED ) ) ) { if ( ! allowSharedSubscribers ) { throw new SubscriptionAlreadyExistsException ( ( ( ( "A<seq2seq4repair_space>subscription<seq2seq4repair_space>already<seq2seq4repair_space>exists<seq2seq4repair_space>for<seq2seq4repair_space>Durable<seq2seq4repair_space>subscriptions<seq2seq4repair_space>on<seq2seq4repair_space>" + ( subscription . getSubscribedDestination ( ) ) ) + "<seq2seq4repair_space>with<seq2seq4repair_space>the<seq2seq4repair_space>queue<seq2seq4repair_space>" ) + ( subscription . getTargetQueue ( ) ) ) ) ; } } } if ( ( type == ( SubscriptionChange . ADDED ) ) || ( type == ( SubscriptionChange . DISCONNECTED ) ) ) { <START_BUG> String destinationQueue = subscription . getSubscribedDestination ( ) ; <END_BUG> String destinationIdentifier = ( subscription . isBoundToTopic ( ) ? SubscriptionStore . TOPIC_PREFIX : SubscriptionStore . QUEUE_PREFIX ) + destinationQueue ; String subscriptionID = ( ( subscription . getSubscribedNode ( ) ) + "_" ) + ( subscription . getSubscriptionID ( ) ) ; if ( ( type == ( SubscriptionChange . ADDED ) ) && ( ! durableSubExists ) ) { andesContextStore . storeDurableSubscription ( destinationIdentifier , subscriptionID , subscription . encodeAsStr ( ) ) ; SubscriptionStore . log . info ( ( "New<seq2seq4repair_space>local<seq2seq4repair_space>subscription<seq2seq4repair_space>added<seq2seq4repair_space>" + ( subscription . toString ( ) ) ) ) ; } else { andesContextStore . updateDurableSubscription ( destinationIdentifier , subscriptionID , subscription . encodeAsStr ( ) ) ; SubscriptionStore . log . info ( ( ( ( "New<seq2seq4repair_space>local<seq2seq4repair_space>subscription<seq2seq4repair_space>" + type ) + "<seq2seq4repair_space>" ) + ( subscription . toString ( ) ) ) ) ; } if ( subscription . getTargetQueueBoundExchangeName ( ) . equals ( DIRECT_EXCHANGE_NAME ) ) { Map < String , LocalSubscription > localSubscriptions = localQueueSubscriptionMap . get ( destinationQueue ) ; if ( localSubscriptions == null ) { localSubscriptions = new ConcurrentHashMap < String , LocalSubscription > ( ) ; } localSubscriptions . put ( subscriptionID , subscription ) ; localQueueSubscriptionMap . put ( destinationQueue , localSubscriptions ) ; } else if ( subscription . getTargetQueueBoundExchangeName ( ) . equals ( TOPIC_EXCHANGE_NAME ) ) { if ( isBitmap ) { subscriptionBitMapHandler . addLocalSubscription ( destinationQueue , subscription ) ; } else { Map < String , LocalSubscription > localSubscriptions = localTopicSubscriptionMap . get ( destinationQueue ) ; if ( localSubscriptions == null ) { localSubscriptions = new ConcurrentHashMap < String , LocalSubscription > ( ) ; } localSubscriptions . put ( subscriptionID , subscription ) ; localTopicSubscriptionMap . put ( destinationQueue , localSubscriptions ) ; } }

Fix:
String destinationQueue = subscription . getTargetQueue ( ) ;