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

Modified since adding a DOM attribute with value null is a safe operation.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1076 b35dd754-fafc-0310-a699-88a17e54d16e
parent fe9b8d10
...@@ -195,13 +195,9 @@ public class SocketReadThread extends Thread { ...@@ -195,13 +195,9 @@ public class SocketReadThread extends Thread {
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
Message reply = new Message(); Message reply = new Message();
if (doc.attributeValue("id") != null) { reply.setID(doc.attributeValue("id"));
reply.setID(doc.attributeValue("id"));
}
reply.setTo(session.getAddress()); reply.setTo(session.getAddress());
if (doc.attributeValue("to") != null) { reply.getElement().addAttribute("from", doc.attributeValue("to"));
reply.getElement().addAttribute("from", doc.attributeValue("to"));
}
reply.setError(PacketError.Condition.jid_malformed); reply.setError(PacketError.Condition.jid_malformed);
session.process(reply); session.process(reply);
continue; continue;
...@@ -219,13 +215,9 @@ public class SocketReadThread extends Thread { ...@@ -219,13 +215,9 @@ public class SocketReadThread extends Thread {
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();
if (doc.attributeValue("id") != null) { reply.setID(doc.attributeValue("id"));
reply.setID(doc.attributeValue("id"));
}
reply.setTo(session.getAddress()); reply.setTo(session.getAddress());
if (doc.attributeValue("to") != null) { reply.getElement().addAttribute("from", doc.attributeValue("to"));
reply.getElement().addAttribute("from", doc.attributeValue("to"));
}
reply.setError(PacketError.Condition.jid_malformed); reply.setError(PacketError.Condition.jid_malformed);
session.process(reply); session.process(reply);
continue; continue;
...@@ -248,9 +240,7 @@ public class SocketReadThread extends Thread { ...@@ -248,9 +240,7 @@ public class SocketReadThread extends Thread {
if (!doc.elements().isEmpty()) { if (!doc.elements().isEmpty()) {
reply.setChildElement(((Element) doc.elements().get(0)).createCopy()); reply.setChildElement(((Element) doc.elements().get(0)).createCopy());
} }
if (doc.attributeValue("id") != null) { reply.setID(doc.attributeValue("id"));
reply.setID(doc.attributeValue("id"));
}
reply.setTo(session.getAddress()); reply.setTo(session.getAddress());
if (doc.attributeValue("to") != null) { if (doc.attributeValue("to") != null) {
reply.getElement().addAttribute("from", doc.attributeValue("to")); reply.getElement().addAttribute("from", doc.attributeValue("to"));
......
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