Skip to content

FilteringGeneratorDelegate writeRawValue delegate to writeRaw instead of writeRawValue #580

@arnaudroger

Description

@arnaudroger

FilteringGeneratorDelegate delegates the writeRawValue call to the wrong methods

Reproducer

        ObjectMapper om = new ObjectMapper();

        StringWriter sw = new StringWriter();
        JsonGenerator generator = om.getFactory().createGenerator(sw);

        generator.writeStartArray();
        generator.writeRawValue(new char[] { '1'}, 0, 1);
        generator.writeRawValue(new char[] { '2'}, 0, 1);
        generator.writeEndArray();

        generator.flush();
        assertEquals("[1,2]", sw.toString());


        sw = new StringWriter();
        generator = new FilteringGeneratorDelegate(om.getFactory().createGenerator(sw), TokenFilter.INCLUDE_ALL, true, true);

        generator.writeStartArray();
        generator.writeRawValue(new char[] { '1'}, 0, 1);
        generator.writeRawValue(new char[] { '2'}, 0, 1);
        generator.writeEndArray();

        generator.flush();
        assertEquals("[1,2]", sw.toString()); // gives [12]

issue here



it happens in 2.9.10 but I check the 2.10 branch and it's there too.
The fix is pretty straightforward I'll submit a PR when I have time.

Regards, Arnaud

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions