fix(serialize-xml): fix values in objects not permitted

This commit is contained in:
Johannes Frohnmeyer 2024-04-20 16:53:43 +02:00
parent fcc3d97150
commit 0b6783c9bd
Signed by: Johannes
GPG Key ID: E76429612C2929F4
1 changed files with 3 additions and 0 deletions

View File

@ -199,6 +199,9 @@ public class XmlWriter extends SerializeWriter<IOException, XmlWriter> implement
private void beforeValue() throws IOException {
switch (peek()) {
case DOCUMENT, ARRAY, OBJECT_VALUE_WRAPPER -> {}
case OBJECT -> {
if (deferredName == null) throw new IllegalStateException("Name not set.");
}
default -> throw new IllegalStateException("Nesting problem.");
}
}