powered by Jive Software

Connection/XMMPConnection#sendPacket should not throw an IllegalStateExceptionexception

I believe I am not the only developer who find this behavior annoying.

At first it is not mentioned in the Javadoc at all that this exception can be thrown.

I did not dig through the whole codebase of Smack but I believe that this may also affect internal Smack components as well,

not handling this unchecked exceptions correctly.

This exception becomes “evil” if you access the Smack Library by multiple threads, performing logic in the background

while the connection get broken and may mess up your logic if you are not aware of this unchecked exception.

Last but not least this check is just “dump”. The packet to send will be just put into an internal buffer, so it is still possible that

this packet will never be send anyways.

My personal suggestion would be:

Either throw an checked IOException or just ignore (just log internal) that this packet could not be send. It is likely that you will

await a response if you send a (IQ) packet, so the response will timeout anyways.