From 7c673c070787b78c7178e7efd1274f7978cefc8d Mon Sep 17 00:00:00 2001 From: Savindu Dimal Date: Tue, 23 Jan 2024 12:11:31 +0530 Subject: [PATCH] Fix NPE in API log handler --- .../carbon/apimgt/gateway/handlers/logging/APILogHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/logging/APILogHandler.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/logging/APILogHandler.java index 3e7a1dd7c0e6..945a5fd55ba2 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/logging/APILogHandler.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/logging/APILogHandler.java @@ -81,7 +81,8 @@ public static void logAPI(String flow, MessageContext messageContext) { // Get API details and set custom properties to ThreadContext String path = ApiUtils.getFullRequestPath(messageContext); - TreeMap selectedApis = Utils.getSelectedAPIList(path, GatewayUtils.getTenantDomain()); + TreeMap selectedApis = Utils.getSelectedAPIList(path, + (String) messageContext.getProperty(APIConstants.TENANT_DOMAIN_INFO_PROPERTY)); if (selectedApis.size() > 0) { String selectedPath = selectedApis.firstKey(); API selectedApi = selectedApis.get(selectedPath);