1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-10-18 20:25:59 +02:00

[caps] Use DataForm.getFormType() when sorting

This commit is contained in:
Florian Schmaus 2024-06-27 17:04:05 +02:00
parent a1e85d644f
commit ba02a868f6

View file

@ -70,7 +70,6 @@ import org.jivesoftware.smackx.disco.packet.DiscoverInfo.Identity;
import org.jivesoftware.smackx.disco.packet.DiscoverInfoBuilder; import org.jivesoftware.smackx.disco.packet.DiscoverInfoBuilder;
import org.jivesoftware.smackx.disco.packet.DiscoverInfoView; import org.jivesoftware.smackx.disco.packet.DiscoverInfoView;
import org.jivesoftware.smackx.xdata.FormField; import org.jivesoftware.smackx.xdata.FormField;
import org.jivesoftware.smackx.xdata.TextSingleFormField;
import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.smackx.xdata.packet.DataForm;
import org.jxmpp.jid.DomainBareJid; import org.jxmpp.jid.DomainBareJid;
@ -683,12 +682,12 @@ public final class EntityCapsManager extends Manager {
// by the XML character data of the <value/> element). // by the XML character data of the <value/> element).
Collections.sort(extendedInfos, new Comparator<DataForm>() { Collections.sort(extendedInfos, new Comparator<DataForm>() {
@Override @Override
public int compare(DataForm d1, DataForm d2) { public int compare(DataForm dataFormLeft, DataForm dataFormRight) {
final TextSingleFormField hft1 = d1.getHiddenFormTypeField(); final String formTypeLeft = dataFormLeft.getFormType();
assert hft1 != null; // ensured by the previous step. assert formTypeLeft != null; // ensured by the previous step.
final TextSingleFormField hft2 = d2.getHiddenFormTypeField(); final String formTypeRight = dataFormRight.getFormType();
assert hft2 != null; // ensured by the previous step. assert formTypeRight != null; // ensured by the previous step.
return hft1.getFirstValue().compareTo(hft2.getFirstValue()); return formTypeLeft.compareTo(formTypeRight);
} }
}); });