orpiske commented on code in PR #15515:
URL: https://github.com/apache/camel/pull/15515#discussion_r1754537195
##########
components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java:
##########
@@ -157,7 +158,11 @@ public void marshal(Exchange exchange, Object graph,
OutputStream stream) throws
if (this.schemaResolver != null) {
schema = this.schemaResolver.resolve(exchange);
}
-
this.objectMapper.writerWithView(jsonView).with(schema).writeValue(stream,
graph);
+ // using OutputStreamWriter because of Jackson not handling 4-byte
characters properly with only a stream
+ // https://github.com/FasterXML/jackson-core/issues/223
+ OutputStreamWriter writer = new OutputStreamWriter(stream);
+
this.objectMapper.writerWithView(jsonView).with(schema).writeValue(writer,
graph);
+ writer.close();
Review Comment:
Use try-with-resources here. It's cleaner.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]