fix(serialize): if view wasn't touched, run skipValue on close
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Johannes Frohnmeyer 2024-06-09 13:25:26 +02:00
parent 7c32530ee1
commit df4781ca9d
Signed by: Johannes
GPG Key ID: E76429612C2929F4
2 changed files with 10 additions and 2 deletions

View File

@ -135,6 +135,10 @@ public class ReaderItemView<TEx extends Exception> extends SerializeReader.Deleg
@Override
public void close() throws TEx {
if (!began) {
skipValue();
return;
}
while (depth > 0) {
depth = switch (delegate.peek()) {
case BEGIN_ARRAY, BEGIN_OBJECT, NULL, BOOLEAN, NUMBER, STRING, NAME -> {

View File

@ -144,9 +144,13 @@ public class WriterItemView<TEx extends Exception> extends SerializeWriter.Deleg
@Override
public void close() throws TEx {
if (!began) {
delegate.nullValue();
return;
}
while (depth > 0) {
if (stack[--depth]) endArray();
else endObject();
if (stack[--depth]) delegate.endArray();
else delegate.endObject();
}
}
}