1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +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) { public ExtensionElement overrideExtension(ExtensionElement extension) {
if (extension == null) return null; if (extension == null) return null;
synchronized (packetExtensions) { 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); addExtension(extension);
return removedExtension; return removedExtension;
} }