Buggy code:
public class PartitionManager { public static final Logger LOG = LoggerFactory . getLogger ( PartitionManager . class ) ; private final CombinedMetric _fetchAPILatencyMax ; private final ReducedMetric _fetchAPILatencyMean ; private final CountMetric _fetchAPICallCount ; private final CountMetric _fetchAPIMessageCount ; Long _emittedToOffset ; SortedSet < Long > _pending = new TreeSet < Long > ( ) ; SortedSet < Long > failed = new TreeSet < Long > ( ) ; Long _committedTo ; LinkedList < MessageAndRealOffset > _waitingToEmit = new LinkedList < MessageAndRealOffset > ( ) ; Partition _partition ; SpoutConfig _spoutConfig ; String _topologyInstanceId ; SimpleConsumer _consumer ; DynamicPartitionConnections _connections ; ZkState _state ; Map _stormConf ; long numberFailed ; long numberAcked ; public PartitionManager ( DynamicPartitionConnections connections , String topologyInstanceId , ZkState state , Map stormConf , SpoutConfig spoutConfig , Partition id ) { } public Map getMetricsDataMap ( ) { } public EmitState next ( SpoutOutputCollector collector ) { } private void fill ( ) { } public void ack ( Long offset ) { } public void fail ( Long offset ) { } public void commit ( ) { long lastCompletedOffset = lastCompletedOffset ( ) ; <START_BUG> if ( lastCompletedOffset != lastCompletedOffset ) { <END_BUG> PartitionManager . LOG . debug ( ( ( ( ( ( "Writing<seq2seq4repair_space>last<seq2seq4repair_space>completed<seq2seq4repair_space>offset<seq2seq4repair_space>(" + lastCompletedOffset ) + ")<seq2seq4repair_space>to<seq2seq4repair_space>ZK<seq2seq4repair_space>for<seq2seq4repair_space>" ) + ( _partition ) ) + "<seq2seq4repair_space>for<seq2seq4repair_space>topology:<seq2seq4repair_space>" ) + ( _topologyInstanceId ) ) ) ; Map < Object , Object > data = ( ( Map < Object , Object > ) ( ImmutableMap . builder ( ) . put ( "topology" , ImmutableMap . of ( "id" , _topologyInstanceId , "name" , _stormConf . get ( TOPOLOGY_NAME ) ) ) . put ( "offset" , lastCompletedOffset ) . put ( "partition" , _partition . partition ) . put ( "broker" , ImmutableMap . of ( "host" , _partition . host . host , "port" , _partition . host . port ) ) . put ( "topic" , _spoutConfig . topic ) . build ( ) ) ) ; _state . writeJSON ( committedPath ( ) , data ) ; _committedTo = lastCompletedOffset ; PartitionManager . LOG . debug ( ( ( ( ( ( "Wrote<seq2seq4repair_space>last<seq2seq4repair_space>completed<seq2seq4repair_space>offset<seq2seq4repair_space>(" + lastCompletedOffset ) + ")<seq2seq4repair_space>to<seq2seq4repair_space>ZK<seq2seq4repair_space>for<seq2seq4repair_space>" ) + ( _partition ) ) + "<seq2seq4repair_space>for<seq2seq4repair_space>topology:<seq2seq4repair_space>" ) + ( _topologyInstanceId ) ) ) ; } else { PartitionManager . LOG . debug ( ( ( ( "No<seq2seq4repair_space>new<seq2seq4repair_space>offset<seq2seq4repair_space>for<seq2seq4repair_space>" + ( _partition ) ) + "<seq2seq4repair_space>for<seq2seq4repair_space>topology:<seq2seq4repair_space>" ) + ( _topologyInstanceId ) ) ) ; } } private String committedPath ( ) { } public long lastCompletedOffset ( ) { } public Partition getPartition ( ) { } public void close ( ) { } static class KafkaMessageId { public Partition partition ; public long offset ; public KafkaMessageId ( Partition partition , long offset ) { } } }

Fix:
if ( ( _committedTo ) != lastCompletedOffset ) {