Create an emptyMap when MDC.getCopyOfContextMap() is null (#5545)

This commit is contained in:
opticyclic 2019-10-03 06:48:47 -04:00 committed by Matthew Nesbit
parent 2965a21d2f
commit e0eb358d59
4 changed files with 4 additions and 4 deletions

View File

@ -83,7 +83,7 @@ class AMQPBridgeManager(config: MutualSslConfiguration,
}
private fun withMDC(block: () -> Unit) {
val oldMDC = MDC.getCopyOfContextMap()
val oldMDC = MDC.getCopyOfContextMap() ?: emptyMap<String, String>()
try {
MDC.put("queueName", queueName)
MDC.put("targets", targets.joinToString(separator = ";") { it.toString() })

View File

@ -46,7 +46,7 @@ internal class ConnectionStateMachine(private val serverMode: Boolean,
}
private fun withMDC(block: () -> Unit) {
val oldMDC = MDC.getCopyOfContextMap()
val oldMDC = MDC.getCopyOfContextMap() ?: emptyMap<String, String>()
try {
MDC.put("serverMode", serverMode.toString())
MDC.put("localLegalName", localLegalName)

View File

@ -41,7 +41,7 @@ internal class EventProcessor(channel: Channel,
}
private fun withMDC(block: () -> Unit) {
val oldMDC = MDC.getCopyOfContextMap()
val oldMDC = MDC.getCopyOfContextMap() ?: emptyMap<String, String>()
try {
MDC.put("serverMode", serverMode.toString())
MDC.put("localLegalName", localLegalName)

View File

@ -49,7 +49,7 @@ internal class AMQPChannelHandler(private val serverMode: Boolean,
private var badCert: Boolean = false
private fun withMDC(block: () -> Unit) {
val oldMDC = MDC.getCopyOfContextMap()
val oldMDC = MDC.getCopyOfContextMap() ?: emptyMap<String, String>()
try {
MDC.put("serverMode", serverMode.toString())
MDC.put("remoteAddress", remoteAddress.toString())