Skip to content

Commit a8c2ab9

Browse files
committed
Ensure an immutable map is returned for the getImmutableMapOrNull().
Signed-off-by: James R. Perkins <[email protected]>
1 parent 51d11ea commit a8c2ab9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/jboss/logmanager/log4j/ThreadContextMDCMap.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.jboss.logmanager.log4j;
2121

22+
import java.util.Collections;
2223
import java.util.Map;
2324

2425
import org.apache.logging.log4j.spi.ThreadContextMap;
@@ -53,7 +54,7 @@ public Map<String, String> getCopy() {
5354
@Override
5455
public Map<String, String> getImmutableMapOrNull() {
5556
final Map<String, String> copy = MDC.copy();
56-
return copy.isEmpty() ? null : copy;
57+
return copy.isEmpty() ? null : Collections.unmodifiableMap(copy);
5758
}
5859

5960
@Override

0 commit comments

Comments
 (0)