Buggy code:
@ Override protected void throwAlreadyLoggedInExceptionIfAppropriate ( ) throws AlreadyLoggedInException { } @ Override protected void afterSuccessfulLogin ( final boolean resumed ) throws NotConnectedException { } @ Override protected synchronized void loginNonAnonymously ( String username , String password , String resource ) throws IOException , SmackException , XMPPException { } @ Override public synchronized void loginAnonymously ( ) throws IOException , SmackException , XMPPException { } @ Override public boolean isSecureConnection ( ) { } public boolean isSocketClosed ( ) { } @ Override protected void shutdown ( ) { } public synchronized void instantShutdown ( ) { } private void shutdown ( boolean instant ) { } @ Override public void send ( PlainStreamElement element ) throws NotConnectedException { } @ Override protected void sendPacketInternal ( Stanza packet ) throws NotConnectedException { } private void connectUsingConfiguration ( ) throws IOException , ConnectionException { } private void initConnection ( ) throws IOException { } private void initReaderAndWriter ( ) throws IOException { } private void proceedTLSReceived ( ) throws IOException , KeyManagementException , KeyStoreException , NoSuchAlgorithmException , NoSuchProviderException , UnrecoverableKeyException , CertificateException , SmackException { } private XMPPInputOutputStream maybeGetCompressionHandler ( ) { } @ Override public boolean isUsingCompression ( ) { } private void useCompression ( ) throws NoResponseException , NotConnectedException , XMPPException { } @ Override protected void connectInternal ( ) throws IOException , SmackException , XMPPException { } private synchronized void notifyConnectionError ( Exception e ) { } protected void setWriter ( Writer writer ) { } @ Override protected void afterFeaturesReceived ( ) throws NotConnectedException , SecurityRequiredException { } void openStream ( ) throws SmackException { } protected class PacketReader { XmlPullParser parser ; private volatile boolean done ; void init ( ) { } void shutdown ( ) { } private void parsePackets ( ) { } } protected class PacketWriter { public static final int QUEUE_SIZE = XMPPTCPConnection . QUEUE_SIZE ; private final ArrayBlockingQueueWithShutdown < Element > queue = new ArrayBlockingQueueWithShutdown < Element > ( XMPPTCPConnection . PacketWriter . QUEUE_SIZE , true ) ; protected SynchronizationPoint < NoResponseException > shutdownDone = new SynchronizationPoint < NoResponseException > ( XMPPTCPConnection . this ) ; protected volatile Long shutdownTimestamp = null ; private volatile boolean instantShutdown ; void init ( ) { } private boolean done ( ) { } protected void throwNotConnectedExceptionIfDoneAndResumptionNotPossible ( ) throws NotConnectedException { } protected void sendStreamElement ( Element element ) throws NotConnectedException { } void shutdown ( boolean instant ) { } private Element nextStreamElement ( ) { } private void writePackets ( ) { } private void drainWriterQueueToUnacknowledgedStanzas ( ) { } } public static void setUseStreamManagementDefault ( boolean useSmDefault ) { } public static void setUseStreamManagementResumptiodDefault ( boolean useSmResumptionDefault ) { } public void setUseStreamManagement ( boolean useSm ) { } public void setUseStreamManagementResumption ( boolean useSmResumption ) { } public void setPreferredResumptionTime ( int resumptionTime ) { } public boolean addRequestAckPredicate ( PacketFilter predicate ) { } public boolean removeRequestAckPredicate ( PacketFilter predicate ) { } public void removeAllRequestAckPredicates ( ) { } public void requestSmAcknowledgement ( ) throws NotConnectedException , StreamManagementNotEnabledException { } private void requestSmAcknowledgementInternal ( ) throws NotConnectedException { } public void sendSmAcknowledgement ( ) throws NotConnectedException , StreamManagementNotEnabledException { } private void sendSmAcknowledgementInternal ( ) throws NotConnectedException { } public void addStanzaAcknowledgedListener ( PacketListener listener ) { } public boolean removeStanzaAcknowledgedListener ( PacketListener listener ) { } public void removeAllStanzaAcknowledgedListeners ( ) { } public PacketListener addStanzaIdAcknowledgedListener ( final String id , PacketListener listener ) throws StreamManagementNotEnabledException { } public PacketListener removeStanzaIdAcknowledgedListener ( String id ) { } public void removeAllStanzaIdAcknowledgedListeners ( ) { } public boolean isSmAvailable ( ) { } public boolean isSmEnabled ( ) { } public boolean streamWasResumed ( ) { } public boolean isDisconnectedButSmResumptionPossible ( ) { } public boolean isSmResumptionPossible ( ) { } public int getMaxSmResumptionTime ( ) { } private void processHandledCount ( long handledCount ) throws NotConnectedException , StreamManagementCounterError { long ackedStanzasCount = SMUtils . calculateDelta ( handledCount , serverHandledStanzasCount ) ; final List < Stanza > ackedStanzas = new ArrayList < Stanza > ( ( handledCount <= ( Integer . MAX_VALUE ) ? ( ( int ) ( handledCount ) ) : Integer . MAX_VALUE ) ) ; for ( long i = 0 ; i < ackedStanzasCount ; i ++ ) { Stanza ackedStanza = unacknowledgedStanzas . poll ( ) ; if ( ackedStanza == null ) { throw new StreamManagementCounterError ( handledCount , serverHandledStanzasCount , ackedStanzasCount , ackedStanzas ) ; } ackedStanzas . add ( ackedStanza ) ; } boolean atLeastOneStanzaAcknowledgedListener = false ; if ( ! ( stanzaAcknowledgedListeners . isEmpty ( ) ) ) { atLeastOneStanzaAcknowledgedListener = true ; } else { for ( Stanza ackedStanza : ackedStanzas ) { String id = ackedStanza . getStanzaId ( ) ; if ( ( id != null ) && ( stanzaIdAcknowledgedListeners . containsKey ( id ) ) ) { atLeastOneStanzaAcknowledgedListener = true ; break ; } } } if ( atLeastOneStanzaAcknowledgedListener ) { asyncGo ( new Runnable ( ) { @ Override public void run ( ) { for ( Stanza ackedStanza : ackedStanzas ) { for ( PacketListener listener : stanzaAcknowledgedListeners ) { try { listener . processPacket ( ackedStanza ) ; } catch ( NotConnectedException e ) { XMPPTCPConnection . LOGGER . log ( Level . FINER , "Received<seq2seq4repair_space>not<seq2seq4repair_space>connected<seq2seq4repair_space>exception" , e ) ; } } String id = ackedStanza . getStanzaId ( ) ; if ( StringUtils . isNullOrEmpty ( id ) ) { <START_BUG> return ; <END_BUG> } PacketListener listener = stanzaIdAcknowledgedListeners . remove ( id ) ; if ( listener != null ) { try { listener . processPacket ( ackedStanza ) ; } catch ( NotConnectedException e ) { XMPPTCPConnection . LOGGER . log ( Level . FINER , "Received<seq2seq4repair_space>not<seq2seq4repair_space>connected<seq2seq4repair_space>exception" , e ) ; } } } } } ) ; } serverHandledStanzasCount = handledCount ; } public static void setDefaultBundleAndDeferCallback ( BundleAndDeferCallback defaultBundleAndDeferCallback ) { } public void setBundleandDeferCallback ( BundleAndDeferCallback bundleAndDeferCallback ) { } }

Fix:
continue ;