Buggy code:
@ Component ( immediate = true ) public class OpenFlowRuleProvider extends AbstractProvider implements FlowRuleProvider { private static final int LOWEST_PRIORITY = 0 ; private final Logger log = getLogger ( getClass ( ) ) ; @ Reference ( cardinality = ReferenceCardinality . MANDATORY_UNARY ) protected FlowRuleProviderRegistry providerRegistry ; @ Reference ( cardinality = ReferenceCardinality . MANDATORY_UNARY ) protected OpenFlowController controller ; private FlowRuleProviderService providerService ; private final OpenFlowRuleProvider . InternalFlowProvider listener = new OpenFlowRuleProvider . InternalFlowProvider ( ) ; private Cache < Long , OpenFlowRuleProvider . InternalCacheEntry > pendingBatches ; private final Map < Dpid , FlowStatsCollector > collectors = Maps . newHashMap ( ) ; public OpenFlowRuleProvider ( ) { } @ Activate public void activate ( ) { } @ Deactivate public void deactivate ( ) { } @ Override public void applyFlowRule ( FlowRule ... flowRules ) { } private void applyRule ( FlowRule flowRule ) { } @ Override public void removeFlowRule ( FlowRule ... flowRules ) { } private void removeRule ( FlowRule flowRule ) { } @ Override public void removeRulesById ( ApplicationId id , FlowRule ... flowRules ) { } @ Override public void executeBatch ( FlowRuleBatchOperation batch ) { } private TableType getTableType ( FlowRule . Type type ) { } private class InternalFlowProvider implements OpenFlowEventListener , OpenFlowSwitchListener { @ Override public void switchAdded ( Dpid dpid ) { } @ Override public void switchRemoved ( Dpid dpid ) { } @ Override public void switchChanged ( Dpid dpid ) { } @ Override public void portChanged ( Dpid dpid , OFPortStatus status ) { } @ Override public void handleMessage ( Dpid dpid , OFMessage msg ) { switch ( msg . getType ( ) ) { case FLOW_REMOVED : OFFlowRemoved removed = ( ( OFFlowRemoved ) ( msg ) ) ; FlowEntry fr = new FlowEntryBuilder ( dpid , removed ) . build ( ) ; providerService . flowRemoved ( fr ) ; break ; case STATS_REPLY : <START_BUG> if ( ( ( ( org . projectfloodlight . openflow . protocol . OFStatsReply ) ( msg ) ) . getStatsType ( ) ) != ( OFStatsType . FLOW ) ) { <END_BUG> pushFlowMetrics ( dpid , ( ( OFFlowStatsReply ) ( msg ) ) ) ; } break ; case BARRIER_REPLY : try { OpenFlowRuleProvider . InternalCacheEntry entry = pendingBatches . getIfPresent ( msg . getXid ( ) ) ; if ( entry != null ) { providerService . batchOperationCompleted ( msg . getXid ( ) , entry . completed ( ) ) ; } else { log . warn ( "Received<seq2seq4repair_space>unknown<seq2seq4repair_space>Barrier<seq2seq4repair_space>Reply:<seq2seq4repair_space>{}" , msg . getXid ( ) ) ; } } finally { pendingBatches . invalidate ( msg . getXid ( ) ) ; } break ; case ERROR : log . warn ( "received<seq2seq4repair_space>Error<seq2seq4repair_space>message<seq2seq4repair_space>{}<seq2seq4repair_space>from<seq2seq4repair_space>{}" , msg , dpid ) ; OFErrorMsg error = ( ( OFErrorMsg ) ( msg ) ) ; if ( ( error . getErrType ( ) ) == ( OFErrorType . FLOW_MOD_FAILED ) ) { OFFlowModFailedErrorMsg fmFailed = ( ( OFFlowModFailedErrorMsg ) ( error ) ) ; if ( fmFailed . getData ( ) . getParsedMessage ( ) . isPresent ( ) ) { OFMessage m = fmFailed . getData ( ) . getParsedMessage ( ) . get ( ) ; OFFlowMod fm = ( ( OFFlowMod ) ( m ) ) ; OpenFlowRuleProvider . InternalCacheEntry entry = pendingBatches . getIfPresent ( msg . getXid ( ) ) ; if ( entry != null ) { entry . appendFailure ( new FlowEntryBuilder ( dpid , fm ) . build ( ) ) ; } else { log . error ( "No<seq2seq4repair_space>matching<seq2seq4repair_space>batch<seq2seq4repair_space>for<seq2seq4repair_space>this<seq2seq4repair_space>error:<seq2seq4repair_space>{}" , error ) ; } } else { log . error ( ( "Flow<seq2seq4repair_space>installation<seq2seq4repair_space>failed<seq2seq4repair_space>but<seq2seq4repair_space>switch<seq2seq4repair_space>didn't" + "<seq2seq4repair_space>tell<seq2seq4repair_space>us<seq2seq4repair_space>which<seq2seq4repair_space>one." ) ) ; } } else { log . warn ( "Received<seq2seq4repair_space>error<seq2seq4repair_space>{}" , error ) ; } default : log . debug ( "Unhandled<seq2seq4repair_space>message<seq2seq4repair_space>type:<seq2seq4repair_space>{}" , msg . getType ( ) ) ; } } @ Override public void receivedRoleReply ( Dpid dpid , RoleState requested , RoleState response ) { } private void pushFlowMetrics ( Dpid dpid , OFFlowStatsReply replies ) { } private boolean tableMissRule ( Dpid dpid , OFFlowStatsEntry reply ) { } } private class InternalCacheEntry { private final FlowRuleBatchOperation operation ; private final Set < FlowRule > failures = Sets . newConcurrentHashSet ( ) ; public InternalCacheEntry ( FlowRuleBatchOperation operation ) { } public void appendFailure ( FlowRule rule ) { } public CompletedBatchOperation failedCompletion ( ) { } public CompletedBatchOperation completed ( ) { } } }

Fix:
if ( ( ( ( org . projectfloodlight . openflow . protocol . OFStatsReply ) ( msg ) ) . getStatsType ( ) ) == ( OFStatsType . FLOW ) ) {