Commit c5c7c939 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Replace invalid presence types with an available presence type. JM-340


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1655 b35dd754-fafc-0310-a699-88a17e54d16e
parent 8b421732
...@@ -186,7 +186,7 @@ public abstract class SocketReader implements Runnable { ...@@ -186,7 +186,7 @@ public abstract class SocketReader implements Runnable {
try { try {
packet = new Presence(doc); packet = new Presence(doc);
} }
catch(IllegalArgumentException e) { catch (IllegalArgumentException e) {
// The original packet contains a malformed JID so answer an error // The original packet contains a malformed JID so answer an error
Presence reply = new Presence(); Presence reply = new Presence();
reply.setID(doc.attributeValue("id")); reply.setID(doc.attributeValue("id"));
...@@ -196,6 +196,15 @@ public abstract class SocketReader implements Runnable { ...@@ -196,6 +196,15 @@ public abstract class SocketReader implements Runnable {
session.process(reply); session.process(reply);
continue; continue;
} }
try {
packet.getType();
}
catch (IllegalArgumentException e) {
Log.warn("Invalid presence type", e);
// The presence packet contains an invalid presence type so replace it with
// an available presence type
packet.setType(null);
}
processPresence(packet); processPresence(packet);
} }
else if ("iq".equals(tag)) { else if ("iq".equals(tag)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment