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.