1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 09:09:38 +02:00

Make sendPacket throw NotConnectedException

also use XMPPConnection.sendPacket() instead of
PacketWriter.sendPacket() in XMPPTCPConnection.
This commit is contained in:
Florian Schmaus 2014-05-03 10:23:57 +02:00
parent 7041e90522
commit 42f2eae8fb
5 changed files with 40 additions and 31 deletions

View file

@ -336,14 +336,15 @@ public class XMPPBOSHConnection extends XMPPConnection {
callConnectionAuthenticatedListener();
}
void sendPacketInternal(Packet packet) {
if (!done) {
try {
send(ComposableBody.builder().setPayloadXML(packet.toXML().toString())
.build());
} catch (BOSHException e) {
LOGGER.log(Level.SEVERE, "BOSHException in sendPacketInternal", e);
}
void sendPacketInternal(Packet packet) throws NotConnectedException {
if (done) {
throw new NotConnectedException();
}
try {
send(ComposableBody.builder().setPayloadXML(packet.toXML().toString()).build());
}
catch (BOSHException e) {
LOGGER.log(Level.SEVERE, "BOSHException in sendPacketInternal", e);
}
}