diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java index 63a3125be68d..75b65bf229fe 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java @@ -5595,7 +5595,12 @@ public int addAPI(API api, int tenantId, String organization) throws APIManageme public String getDefaultVersion(Identifier apiId) throws APIManagementException { try (Connection connection = APIMgtDBUtil.getConnection()) { - return getDefaultVersion(connection, (APIIdentifier) apiId); + if (apiId instanceof APIIdentifier) { + return getDefaultVersion(connection, (APIIdentifier) apiId); + } else if (apiId instanceof APIProductIdentifier) { + return getDefaultVersion(connection, (APIProductIdentifier) apiId); + } + return null; } catch (SQLException e) { handleException("Error while getting default version for " + apiId.getName(), e); }