Buggy code:
public class HectorBasedMessageStoreImpl implements MessageStore { private static Log log = LogFactory . getLog ( HectorBasedMessageStoreImpl . class ) ; private AlreadyProcessedMessageTracker alreadyMovedMessageTracker ; private Keyspace keyspace ; private HectorConnection hectorConnection ; @ Override public DurableStoreConnection initializeMessageStore ( ConfigurationProperties connectionProperties ) throws AndesException { } @ Override public void storeMessagePart ( List < AndesMessagePart > partList ) throws AndesException { } @ Override public void deleteMessageParts ( List < Long > messageIdList ) throws AndesException { } @ Override public AndesMessagePart getContent ( long messageId , int offsetValue ) throws AndesException { } @ Override public void addMetaData ( List < AndesMessageMetadata > metadataList ) throws AndesException { } @ Override public void addMetaData ( AndesMessageMetadata metadata ) throws AndesException { } @ Override public void addMetaDataToQueue ( String queueName , AndesMessageMetadata metadata ) throws AndesException { } @ Override public void addMetadataToQueue ( String queueName , List < AndesMessageMetadata > metadataList ) throws AndesException { } @ Override public void moveMetaDataToQueue ( long messageId , String currentQueueName , String targetQueueName ) throws AndesException { } @ Override public void updateMetaDataInformation ( String currentQueueName , List < AndesMessageMetadata > metadataList ) throws AndesException { } @ Override public AndesMessageMetadata getMetaData ( long messageId ) throws AndesException { } @ Override public List < AndesMessageMetadata > getMetaDataList ( String queueName , long firstMsgId , long lastMsgID ) throws AndesException { try { List < AndesMessageMetadata > allMetadataList = new ArrayList < AndesMessageMetadata > ( ) ; List < AndesMessageMetadata > metadataList = HectorDataAccessHelper . getMessagesFromQueue ( queueName , META_DATA_COLUMN_FAMILY , keyspace , firstMsgId , lastMsgID , STANDARD_PAGE_SIZE , true ) ; allMetadataList . addAll ( metadataList ) ; int metadataCount = metadataList . size ( ) ; while ( metadataCount >= ( HectorDataAccessHelper . STANDARD_PAGE_SIZE ) ) { long nextFirstMsgId = metadataList . get ( ( metadataCount - 1 ) ) . getMessageID ( ) ; if ( nextFirstMsgId == lastMsgID ) { break ; } <START_BUG> metadataList = HectorDataAccessHelper . getMessagesFromQueue ( queueName , META_DATA_COLUMN_FAMILY , keyspace , firstMsgId , lastMsgID , STANDARD_PAGE_SIZE , true ) ; <END_BUG> allMetadataList . addAll ( metadataList ) ; metadataCount = metadataList . size ( ) ; } return allMetadataList ; } catch ( CassandraDataAccessException e ) { throw new AndesException ( ( ( ( ( "Error<seq2seq4repair_space>while<seq2seq4repair_space>reading<seq2seq4repair_space>meta<seq2seq4repair_space>data<seq2seq4repair_space>list<seq2seq4repair_space>for<seq2seq4repair_space>message<seq2seq4repair_space>IDs<seq2seq4repair_space>" + "from<seq2seq4repair_space>" ) + firstMsgId ) + "<seq2seq4repair_space>to<seq2seq4repair_space>" ) + lastMsgID ) , e ) ; } } @ Override public List < AndesMessageMetadata > getNextNMessageMetadataFromQueue ( String queueName , long firstMsgId , int count ) throws AndesException { } @ Override public void deleteMessageMetadataFromQueue ( String queueName , List < AndesRemovableMetadata > messagesToRemove ) throws AndesException { } @ Override public List < AndesRemovableMetadata > getExpiredMessages ( int limit ) throws AndesException { } @ Override public void deleteMessagesFromExpiryQueue ( List < Long > messagesToRemove ) throws AndesException { } @ Override public void addMessageToExpiryQueue ( Long messageId , Long expirationTime , boolean isMessageForTopic , String destination ) throws AndesException { } @ Override public void deleteAllMessageMetadata ( String storageQueueName ) throws AndesException { } @ Override public void resetMessageCounterForQueue ( String storageQueueName ) throws AndesException { } @ Override public int deleteAllMessageMetadataFromDLC ( String storageQueueName , String DLCQueueName ) throws AndesException { } @ Override public List < Long > getMessageIDsAddressedToQueue ( String storageQueueName ) throws AndesException { } @ Override public void close ( ) { } private void initializeCassandraMessageStore ( HectorConnection hectorConnection ) throws AndesException { } private void createColumnFamilies ( HectorConnection connection , Cluster cluster ) throws CassandraDataAccessException { } }

Fix:
metadataList = HectorDataAccessHelper . getMessagesFromQueue ( queueName , META_DATA_COLUMN_FAMILY , keyspace , nextFirstMsgId , lastMsgID , STANDARD_PAGE_SIZE , true ) ;