Skip to content

ION - MappingIterator skip the first line #493

@loicmathieu

Description

@loicmathieu

When reading an ION file using a MappingIterator, the first line is omitted.

        // This file has 5 lines
        File testFile = resourceToFile("test.ion");

        ObjectMapper objectMapper = JacksonUtils.createIonObjectMapper();
        MappingIterator<Object> mappingIterator = objectMapper.readerFor(DEFAULT_TYPE_REFERENCE).readValues(new FileInputStream(testFile));

        // the first line is missing
        LongAdder count = new LongAdder();
        mappingIterator.forEachRemaining(obj -> {
            count.increment();
        });
        Assertions.assertEquals(5, count.sum()); // fails as count.sum() returns 4 and not 5 as the first line is missing

When reading in a more traditional approach the object mapper correctly read all 5 lines

Reproducer project, there is a test in it:
mapping-iterator.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    has-failing-testIndicates that there exists a test case (under `failing/`) to reproduce the issueion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions