Merge branch '4.4'

This commit is contained in:
Florian Schmaus 2021-06-25 15:08:36 +02:00
commit 3fde4830e4
2 changed files with 15 additions and 13 deletions

View File

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.address;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.jivesoftware.smack.SmackException.FeatureNotSupportedException; import org.jivesoftware.smack.SmackException.FeatureNotSupportedException;
@ -228,18 +229,16 @@ public class MultipleRecipientManager {
throw new AssertionError(); throw new AssertionError();
} }
if (to == null) to = Collections.emptyList();
if (cc == null) cc = Collections.emptyList();
if (bcc == null) bcc = Collections.emptyList();
final int numRecipients = to.size() + cc.size() + bcc.size(); final int numRecipients = to.size() + cc.size() + bcc.size();
final List<Jid> recipients = new ArrayList<>(numRecipients); final List<Jid> recipients = new ArrayList<>(numRecipients);
if (to != null) { recipients.addAll(to);
recipients.addAll(to); recipients.addAll(cc);
} recipients.addAll(bcc);
if (cc != null) {
recipients.addAll(cc);
}
if (bcc != null) {
recipients.addAll(bcc);
}
final List<Stanza> stanzasToSend = new ArrayList<>(numRecipients); final List<Stanza> stanzasToSend = new ArrayList<>(numRecipients);
for (Jid recipient : recipients) { for (Jid recipient : recipients) {

View File

@ -58,7 +58,13 @@ public class FillableForm extends FilledForm {
if (formField.isRequired()) { if (formField.isRequired()) {
String fieldName = formField.getFieldName(); String fieldName = formField.getFieldName();
requiredFields.add(fieldName); requiredFields.add(fieldName);
missingRequiredFields.add(fieldName);
if (formField.hasValueSet()) {
// This is a form field with a default value.
write(formField);
} else {
missingRequiredFields.add(fieldName);
}
} }
} }
this.requiredFields = Collections.unmodifiableSet(requiredFields); this.requiredFields = Collections.unmodifiableSet(requiredFields);
@ -223,9 +229,6 @@ public class FillableForm extends FilledForm {
if (!getDataForm().hasField(fieldName)) { if (!getDataForm().hasField(fieldName)) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
if (filledFields.containsKey(fieldName)) {
throw new IllegalArgumentException();
}
// Perform validation, e.g. using XEP-0122. // Perform validation, e.g. using XEP-0122.
// TODO: We could also perform list-* option validation, but this has to take xep122's <open/> into account. // TODO: We could also perform list-* option validation, but this has to take xep122's <open/> into account.