Skip to content

Commit

Permalink
Merge pull request #62 from jamezp/use-immutable-map
Browse files Browse the repository at this point in the history
Ensure an immutable map is returned for the getImmutableMapOrNull().
  • Loading branch information
jamezp authored Nov 9, 2023
2 parents 51d11ea + a8c2ab9 commit 7fbecf8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.jboss.logmanager.log4j;

import java.util.Collections;
import java.util.Map;

import org.apache.logging.log4j.spi.ThreadContextMap;
Expand Down Expand Up @@ -53,7 +54,7 @@ public Map<String, String> getCopy() {
@Override
public Map<String, String> getImmutableMapOrNull() {
final Map<String, String> copy = MDC.copy();
return copy.isEmpty() ? null : copy;
return copy.isEmpty() ? null : Collections.unmodifiableMap(copy);
}

@Override
Expand Down

0 comments on commit 7fbecf8

Please sign in to comment.