From cd19e7a71020a29b9573acfea2ed56595069a6e3 Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Mon, 14 Dec 2020 11:36:53 +0530 Subject: [PATCH] Fix invalid url error message --- .../core/multitenancy/MultitenantMessageReceiver.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/multitenancy/MultitenantMessageReceiver.java b/core/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/multitenancy/MultitenantMessageReceiver.java index b6ed069e51a..596d0b4c621 100755 --- a/core/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/multitenancy/MultitenantMessageReceiver.java +++ b/core/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/multitenancy/MultitenantMessageReceiver.java @@ -210,7 +210,13 @@ private void processRequest(MessageContext mainInMsgContext) throws AxisFault { if (tenantDelimiterIndex != -1) { tenantDomain = MultitenantUtils.getTenantDomainFromUrl(to); - serviceAndOperation = to.substring(tenantDelimiterIndex + tenantDomain.length() + 4); + try { + serviceAndOperation = to.substring(tenantDelimiterIndex + tenantDomain.length() + 4); + } catch (StringIndexOutOfBoundsException ex) { + // Throw an AxisFault: Invalid URL + handleException(mainInMsgContext, new AxisFault("Invalid URL")); + return; + } } else { // in this case tenant detail is not with the url but user may have send it // with a soap header or an http header.