Skip to content

Weird NULL padding using ObjectMapper.writeValue(Writer dest, Object value) #4

@KowBlack

Description

@KowBlack

I have following code:

package boonbug;

import io.advantageous.boon.json.*;
import java.io.*;

public class BoonBug {
    public static void main(String[] args) throws IOException {
        FileWriter pw = new FileWriter("test");
        JsonFactory.create().writeValue(pw, "blah-blah");
        pw.close();
    }   
}

It produces the test file that has "blah-blah" padded with NULLs. So the file size is 4kb.
This becomes problematic when I use it in a servlet returning JSON, Chrome/FF don't like it and report JSON parsing error.
Is it a bug? Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions