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


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/jackson/Initializers.java:
##########
@@ -62,33 +65,43 @@ void setupModule(
                             : ThrowableProxyWithoutStacktraceMixIn.class);
         }
     }
+    /**
+     * Used to set up {@link SetupContext} from different {@link 
SimpleModule}s.
+     * <p>
+     *     Serializes the context map as list of objects.
+     * </p>
+     */
+    static class SetupContextAsEntryListInitializer extends 
AbstractInitializer {
+
+        @Override
+        void setupModule(
+                final SetupContext context, final boolean includeStacktrace, 
final boolean stacktraceAsString) {
+            super.setupModule(context, includeStacktrace, stacktraceAsString);
+            // Prevents reflective JPMS access
+            // https://github.com/apache/logging-log4j2/issues/2814
+            context.addSerializers(new SimpleSerializers(singletonList(new 
ContextDataAsEntryListSerializer())));
+            context.addDeserializers(
+                    new SimpleDeserializers(singletonMap(StringMap.class, new 
ContextDataAsEntryListDeserializer())));

Review Comment:
   Why don't we need the same for, say, `Log4jStackTraceElementDeserializer`?



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