Buggy code:
} public static class BootstrapCompletionHandler implements IStreamComplete { public void onStreamCompletion ( String host , StreamContextManager . StreamContext streamContext , StreamContextManager . StreamStatus streamStatus ) throws IOException { } } public static class BootStrapInitiateVerbHandler implements IVerbHandler { public void doVerb ( Message message ) { } private Map < String , String > getNewNames ( StreamContextManager [ ] streamContexts ) { } private void addStreamContext ( String host , StreamContextManager . StreamContext streamContext , StreamContextManager . StreamStatus streamStatus ) { } } private static Logger logger_ = Logger . getLogger ( Table . class ) ; public static final String recycleBin_ = "RecycleColumnFamily" ; public static final String hints_ = "HintsColumnFamily" ; private static Lock createLock_ = new ReentrantLock ( ) ; private static Map < String , Table > instances_ = new HashMap < String , Table > ( ) ; private String table_ ; private Table . TableMetadata tableMetadata_ ; private Map < String , ColumnFamilyStore > columnFamilyStores_ = new HashMap < String , ColumnFamilyStore > ( ) ; private DBAnalyticsSource dbAnalyticsSource_ ; private Set < String > applicationColumnFamilies_ ; public static Table open ( String table ) { } public Set < String > getColumnFamilies ( ) { } Map < String , ColumnFamilyStore > getColumnFamilyStores ( ) { } public ColumnFamilyStore getColumnFamilyStore ( String cfName ) { } String getColumnFamilyType ( String cfName ) { } public String tableStats ( String newLineSeparator , DecimalFormat df ) { } void onStart ( ) throws IOException { } public void doGC ( ) { } public void touch ( String key , boolean fData ) throws IOException { } public void clearSnapshot ( ) { } public boolean forceCompaction ( List < Range > ranges , EndPoint target , List < String > fileList ) { } public void forceCompaction ( ) { } public List < String > getAllSSTablesOnDisk ( ) { } private Table ( String table ) { } String getTableName ( ) { } boolean isApplicationColumnFamily ( String columnFamily ) { } int getNumberOfColumnFamilies ( ) { } int getColumnFamilyId ( String columnFamily ) { } String getColumnFamilyName ( int id ) { } boolean isValidColumnFamily ( String columnFamily ) { } public Row get ( String key ) throws IOException { } public ColumnFamily get ( String key , String cf ) throws IOException { } public Row getRow ( String key , String cf ) throws IOException { } public Row getRow ( String key , String cf , int start , int count ) throws IOException { } public Row getRow ( String key , String cf , long sinceTimeStamp ) throws IOException { } public Row getRow ( String key , String cf , List < String > columns ) throws IOException { } void apply ( Row row ) throws IOException { } void applyNow ( Row row ) throws IOException { } public void flush ( boolean fRecovery ) throws IOException { } void load ( Row row ) throws IOException { } public Set < String > getApplicationColumnFamilies ( ) { } public List < String > getKeyRange ( final String startWith , final String stopAt , int maxResults ) throws IOException , InterruptedException , ExecutionException { final Comparator < String > comparator = StorageService . getPartitioner ( ) . getDecoratedKeyComparator ( ) ; List < Iterator < String > > iterators = new ArrayList < Iterator < String > > ( ) ; for ( String cfName : getApplicationColumnFamilies ( ) ) { ColumnFamilyStore cfs = getColumnFamilyStore ( cfName ) ; <START_BUG> Iterator < Memtable > memtables = ( ( Iterator < Memtable > ) ( IteratorUtils . chainedIterator ( IteratorUtils . singletonIterator ( cfs . getMemtable ( ) ) , MemtableManager . instance ( ) . getUnflushedMemtables ( cfName ) . iterator ( ) ) ) ) ; <END_BUG> while ( memtables . hasNext ( ) ) { iterators . add ( IteratorUtils . filteredIterator ( memtables . next ( ) . sortedKeyIterator ( ) , new Predicate ( ) { public boolean evaluate ( Object key ) { String st = ( ( String ) ( key ) ) ; return ( ( comparator . compare ( startWith , st ) ) <= 0 ) && ( ( stopAt . isEmpty ( ) ) || ( ( comparator . compare ( st , stopAt ) ) <= 0 ) ) ; } } ) ) ; } for ( String filename : cfs . getSSTableFilenames ( ) ) { FileStruct fs = new FileStruct ( SequenceFile . reader ( filename ) , StorageService . getPartitioner ( ) ) ; fs . seekTo ( startWith ) ; iterators . add ( fs ) ; } } Iterator < String > collated = IteratorUtils . collatedIterator ( comparator , iterators ) ; try { List < String > keys = new ArrayList < String > ( ) ; String last = null ; String current = null ; while ( ( keys . size ( ) ) < maxResults ) { if ( ! ( collated . hasNext ( ) ) ) { break ; } current = collated . next ( ) ; if ( ! ( current . equals ( last ) ) ) { if ( ( ! ( stopAt . isEmpty ( ) ) ) && ( ( comparator . compare ( stopAt , current ) ) < 0 ) ) { break ; } last = current ; for ( String cfName : getApplicationColumnFamilies ( ) ) { ColumnFamilyStore cfs = getColumnFamilyStore ( cfName ) ; ColumnFamily cf = cfs . getColumnFamily ( current , cfName , new IdentityFilter ( ) , Integer . MAX_VALUE ) ; if ( ( cf != null ) && ( ( cf . getColumns ( ) . size ( ) ) > 0 ) ) { keys . add ( current ) ; break ; }

Fix:
Iterator < Memtable > memtables = ( ( Iterator < Memtable > ) ( IteratorUtils . chainedIterator ( IteratorUtils . singletonIterator ( cfs . getMemtable ( ) ) , ColumnFamilyStore . getUnflushedMemtables ( cfName ) . iterator ( ) ) ) ) ;