vy commented on code in PR #820:
URL: https://github.com/apache/logging-log4j2/pull/820#discussion_r851453305


##########
log4j-slf4j20-impl/src/main/java/org/apache/logging/slf4j/Log4jMDCAdapter.java:
##########
@@ -16,16 +16,87 @@
  */
 package org.apache.logging.slf4j;
 
+import java.util.ArrayDeque;
+import java.util.Deque;
 import java.util.Map;
+import java.util.Objects;
 
+import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.ThreadContext;
+import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.logging.log4j.util.Strings;
 import org.slf4j.spi.MDCAdapter;
 
 /**
  *
  */
 public class Log4jMDCAdapter implements MDCAdapter {
 
+    private static final Logger LOGGER = StatusLogger.getLogger();
+
+    private static final char QUOTE_CHAR = '\"';
+    private static final char ESCAPE_CHAR = '\\';
+    private static final char ARRAY_START = '[';
+    private static final char ARRAY_SEP = ',';
+    private static final char ARRAY_END = ']';
+    private static final String EMPTY_ARRAY = "[]";
+
+    /**
+     * Quotes a string using a simplified JSON quoting mechanism.
+     */
+    static void quoteString(final CharSequence value, final StringBuilder 
output) {
+        output.append(QUOTE_CHAR);
+        int i = 0;
+        while (i < value.length()) {
+            final char c = value.charAt(i);
+            switch (c) {
+                case ESCAPE_CHAR:
+                case QUOTE_CHAR:
+                    output.append(ESCAPE_CHAR);
+                    // intentional fall through
+                default:
+                    output.append(c);
+            }
+            i++;
+        }
+        output.append(QUOTE_CHAR);
+    }
+
+    /**
+     * Splits a valid and non empty JSON array into a head and tail part. 
Unicode
+     * escapes are not supported.
+     */
+    static void splitString(final char[] value, final String[] output) throws 
ArrayIndexOutOfBoundsException {

Review Comment:
   I think we have a misunderstanding. I had the idea that JSON reader/writer 
classes will be in the `-core` and `-slf4j20-impl` can very well depend on it. 
Why do you need them to be in `-api`?



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

Reply via email to