Buggy code:
public class StorageProxy implements StorageProxyMBean { private static final Logger logger = Logger . getLogger ( StorageProxy . class ) ; private static final LatencyTracker readStats = new LatencyTracker ( ) ; private static final LatencyTracker rangeStats = new LatencyTracker ( ) ; private static final LatencyTracker writeStats = new LatencyTracker ( ) ; private static boolean hintedHandoffEnabled = DatabaseDescriptor . hintedHandoffEnabled ( ) ; private StorageProxy ( ) { } public static final Comparator < String > keyComparator = new Comparator < String > ( ) { public int compare ( String o1 , String o2 ) { } } ; public static void mutate ( List < RowMutation > mutations ) { } private static void addHintHeader ( Message message , InetAddress target ) { } public static void mutateBlocking ( List < RowMutation > mutations , ConsistencyLevel consistency_level ) throws TimeoutException , UnavailableException { } private static void assureSufficientLiveNodes ( int blockFor , Collection < InetAddress > writeEndpoints , Multimap < InetAddress , InetAddress > hintedEndpoints , ConsistencyLevel consistencyLevel ) throws UnavailableException { } private static void insertLocalMessage ( final RowMutation rm , final WriteResponseHandler responseHandler ) { } private static int determineBlockFor ( int expandedTargets , ConsistencyLevel consistency_level ) { } public static List < Row > readProtocol ( List < ReadCommand > commands , ConsistencyLevel consistency_level ) throws IOException , TimeoutException , InvalidRequestException , UnavailableException { } private static List < Row > weakRead ( List < ReadCommand > commands ) throws IOException , TimeoutException , UnavailableException { } private static List < Row > strongRead ( List < ReadCommand > commands , ConsistencyLevel consistency_level ) throws IOException , TimeoutException , UnavailableException { } public static List < Row > getRangeSlice ( RangeSliceCommand command , ConsistencyLevel consistency_level ) throws IOException , TimeoutException , UnavailableException { } static List < AbstractBounds > getRestrictedRanges ( final AbstractBounds queryRange ) { if ( ( ( queryRange instanceof Bounds ) && ( queryRange . left . equals ( queryRange . right ) ) ) && ( ! ( queryRange . left . equals ( StorageService . getPartitioner ( ) . getMinimumToken ( ) ) ) ) ) { if ( StorageProxy . logger . isDebugEnabled ( ) ) StorageProxy . logger . debug ( ( "restricted<seq2seq4repair_space>single<seq2seq4repair_space>token<seq2seq4repair_space>match<seq2seq4repair_space>for<seq2seq4repair_space>query<seq2seq4repair_space>" + queryRange ) ) ; return Collections . singletonList ( queryRange ) ; } TokenMetadata tokenMetadata = instance . getTokenMetadata ( ) ; List < AbstractBounds > ranges = new ArrayList < AbstractBounds > ( ) ; Iterator < Token > ringIter = TokenMetadata . ringIterator ( tokenMetadata . sortedTokens ( ) , queryRange . left , true ) ; AbstractBounds remainder = queryRange ; while ( ringIter . hasNext ( ) ) { Token token = ringIter . next ( ) ; <START_BUG> if ( ( remainder == null ) || ( ! ( remainder . contains ( token ) ) ) ) <END_BUG> break ; Pair < AbstractBounds , AbstractBounds > splits = remainder . split ( token ) ; if ( ( splits . left ) != null ) ranges . add ( splits . left ) ; remainder = splits . right ; } if ( remainder != null ) ranges . add ( remainder ) ; if ( StorageProxy . logger . isDebugEnabled ( ) ) StorageProxy . logger . debug ( ( ( ( "restricted<seq2seq4repair_space>ranges<seq2seq4repair_space>for<seq2seq4repair_space>query<seq2seq4repair_space>" + queryRange ) + "<seq2seq4repair_space>are<seq2seq4repair_space>" ) + ranges ) ) ; return ranges ; } public long getReadOperations ( ) { } public long getTotalReadLatencyMicros ( ) { } public double getRecentReadLatencyMicros ( ) { } public long getRangeOperations ( ) { } public long getTotalRangeLatencyMicros ( ) { } public double getRecentRangeLatencyMicros ( ) { } public long getWriteOperations ( ) { } public long getTotalWriteLatencyMicros ( ) { } public double getRecentWriteLatencyMicros ( ) { } public boolean getHintedHandoffEnabled ( ) { } public void setHintedHandoffEnabled ( boolean b ) { } public static boolean isHintedHandoffEnabled ( ) { } static class weakReadLocalCallable implements Callable < Object > { private ReadCommand command ; weakReadLocalCallable ( ReadCommand command ) { } public Object call ( ) throws IOException { } } }

Fix:
if ( ( remainder == null ) || ( ! ( ( remainder . left . equals ( token ) ) || ( remainder . contains ( token ) ) ) ) )