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,11 +1175,15 @@ public class HttpSession extends LocalClientSession { ...@@ -1175,11 +1175,15 @@ 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());
} }
} }
}
public String getDeliverable() { public String getDeliverable() {
if (text == null) { if (text == null) {
......
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