Buggy code:
public class SubscriptionStore { private static final String TOPIC_PREFIX = "topic." ; private static final String QUEUE_PREFIX = "queue." ; private static Log log = LogFactory . getLog ( SubscriptionStore . class ) ; private Map < String , List < AndesSubscription > > clusterTopicSubscriptionMap = new ConcurrentHashMap < String , List < AndesSubscription > > ( ) ; private Map < String , List < AndesSubscription > > clusterQueueSubscriptionMap = new ConcurrentHashMap < String , List < AndesSubscription > > ( ) ; private Map < String , Map < String , LocalSubscription > > localTopicSubscriptionMap = new ConcurrentHashMap < String , Map < String , LocalSubscription > > ( ) ; private Map < String , Map < String , LocalSubscription > > localQueueSubscriptionMap = new ConcurrentHashMap < String , Map < String , LocalSubscription > > ( ) ; private AndesContextStore andesContextStore ; public SubscriptionStore ( ) throws AndesException { } public List < AndesSubscription > getAllSubscribersForDestination ( String destination , boolean isTopic ) throws AndesException { } public List < String > getAllDestinationsOfSubscriptions ( boolean isTopic ) { } public List < AndesSubscription > getClusterSubscribersForDestination ( String destination , boolean isTopic ) throws AndesException { } public List < AndesSubscription > getAllClusterSubscriptions ( boolean isTopic ) throws AndesException { } 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 , String messageDestination , boolean isTopic ) 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 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 { Boolean allowSharedSubscribers = AndesConfigurationManager . readValue ( ALLOW_SHARED_SHARED_SUBSCRIBERS ) ; boolean hasDurableSubscriptionAlreadyInPlace = false ; <START_BUG> if ( ( subscription . isBoundToTopic ( ) ) && ( subscription . isDurable ( ) ) ) { <END_BUG> for ( String destination : clusterTopicSubscriptionMap . keySet ( ) ) { List < AndesSubscription > existingSubscriptions = clusterTopicSubscriptionMap . get ( destination ) ; if ( ( existingSubscriptions != null ) && ( ! ( existingSubscriptions . isEmpty ( ) ) ) ) { for ( AndesSubscription sub : existingSubscriptions ) { if ( ( ( sub . isDurable ( ) ) && ( sub . getTargetQueue ( ) . equals ( subscription . getTargetQueue ( ) ) ) ) && ( sub . hasExternalSubscriptions ( ) ) ) { hasDurableSubscriptionAlreadyInPlace = true ; break ; } } } if ( hasDurableSubscriptionAlreadyInPlace ) { break ; } } if ( ( ! hasDurableSubscriptionAlreadyInPlace ) && ( 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 ( hasDurableSubscriptionAlreadyInPlace && ( type == ( SubscriptionChange . ADDED ) ) ) { if ( ! allowSharedSubscribers ) { throw new AndesException ( ( ( ( "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 ) ) ) { String destinationQueue = subscription . getSubscribedDestination ( ) ; String destinationIdentifier = ( subscription . isBoundToTopic ( ) ? SubscriptionStore . TOPIC_PREFIX : SubscriptionStore . QUEUE_PREFIX ) + destinationQueue ; String subscriptionID = ( ( subscription . getSubscribedNode ( ) ) + "_" ) + ( subscription . getSubscriptionID ( ) ) ; andesContextStore . storeDurableSubscription ( destinationIdentifier , subscriptionID , subscription . encodeAsStr ( ) ) ; if ( type == ( SubscriptionChange . ADDED ) ) { SubscriptionStore . log . info ( ( "New<seq2seq4repair_space>Local<seq2seq4repair_space>Subscription<seq2seq4repair_space>Added<seq2seq4repair_space>" + ( subscription . toString ( ) ) ) ) ; } else { SubscriptionStore . log . info ( ( "New<seq2seq4repair_space>Local<seq2seq4repair_space>Subscription<seq2seq4repair_space>Disconnected<seq2seq4repair_space>" + ( subscription . toString ( ) ) ) ) ; }

Fix:
if ( subscription . isDurable ( ) ) {