if (!conn.isConnected() && !action.equals(Connect.class.getCanonicalName())) { log.error("Please call Connect before calling other actions"); throw new SmackException.NotConnectedException();
if (!isConnected()) { exception = new NotConnectedException(AbstractXMPPConnection.this, replyFilter);
if (!isConnected()) { exception = new NotConnectedException(AbstractXMPPConnection.this, replyFilter); } else { exception = NoResponseException.newWith(AbstractXMPPConnection.this, replyFilter);
if (result == null) { if (!connection.isConnected()) { throw new NotConnectedException(connection, packetFilter);
@Override public void run() { boolean removed = removeAsyncStanzaListener(packetListener); // If the packetListener got removed, then it was never run and // we never received a response, inform the exception callback if (removed && exceptionCallback != null) { Exception exception; if (!isConnected()) { // If the connection is no longer connected, throw a not connected exception. exception = new NotConnectedException(AbstractXMPPConnection.this, replyFilter); } else { exception = NoResponseException.newWith(AbstractXMPPConnection.this, replyFilter); } final Exception exceptionToProcess = exception; Async.go(new Runnable() { @Override public void run() { exceptionCallback.processException(exceptionToProcess); } }); } } }, timeout, TimeUnit.MILLISECONDS);
@Override public void run() { boolean removed = removeAsyncStanzaListener(stanzaListener); if (!removed) { // We lost a race against the stanza listener, he already removed itself because he received a // reply. There is nothing more to do here. return; } // If the packetListener got removed, then it was never run and // we never received a response, inform the exception callback Exception exception; if (!isConnected()) { // If the connection is no longer connected, throw a not connected exception. exception = new NotConnectedException(AbstractXMPPConnection.this, replyFilter); } else { exception = NoResponseException.newWith(AbstractXMPPConnection.this, replyFilter); } future.setException(exception); } }, timeout, TimeUnit.MILLISECONDS);
protected void throwNotConnectedExceptionIfAppropriate(String optionalHint) throws NotConnectedException { if (!isConnected()) { throw new NotConnectedException(optionalHint); } }
if (!isConnected()) { exception = new NotConnectedException(AbstractXMPPConnection.this, replyFilter);
throw new NotConnectedException(connection, packetFilter);
throw new NotConnectedException();
@Override public void run() { boolean removed = removeAsyncStanzaListener(stanzaListener); if (!removed) { // We lost a race against the stanza listener, he already removed itself because he received a // reply. There is nothing more to do here. return; } // If the packetListener got removed, then it was never run and // we never received a response, inform the exception callback Exception exception; if (!isConnected()) { // If the connection is no longer connected, throw a not connected exception. exception = new NotConnectedException(AbstractXMPPConnection.this, replyFilter); } else { exception = NoResponseException.newWith(AbstractXMPPConnection.this, replyFilter); } future.setException(exception); } }, timeout, TimeUnit.MILLISECONDS);
@Override public void sendNonza(Nonza element) throws NotConnectedException { if (done) { throw new NotConnectedException(); } sendElement(element); }
protected void throwNotConnectedExceptionIfAppropriate(String optionalHint) throws NotConnectedException { if (!isConnected()) { throw new NotConnectedException(optionalHint); } }
protected void throwNotConnectedExceptionIfDoneAndResumptionNotPossible() throws NotConnectedException { final boolean done = done(); if (done) { final boolean smResumptionPossible = isSmResumptionPossible(); // Don't throw a NotConnectedException is there is an resumable stream available if (!smResumptionPossible) { throw new NotConnectedException(XMPPTCPConnection.this, "done=" + done + " smResumptionPossible=" + smResumptionPossible); } } }
@Override protected void throwNotConnectedExceptionIfAppropriate() throws NotConnectedException { if (packetWriter == null) { throw new NotConnectedException(); } packetWriter.throwNotConnectedExceptionIfDoneAndResumptionNotPossible(); }