Invalid presence type should be warning instead of error
Description
Sending an invalid presence type disconnects the client connection. We should log a warning and ignore the invalid type instead. This will greatly improve compatibility with some older clients. The two presence types that often get sent are "available" and "invisible". Sending "available" is just a mistake by client authors. The "invisible" mode is an old JEP that is now deprecated (privacy lists should be used instead). I propose that if the user sends an invalid presence type, we drop that type and assume an standard "available" presence packet (but also log the warning).
Environment
None
Activity
Show:
Gaston Dombiak
July 20, 2005 at 10:06 PM
This is a common stack trace:
] Could not route packet java.lang.IllegalArgumentException: No enum const class org.xmpp.packet.Presence$Type.available at java.lang.Enum.valueOf(Unknown Source) at org.xmpp.packet.Presence$Type.valueOf(Presence.java:308) at org.xmpp.packet.Presence.getType(Presence.java:93) at org.jivesoftware.messenger.PresenceRouter.handle(PresenceRouter.java:77) at org.jivesoftware.messenger.PresenceRouter.route(PresenceRouter.java:59) at org.jivesoftware.messenger.PacketRouter.route(PacketRouter.java:73) at org.jivesoftware.messenger.net.SocketReadThread.readStream(SocketReadThread.java:240 ) at org.jivesoftware.messenger.net.SocketReadThread.run(SocketReadThread.java:105)
Sending an invalid presence type disconnects the client connection. We should log a warning and ignore the invalid type instead. This will greatly improve compatibility with some older clients. The two presence types that often get sent are "available" and "invisible". Sending "available" is just a mistake by client authors. The "invisible" mode is an old JEP that is now deprecated (privacy lists should be used instead). I propose that if the user sends an invalid presence type, we drop that type and assume an standard "available" presence packet (but also log the warning).