1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

Fix Stanza.overrideExtension(ExtensionElement)

Also fixes SMACK-818.
This commit is contained in:
Florian Schmaus 2018-05-10 15:34:24 +02:00
parent 458d8d98b6
commit 0e31bc8f73

View file

@ -394,7 +394,10 @@ public abstract class Stanza implements TopLevelStreamElement {
public ExtensionElement overrideExtension(ExtensionElement extension) {
if (extension == null) return null;
synchronized (packetExtensions) {
ExtensionElement removedExtension = removeExtension(extension);
// Note that we need to use removeExtension(String, String) here. If would use
// removeExtension(ExtensionElement) then we would remove based on the equality of ExtensionElement, which
// is not what we want in this case.
ExtensionElement removedExtension = removeExtension(extension.getElementName(), extension.getNamespace());
addExtension(extension);
return removedExtension;
}