Buggy code:
protected boolean automaticRecording ; protected long bytesReceived ; protected boolean checkVideoCodec = false ; protected boolean checkAudioCodec = false ; protected int chunkSize ; protected volatile boolean closed ; protected transient IMessageOutput connMsgOut ; protected long firstPacketTime = - 1 ; protected transient IPipe livePipe ; protected String publishedName ; protected Map < String , String > parameters ; protected boolean sendStartNotification = true ; private transient StatisticsCounter subscriberStats = new StatisticsCounter ( ) ; protected transient Set < IStreamListener > listeners = new CopyOnWriteArraySet < IStreamListener > ( ) ; private transient WeakReference < IRecordingListener > recordingListener ; protected long latestTimeStamp = - 1 ; private boolean registerJMX = true ; private void checkSendNotifications ( IEvent event ) { } public void close ( ) { } public void dispatchEvent ( IEvent event ) { if ( ( event instanceof IRTMPEvent ) && ( ! ( closed ) ) ) { switch ( event . getType ( ) ) { case STREAM_CONTROL : case STREAM_DATA : IRTMPEvent rtmpEvent ; try { rtmpEvent = ( ( IRTMPEvent ) ( event ) ) ; } catch ( ClassCastException e ) { ClientBroadcastStream . log . error ( "Class<seq2seq4repair_space>cast<seq2seq4repair_space>exception<seq2seq4repair_space>in<seq2seq4repair_space>event<seq2seq4repair_space>dispatch" , e ) ; return ; } int eventTime = - 1 ; if ( ClientBroadcastStream . log . isTraceEnabled ( ) ) { if ( ( firstPacketTime ) == ( - 1 ) ) { firstPacketTime = rtmpEvent . getTimestamp ( ) ; ClientBroadcastStream . log . trace ( String . format ( "CBS=@%08x:<seq2seq4repair_space>rtmpEvent=%s<seq2seq4repair_space>creation=%s<seq2seq4repair_space>firstPacketTime=%d" , System . identityHashCode ( this ) , rtmpEvent . getClass ( ) . getSimpleName ( ) , creationTime , firstPacketTime ) ) ; } else { ClientBroadcastStream . log . trace ( String . format ( "CBS=@%08x:<seq2seq4repair_space>rtmpEvent=%s<seq2seq4repair_space>creation=%s<seq2seq4repair_space>firstPacketTime=%d<seq2seq4repair_space>timestamp=%d" , System . identityHashCode ( this ) , rtmpEvent . getClass ( ) . getSimpleName ( ) , creationTime , firstPacketTime , rtmpEvent . getTimestamp ( ) ) ) ; } } IoBuffer buf = null ; if ( ( rtmpEvent instanceof IStreamData ) && ( ( buf = ( ( IStreamData < ? > ) ( rtmpEvent ) ) . getData ( ) ) != null ) ) { bytesReceived += buf . limit ( ) ; } IStreamCodecInfo codecInfo = getCodecInfo ( ) ; StreamCodecInfo info = null ; if ( codecInfo instanceof StreamCodecInfo ) { info = ( ( StreamCodecInfo ) ( codecInfo ) ) ; } if ( rtmpEvent instanceof AudioData ) { IAudioStreamCodec audioStreamCodec = null ; if ( checkAudioCodec ) { if ( ( buf . limit ( ) ) > 0 ) { audioStreamCodec = AudioCodecFactory . getAudioCodec ( buf ) ; if ( info != null ) { info . setAudioCodec ( audioStreamCodec ) ; } checkAudioCodec = false ; } } else if ( codecInfo != null ) { audioStreamCodec = codecInfo . getAudioCodec ( ) ; } if ( audioStreamCodec != null ) { audioStreamCodec . addData ( buf . asReadOnlyBuffer ( ) ) ; } if ( info != null ) { info . setHasAudio ( true ) ; } eventTime = rtmpEvent . getTimestamp ( ) ; ClientBroadcastStream . log . trace ( "Audio:<seq2seq4repair_space>{}" , eventTime ) ; } else if ( rtmpEvent instanceof VideoData ) { IVideoStreamCodec videoStreamCodec = null ; if ( checkVideoCodec ) { videoStreamCodec = VideoCodecFactory . getVideoCodec ( buf ) ; if ( info != null ) { info . setVideoCodec ( videoStreamCodec ) ; } checkVideoCodec = false ; } else if ( codecInfo != null ) { videoStreamCodec = codecInfo . getVideoCodec ( ) ; } if ( videoStreamCodec != null ) { videoStreamCodec . addData ( buf . asReadOnlyBuffer ( ) ) ; } if ( info != null ) { info . setHasVideo ( true ) ; } eventTime = rtmpEvent . getTimestamp ( ) ; ClientBroadcastStream . log . trace ( "Video:<seq2seq4repair_space>{}" , eventTime ) ; } else if ( rtmpEvent instanceof Invoke ) { eventTime = rtmpEvent . getTimestamp ( ) ; return ; } else if ( rtmpEvent instanceof Notify ) { Notify notifyEvent = ( ( Notify ) ( rtmpEvent ) ) ; <START_BUG> if ( ( ( metaData ) == null ) && ( ( notifyEvent . getHeader ( ) . getDataType ( ) ) == ( Notify . TYPE_STREAM_METADATA ) ) ) { <END_BUG> try { metaData = notifyEvent . duplicate ( ) ; } catch ( Exception e ) { ClientBroadcastStream . log . warn ( "Metadata<seq2seq4repair_space>could<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>duplicated<seq2seq4repair_space>for<seq2seq4repair_space>this<seq2seq4repair_space>stream" , e ) ; } } eventTime = rtmpEvent . getTimestamp ( ) ; } if ( eventTime > ( latestTimeStamp ) ) { latestTimeStamp = eventTime ; } checkSendNotifications ( event ) ; try { if ( ( livePipe ) != null ) { RTMPMessage msg = RTMPMessage . build ( rtmpEvent , eventTime ) ; livePipe . pushMessage ( msg ) ; } else { ClientBroadcastStream . log . debug ( "Live<seq2seq4repair_space>pipe<seq2seq4repair_space>was<seq2seq4repair_space>null,<seq2seq4repair_space>message<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>pushed" ) ; } } catch ( IOException err ) { stop ( ) ; } if ( rtmpEvent instanceof IStreamPacket ) { for ( IStreamListener listener : getStreamListeners ( ) ) { try { listener . packetReceived ( this , ( ( IStreamPacket ) ( rtmpEvent ) ) ) ; } catch ( Exception e ) { ClientBroadcastStream . log . error ( "Error<seq2seq4repair_space>while<seq2seq4repair_space>notifying<seq2seq4repair_space>listener<seq2seq4repair_space>{}" , listener , e ) ; if ( listener instanceof RecordingListener ) { sendRecordFailedNotify ( e . getMessage ( ) ) ; } } } } break ; default : ClientBroadcastStream . log . debug ( "Ignoring<seq2seq4repair_space>event:<seq2seq4repair_space>{}" , event . getType ( ) ) ; } } else { ClientBroadcastStream . log . debug ( "Event<seq2seq4repair_space>was<seq2seq4repair_space>of<seq2seq4repair_space>wrong<seq2seq4repair_space>type<seq2seq4repair_space>or<seq2seq4repair_space>stream<seq2seq4repair_space>is<seq2seq4repair_space>closed<seq2seq4repair_space>({})" , closed ) ; } } public int getActiveSubscribers ( ) { } public long getBytesReceived ( ) { } public int getCurrentTimestamp ( ) { } public int getMaxSubscribers ( ) { }

Fix:
if ( ( notifyEvent . getHeader ( ) . getDataType ( ) ) == ( Notify . TYPE_STREAM_METADATA ) ) {