Buggy code:
public class TransactionalSpoutCoordinator implements IRichSpout { public static final Logger LOG = Logger . getLogger ( TransactionalSpoutCoordinator . class ) ; public static final BigInteger INIT_TXID = BigInteger . ONE ; public static final String TRANSACTION_BATCH_STREAM_ID = ( TransactionalSpoutCoordinator . class . getName ( ) ) + "//batch" ; public static final String TRANSACTION_COMMIT_STREAM_ID = ( TransactionalSpoutCoordinator . class . getName ( ) ) + "//commit" ; private static final String CURRENT_TX = "currtx" ; private static final String META_DIR = "meta" ; private ITransactionalSpout _spout ; private Coordinator _coordinator ; private TransactionalState _state ; private RotatingTransactionalState _coordinatorState ; TreeMap < BigInteger , TransactionalSpoutCoordinator . TransactionStatus > _activeTx = new TreeMap < BigInteger , TransactionalSpoutCoordinator . TransactionStatus > ( ) ; private SpoutOutputCollector _collector ; BigInteger _currTransaction ; int _maxTransactionActive ; TransactionalSpoutCoordinator . StateInitializer _initializer ; public TransactionalSpoutCoordinator ( ITransactionalSpout spout ) { } public ITransactionalSpout getSpout ( ) { } @ Override public void open ( Map conf , TopologyContext context , SpoutOutputCollector collector ) { } @ Override public void close ( ) { } @ Override public void nextTuple ( ) { } @ Override public void ack ( Object msgId ) { TransactionAttempt tx = ( ( TransactionAttempt ) ( msgId ) ) ; TransactionalSpoutCoordinator . TransactionStatus status = _activeTx . get ( tx . getTransactionId ( ) ) ; <START_BUG> if ( tx . equals ( status . attempt ) ) { <END_BUG> if ( ( status . status ) == ( TransactionalSpoutCoordinator . AttemptStatus . PROCESSING ) ) { status . status = TransactionalSpoutCoordinator . AttemptStatus . PROCESSED ; } else if ( ( status . status ) == ( TransactionalSpoutCoordinator . AttemptStatus . COMMITTING ) ) { _activeTx . remove ( tx . getTransactionId ( ) ) ; _coordinatorState . cleanupBefore ( tx . getTransactionId ( ) ) ; _currTransaction = nextTransactionId ( tx . getTransactionId ( ) ) ; _state . setData ( TransactionalSpoutCoordinator . CURRENT_TX , _currTransaction ) ; } sync ( ) ; } } @ Override public void fail ( Object msgId ) { } @ Override public void declareOutputFields ( OutputFieldsDeclarer declarer ) { } private void sync ( ) { } @ Override public Map < String , Object > getComponentConfiguration ( ) { } private static enum AttemptStatus { PROCESSING , PROCESSED , COMMITTING ; } private static class TransactionStatus { TransactionAttempt attempt ; TransactionalSpoutCoordinator . AttemptStatus status ; public TransactionStatus ( TransactionAttempt attempt ) { } @ Override public String toString ( ) { } } private BigInteger nextTransactionId ( BigInteger id ) { } private BigInteger previousTransactionId ( BigInteger id ) { } private BigInteger getStoredCurrTransaction ( TransactionalState state ) { } private class StateInitializer implements RotatingTransactionalState . StateInitializer { @ Override public Object init ( BigInteger txid , Object lastState ) { } } }

Fix:
if ( ( status != null ) && ( tx . equals ( status . attempt ) ) ) {