Buggy code:
static List < Chat > chatRooms = new ArrayList < > ( ) ; private static MultiUserChat haberChat ; public static synchronized void runOnHaberThread ( Runnable runnable ) { } private NotificationManager notificationManager ; private int NOTIF_ID = 125125 ; private int NOTIF_EVENT_ID = ( NOTIF_ID ) + 1 ; public static HaberService . HaberCounter haberCounter ; private static HaberService instance = null ; public static MultiUserChat getHaberChat ( ) { } public static void resetCounters ( ) { } synchronized Runnable popRunnable ( ) { } public static synchronized void addHaberListener ( Haber . HaberListener listener ) { } public static void StopService ( Context context ) throws Exception { } public static void RestartService ( Context context ) { } public static boolean CanKick ( ) { } public static void KickUser ( String user , String reason ) { } private static HashMap < String , Boolean > modCache = new HashMap < > ( ) ; public static boolean IsMod ( String user ) { } private static boolean isMod ( String user ) { } private static HashMap < String , Rank > rankCache = new HashMap < > ( ) ; public static Rank GetRankForUser ( String user ) { } private static Rank findRankForUser ( String user ) { } private static synchronized ArrayList < Haber . HaberListener > getHaberListeners ( ) { } public static synchronized void removeHaberListener ( Haber . HaberListener listener ) { } @ Override public void onDestroy ( ) { } public void refreshNotification ( ) { } String getServiceStatus ( ) { } @ Override public void onCreate ( ) { } @ Override public void onStatusChanged ( final String status ) { } @ Override public void onLoggedIn ( MultiUserChat haberChat ) { } @ Override public void onMessageReceived ( Chat chat , Message message ) { Date date = new Date ( ) ; message . setSubject ( INCOMING ) ; ArrayList < Haber . HaberListener > corpses = new ArrayList < > ( ) ; for ( Haber . HaberListener listener : HaberService . getHaberListeners ( ) ) { if ( listener == null ) corpses . add ( null ) ; else if ( listener != ( this ) ) listener . onMessageReceived ( chat , message ) ; } for ( Haber . HaberListener listener : corpses ) HaberService . removeHaberListener ( listener ) ; if ( ( ! ( HaberService . chatRooms . contains ( chat ) ) ) && ( chat != null ) ) HaberService . chatRooms . add ( chat ) ; if ( ( HaberActivity . getInstance ( ) ) == null ) { if ( chat != null ) { if ( ( message . getFrom ( ) ) != null ) { HaberService . haberCounter . addPm ( message . getFrom ( ) ) ; refreshNotification ( ) ; } } else if ( ( message . getBody ( ) ) != null ) { if ( ! ( Haber . IsGuest ( ) ) ) { if ( message . getBody ( ) . toUpperCase ( ) . contains ( Haber . getUsername ( ) . toUpperCase ( ) ) ) { ( HaberService . haberCounter . mentionCounter ) ++ ; refreshNotification ( ) ; } } else { if ( message . getBody ( ) . toUpperCase ( ) . contains ( Haber . getUsername ( ) . substring ( 1 ) . toUpperCase ( ) ) ) { ( HaberService . haberCounter . mentionCounter ) ++ ; refreshNotification ( ) ; } } } } ( counter ) ++ ; <START_BUG> if ( ( counter ) >= 25 ) { <END_BUG> if ( ( ( AdvancedPreferences . ShouldVibrate ( this ) ) && ( AdvancedPreferences . ShouldVibrateInService ( this ) ) ) && ( ! ( HaberActivity . InstanceExists ( ) ) ) ) { boolean shouldVibrate = false ; if ( chat == null ) { if ( ( message . getBody ( ) ) != null ) { if ( AdvancedPreferences . ShouldVibrateOnReply ( this ) ) { String mark = "@" + ( Haber . getUsername ( ) ) ; if ( message . getBody ( ) . toUpperCase ( ) . contains ( mark . toUpperCase ( ) ) ) { ( ( android . os . Vibrator ) ( getSystemService ( Context . VIBRATOR_SERVICE ) ) ) . vibrate ( 100 ) ; shouldVibrate = true ; } else if ( Haber . IsGuest ( ) ) { mark = "@" + ( Haber . getUsername ( ) . substring ( 1 ) ) ; if ( message . getBody ( ) . toUpperCase ( ) . contains ( mark . toUpperCase ( ) ) ) { ( ( android . os . Vibrator ) ( getSystemService ( Context . VIBRATOR_SERVICE ) ) ) . vibrate ( 100 ) ; shouldVibrate = true ; } } } } } else { shouldVibrate = true ; } if ( shouldVibrate ) ( ( android . os . Vibrator ) ( getSystemService ( Context . VIBRATOR_SERVICE ) ) ) . vibrate ( 100 ) ; } } long delay = ( new Date ( ) . getTime ( ) ) - ( date . getTime ( ) ) ; Debug . log ( ( ( "onMessageReceived<seq2seq4repair_space>-<seq2seq4repair_space>" + delay ) + "<seq2seq4repair_space>ms" ) ) ; if ( delay > 300 ) { Debug . log ( "Slow<seq2seq4repair_space>frame<seq2seq4repair_space>detected,<seq2seq4repair_space>data:" ) ; Debug . log ( String . format ( "Counter:<seq2seq4repair_space>%d\n<seq2seq4repair_space>chat<seq2seq4repair_space>is<seq2seq4repair_space>null:<seq2seq4repair_space>%d\ncorpses.length():<seq2seq4repair_space>%d\nMessage:<seq2seq4repair_space>%s" , counter , ( chat == null ? 1 : 0 ) , corpses . size ( ) , message . toXML ( ) . toString ( ) ) ) ; } } int counter = 0 ; @ Override public void onRoomJoined ( Chat chat , boolean selfStarted ) { } @ Override public void onChatEvent ( Haber . ChatEvent event , String ... params ) { }

Fix:
if ( ( ( counter ) >= 25 ) && ( ! ( message . getSubject ( ) . equals ( OUTGOING ) ) ) ) {