vy commented on a change in pull request #444:
URL: https://github.com/apache/logging-log4j2/pull/444#discussion_r532469418



##########
File path: 
log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/util/JsonWriter.java
##########
@@ -572,6 +565,10 @@ public void writeString(
 
     }
 
+    public void writeAsString(Object object) {

Review comment:
       This public method allows one to call `jsonWriter.writeAsString("here I 
break the JSON: \"")`.
   1. I don't think this should be public. I would rather go with the old 
approach, where `ParameterizedMessage.deepToString()` was explicit. This method 
doesn't provide, IMHO, anything, except saving us to type a couple more 
characters.
   2. All public methods in `JsonWriter` have sufficient user input protection, 
e.g., null checks, quoting of literals; `writeAsString()` doesn't.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to