diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/deser/AvroFieldDefaulters.java b/avro/src/main/java/tools/jackson/dataformat/avro/deser/AvroFieldDefaulters.java index a9b21056f..5e44037e0 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/deser/AvroFieldDefaulters.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/deser/AvroFieldDefaulters.java @@ -41,12 +41,9 @@ public static AvroFieldReader createDefaulter(String name, return new ScalarDefaults.StringDefaults(name, defaultAsNode.asText()); case START_OBJECT: { - Iterator> it = defaultAsNode.fields(); List readers = new ArrayList<>(); - while (it.hasNext()) { - Map.Entry entry = it.next(); - String propName = entry.getKey(); - readers.add(createDefaulter(propName, entry.getValue())); + for (Map.Entry entry : defaultAsNode.properties()) { + readers.add(createDefaulter(entry.getKey(), entry.getValue())); } return StructDefaults.createObjectDefaults(name, readers); } diff --git a/cbor/src/test/java/tools/jackson/dataformat/cbor/mapper/TreeReadViaMapperTest.java b/cbor/src/test/java/tools/jackson/dataformat/cbor/mapper/TreeReadViaMapperTest.java index 3ff86e90e..8bd50d842 100644 --- a/cbor/src/test/java/tools/jackson/dataformat/cbor/mapper/TreeReadViaMapperTest.java +++ b/cbor/src/test/java/tools/jackson/dataformat/cbor/mapper/TreeReadViaMapperTest.java @@ -26,7 +26,7 @@ public void testSimple() throws Exception assertTrue(result.isObject()); ObjectNode main = (ObjectNode) result; - assertEquals("Image", main.propertyNames().next()); + assertEquals("Image", main.propertyNames().iterator().next()); JsonNode ob = main.iterator().next(); assertType(ob, ObjectNode.class); ObjectNode imageMap = (ObjectNode) ob; diff --git a/smile/src/test/java/tools/jackson/dataformat/smile/mapper/TreeReadViaMapperTest.java b/smile/src/test/java/tools/jackson/dataformat/smile/mapper/TreeReadViaMapperTest.java index 6540deee9..796945a9f 100644 --- a/smile/src/test/java/tools/jackson/dataformat/smile/mapper/TreeReadViaMapperTest.java +++ b/smile/src/test/java/tools/jackson/dataformat/smile/mapper/TreeReadViaMapperTest.java @@ -26,7 +26,7 @@ public void testSimple() throws Exception assertTrue(result.isObject()); ObjectNode main = (ObjectNode) result; - assertEquals("Image", main.propertyNames().next()); + assertEquals("Image", main.propertyNames().iterator().next()); JsonNode ob = main.iterator().next(); assertType(ob, ObjectNode.class); ObjectNode imageMap = (ObjectNode) ob;