Fixing ESBJAVA-2397 patch by NufailM

git-svn-id: https://svn.wso2.org/repos/wso2/carbon/kernel/trunk@186760 a5903396-d722-0410-b921-86c7d4935375
Applied patch provided by Eranga to REGISTRY-1852

git-svn-id: https://svn.wso2.org/repos/wso2/carbon/kernel/trunk@186761 a5903396-d722-0410-b921-86c7d4935375