Stream writer problem after upgrade yangtools to 4.0.2


Richard Kosegi
 

Hi yangtools devs,

after upgraded jsonrpc to use yangtools 4.0.2, following code no longer works as it used to:

NormalizedNode<?,?> data = ....
StringWriter writer = new StringWriter();
JsonWriter jsonWriter = JsonWriterFactory.createJsonWriter(writer);
NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.createExclusiveWriter(codecFactory, schemaPath,null,jsonWriter);
NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(jsonStream);
nodeWriter.write(data);
nodeWriter.flush();
String jsonValue = writer.toString()

jsonValue string is missing ending "}"

Is this bug or is there a way to force NormalizedNodeWriter to emit it?



Thanks,
Richard.


Richard Kosegi
 

On Tue, Nov 19, 2019 at 8:33 AM Richard Kosegi <richard.kosegi@...> wrote:
Hi yangtools devs,

after upgraded jsonrpc to use yangtools 4.0.2, following code no longer works as it used to:

NormalizedNode<?,?> data = ....
StringWriter writer = new StringWriter();
JsonWriter jsonWriter = JsonWriterFactory.createJsonWriter(writer);
NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.createExclusiveWriter(codecFactory, schemaPath,null,jsonWriter);
NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(jsonStream);
nodeWriter.write(data);
nodeWriter.flush();
String jsonValue = writer.toString()

jsonValue string is missing ending "}"

Is this bug or is there a way to force NormalizedNodeWriter to emit it?



Thanks,
Richard.