Make sendStanza() final

This commit is contained in:
Florian Schmaus 2019-02-04 09:49:51 +01:00
parent 5705f18f58
commit dc780ffd6c
2 changed files with 3 additions and 5 deletions

View File

@ -738,9 +738,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
} }
} }
// TODO: This method should be final.
@Override @Override
public void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException { public final void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException {
Objects.requireNonNull(stanza, "Stanza must not be null"); Objects.requireNonNull(stanza, "Stanza must not be null");
assert (stanza instanceof Message || stanza instanceof Presence || stanza instanceof IQ); assert (stanza instanceof Message || stanza instanceof Presence || stanza instanceof IQ);

View File

@ -23,7 +23,6 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IQ.Type; import org.jivesoftware.smack.packet.IQ.Type;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
@ -42,8 +41,8 @@ public class ThreadedDummyConnection extends DummyConnection {
private volatile boolean timeout = false; private volatile boolean timeout = false;
@Override @Override
public void sendStanza(Stanza packet) throws NotConnectedException, InterruptedException { protected void sendStanzaInternal(Stanza packet) {
super.sendStanza(packet); super.sendStanzaInternal(packet);
if (packet instanceof IQ && !timeout) { if (packet instanceof IQ && !timeout) {
timeout = false; timeout = false;