throw invalid viewType exception

This commit is contained in:
kosyak 2024-02-01 20:20:48 +01:00
parent a45e35bbcc
commit 7db4435e7c

View file

@ -2666,6 +2666,10 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
}
}
if (viewType == -1) {
throw new RuntimeException("Invalid field " + responseElement.getName() + " " + formType + " " + fieldType + " " + el.getName() + " " + el);
}
return new Field(eu.siacs.conversations.xmpp.forms.Field.parse(el), viewType);
}
@ -2689,10 +2693,22 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
return field;
}
}
if (viewType == -1) {
throw new RuntimeException("Invalid element " + el.getName() + " " + el.getNamespace() + " " + el);
}
} else if (response != null) {
viewType = TYPE_ERROR;
}
if (viewType == -1) {
if (responseElement == null) {
throw new RuntimeException("Invalid element - nullable response");
} else {
throw new RuntimeException("Invalid element, type " + response.getType());
}
}
Item item = new Item(el, viewType);
items.put(pos, item);
return item;