In Smack 4.4.1 the register function in the FormFieldRegistry has some conflicting code.
If a registered field is already registered with a different fieldType a empty IllegalArgumentException is thrown, where as the intention of the code indicates it would be expected to log just a warning.
Solution: remove the throw of the IllegalArgumentException and the code alongside.
FormField.Type previousType;
synchronized (REGISTRY) {
Map<String, FormField.Type> fieldNameToType = REGISTRY.get(formType);
if (fieldNameToType == null) {
fieldNameToType = new HashMap<>();
REGISTRY.put(formType, fieldNameToType);
} else {
// previousType = fieldNameToType.get(fieldName);
// if (previousType != null && previousType != fieldType) {
// throw new IllegalArgumentException();
// }
}
previousType = fieldNameToType.put(fieldName, fieldType);
}
if (previousType != null && fieldType != previousType) {
LOGGER.warning("Form field registry inconsitency detected: Registered field '" + fieldName + "' of type " + fieldType + " but previous type was " + previousType);
}