Buggy code:
public class CommitLog { private static volatile int SEGMENT_SIZE = ( 128 * 1024 ) * 1024 ; private static final Logger logger = Logger . getLogger ( CommitLog . class ) ; public static CommitLog instance ( ) { } private static class CLHandle { public static final CommitLog instance = new CommitLog ( ) ; } private final Deque < CommitLogSegment > segments = new ArrayDeque < CommitLogSegment > ( ) ; public static void setSegmentSize ( int size ) { } public int getSegmentCount ( ) { } private final ICommitLogExecutorService executor ; private CommitLog ( ) { } public static void recover ( ) throws IOException { } public static void recover ( File [ ] clogs ) throws IOException { Set < Table > tablesRecovered = new HashSet < Table > ( ) ; final AtomicInteger counter = new AtomicInteger ( 0 ) ; for ( File file : clogs ) { int bufferSize = ( ( int ) ( Math . min ( file . length ( ) , ( ( 32 * 1024 ) * 1024 ) ) ) ) ; BufferedRandomAccessFile reader = new BufferedRandomAccessFile ( file . getAbsolutePath ( ) , "r" , bufferSize ) ; final CommitLogHeader clHeader ; try { clHeader = CommitLogHeader . readCommitLogHeader ( reader ) ; } catch ( EOFException eofe ) { CommitLog . logger . info ( "Attempted<seq2seq4repair_space>to<seq2seq4repair_space>recover<seq2seq4repair_space>an<seq2seq4repair_space>incomplete<seq2seq4repair_space>CommitLogHeader.<seq2seq4repair_space>Everything<seq2seq4repair_space>is<seq2seq4repair_space>ok,<seq2seq4repair_space>don't<seq2seq4repair_space>panic." ) ; continue ; } int lowPos = CommitLogHeader . getLowestPosition ( clHeader ) ; if ( lowPos == 0 ) <START_BUG> break ; <END_BUG> reader . seek ( lowPos ) ; if ( CommitLog . logger . isDebugEnabled ( ) ) CommitLog . logger . debug ( ( ( ( "Replaying<seq2seq4repair_space>" + file ) + "<seq2seq4repair_space>starting<seq2seq4repair_space>at<seq2seq4repair_space>" ) + lowPos ) ) ; while ( ! ( reader . isEOF ( ) ) ) { if ( CommitLog . logger . isDebugEnabled ( ) ) CommitLog . logger . debug ( ( "Reading<seq2seq4repair_space>mutation<seq2seq4repair_space>at<seq2seq4repair_space>" + ( reader . getFilePointer ( ) ) ) ) ; long claimedCRC32 ; byte [ ] bytes ; try { bytes = new byte [ ( ( int ) ( reader . readLong ( ) ) ) ] ; reader . readFully ( bytes ) ; claimedCRC32 = reader . readLong ( ) ; } catch ( EOFException e ) { break ; } ByteArrayInputStream bufIn = new ByteArrayInputStream ( bytes ) ; Checksum checksum = new CRC32 ( ) ; checksum . update ( bytes , 0 , bytes . length ) ; if ( claimedCRC32 != ( checksum . getValue ( ) ) ) { continue ; } final RowMutation rm = RowMutation . serializer ( ) . deserialize ( new DataInputStream ( bufIn ) ) ; if ( CommitLog . logger . isDebugEnabled ( ) ) CommitLog . logger . debug ( String . format ( "replaying<seq2seq4repair_space>mutation<seq2seq4repair_space>for<seq2seq4repair_space>%s.%s:<seq2seq4repair_space>%s" , rm . getTable ( ) , rm . key ( ) , ( ( "{" + ( StringUtils . join ( rm . getColumnFamilies ( ) , ",<seq2seq4repair_space>" ) ) ) + "}" ) ) ) ; final Table table = Table . open ( rm . getTable ( ) ) ; tablesRecovered . add ( table ) ; final Collection < ColumnFamily > columnFamilies = new ArrayList < ColumnFamily > ( rm . getColumnFamilies ( ) ) ; final long entryLocation = reader . getFilePointer ( ) ; Runnable runnable = new WrappedRunnable ( ) { public void runMayThrow ( ) throws IOException { for ( ColumnFamily columnFamily : columnFamilies ) { int id = table . getColumnFamilyId ( columnFamily . name ( ) ) ; if ( ( ! ( clHeader . isDirty ( id ) ) ) || ( entryLocation < ( clHeader . getPosition ( id ) ) ) ) { rm . removeColumnFamily ( columnFamily ) ; } } if ( ! ( rm . isEmpty ( ) ) ) { Table . open ( rm . getTable ( ) ) . apply ( rm , null , false ) ; } counter . decrementAndGet ( ) ; } } ; counter . incrementAndGet ( ) ; StageManager . getStage ( MUTATION_STAGE ) . submit ( runnable ) ; } reader . close ( ) ; CommitLog . logger . info ( ( "Finished<seq2seq4repair_space>reading<seq2seq4repair_space>" + file ) ) ; } while ( ( counter . get ( ) ) > 0 ) { try { Thread . sleep ( 10 ) ; } catch ( InterruptedException e ) { throw new AssertionError ( e ) ; } } List < Future < ? > > futures = new ArrayList < Future < ? > > ( ) ; for ( Table table : tablesRecovered ) { futures . addAll ( table . flush ( ) ) ; } for ( Future < ? > future : futures ) { try { future . get ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } } private CommitLogSegment currentSegment ( ) { } public CommitLogContext getContext ( ) throws IOException { } public void add ( RowMutation rowMutation , Object serializedRow ) throws IOException { } public void discardCompletedSegments ( final String tableName , final String cf , final CommitLogSegment . CommitLogContext context ) throws IOException { } private void discardCompletedSegmentsInternal ( CommitLogSegment . CommitLogContext context , int id ) throws IOException { } void sync ( ) throws IOException { } public void forceNewSegment ( ) { } class LogRecordAdder implements Runnable , Callable { final RowMutation rowMutation ; final Object serializedRow ; LogRecordAdder ( RowMutation rm , Object serializedRow ) { } public void run ( ) { } public Object call ( ) throws Exception { } } }

Fix:
continue ;