Commit fe8d6a26 authored by Tom Evans's avatar Tom Evans Committed by Christian Schudt

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 7745e413
......@@ -1175,9 +1175,13 @@ public class HttpSession extends LocalClientSession {
for (Packet packet : elements) {
// Append packet namespace according XEP-0206 if needed
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