Commit 6965c13e authored by Tom Evans's avatar Tom Evans

OF-938: Apply packet namespace via string insert

This patch fixes a problem introduced by an earlier patch whereby a
change to the Packet namespace inadvertently cascaded to child XML
elements.
parent 90b26b2d
...@@ -1169,9 +1169,13 @@ public class HttpSession extends LocalClientSession { ...@@ -1169,9 +1169,13 @@ public class HttpSession extends LocalClientSession {
for (Packet packet : elements) { for (Packet packet : elements) {
// Append packet namespace according XEP-0206 if needed // Append packet namespace according XEP-0206 if needed
if (Namespace.NO_NAMESPACE.equals(packet.getElement().getNamespace())) { if (Namespace.NO_NAMESPACE.equals(packet.getElement().getNamespace())) {
packet.getElement().add(Namespace.get("jabber:client")); // use string-based operation here to avoid cascading xmlns wonkery
StringBuilder packetXml = new StringBuilder(packet.toXML());
packetXml.insert(packetXml.indexOf(" "), " xmlns=\"jabber:client\"");
this.packets.add(packetXml.toString());
} else {
this.packets.add(packet.toXML());
} }
this.packets.add(packet.toXML());
} }
} }
......
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