Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FilteringGeneratorDelegate writeRawValue delegate to writeRaw instead of writeRawValue #580

Closed
arnaudroger opened this issue Nov 22, 2019 · 2 comments
Milestone

Comments

@arnaudroger
Copy link
Contributor

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

arnaudroger added a commit to arnaudroger/jackson-core that referenced this issue Nov 22, 2019
@arnaudroger arnaudroger mentioned this issue Nov 22, 2019
@cowtowncoder
Copy link
Member

Excellent, thank you for submitting this! I'll get it merged as soon as I find time (hopefully today)

cowtowncoder added a commit that referenced this issue Nov 22, 2019
cowtowncoder pushed a commit that referenced this issue Nov 22, 2019
@cowtowncoder
Copy link
Member

Fixed for 2.10.2 (and also in 2.9 branch, if 2.9.10.1 / 2.9.11 ever released).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants