Skip to content

Commit

Permalink
[caps] Use DataForm.getFormType() when sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed Jun 27, 2024
1 parent a1e85d6 commit ba02a86
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
import org.jivesoftware.smackx.disco.packet.DiscoverInfoBuilder;
import org.jivesoftware.smackx.disco.packet.DiscoverInfoView;
import org.jivesoftware.smackx.xdata.FormField;
import org.jivesoftware.smackx.xdata.TextSingleFormField;
import org.jivesoftware.smackx.xdata.packet.DataForm;

import org.jxmpp.jid.DomainBareJid;
Expand Down Expand Up @@ -683,12 +682,12 @@ protected static CapsVersionAndHash generateVerificationString(DiscoverInfoView
// by the XML character data of the <value/> element).
Collections.sort(extendedInfos, new Comparator<DataForm>() {
@Override
public int compare(DataForm d1, DataForm d2) {
final TextSingleFormField hft1 = d1.getHiddenFormTypeField();
assert hft1 != null; // ensured by the previous step.
final TextSingleFormField hft2 = d2.getHiddenFormTypeField();
assert hft2 != null; // ensured by the previous step.
return hft1.getFirstValue().compareTo(hft2.getFirstValue());
public int compare(DataForm dataFormLeft, DataForm dataFormRight) {
final String formTypeLeft = dataFormLeft.getFormType();
assert formTypeLeft != null; // ensured by the previous step.
final String formTypeRight = dataFormRight.getFormType();
assert formTypeRight != null; // ensured by the previous step.
return formTypeLeft.compareTo(formTypeRight);
}
});

Expand Down

0 comments on commit ba02a86

Please sign in to comment.