From 66efe24932d7caafcba8326611f9f9dbcfcc171c Mon Sep 17 00:00:00 2001 From: Mark Struberg Date: Wed, 4 Oct 2023 13:19:08 +0200 Subject: [PATCH] fixes: #344 CDI differs from non-CDI test The SerializersCustomizationCDITest did assume a different behaviour than the non-CDI SerializersCustomizationTest. --- .../AnimalListDeserializerInjected.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tck/src/main/java/ee/jakarta/tck/json/bind/cdi/customizedmapping/serializers/model/serializer/AnimalListDeserializerInjected.java b/tck/src/main/java/ee/jakarta/tck/json/bind/cdi/customizedmapping/serializers/model/serializer/AnimalListDeserializerInjected.java index 137f91e1..d332f14f 100644 --- a/tck/src/main/java/ee/jakarta/tck/json/bind/cdi/customizedmapping/serializers/model/serializer/AnimalListDeserializerInjected.java +++ b/tck/src/main/java/ee/jakarta/tck/json/bind/cdi/customizedmapping/serializers/model/serializer/AnimalListDeserializerInjected.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -39,11 +39,16 @@ public class AnimalListDeserializerInjected public List deserialize(JsonParser jsonParser, DeserializationContext deserializationContext, Type type) { - // start array List animals = new ArrayList<>(); - while (jsonParser.next() == JsonParser.Event.START_OBJECT) { - animals.add(animalDeserializer.deserialize(jsonParser, - deserializationContext, type)); + + // start array + while (jsonParser.hasNext()) { + JsonParser.Event event = jsonParser.next(); + while (event == JsonParser.Event.START_OBJECT) { + animals.add(animalDeserializer.deserialize(jsonParser, + deserializationContext, type)); + event = jsonParser.next(); + } } return animals;