Source:
public API getRevisionAPI(APIIdentifier identifier, APIRevision apiRevision) throws APIManagementException { String apiPath = APIUtil.getRevisionPath(apiRevision.getApiUUID(),apiRevision.getId()) + APIConstants.API_KEY; Registry registry; try { String apiTenantDomain = getTenantDomain(identifier); int apiTenantId = getTenantManager() .getTenantId(apiTenantDomain); if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(apiTenantDomain)) { APIUtil.loadTenantRegistry(apiTenantId); } if (this.tenantDomain == null || !this.tenantDomain.equals(apiTenantDomain)) { registry = getRegistryService().getGovernanceUserRegistry( getTenantAwareUsername(APIUtil.replaceEmailDomainBack(identifier.getProviderName())), apiTenantId); } else { registry = this.registry; } GenericArtifactManager artifactManager = getAPIGenericArtifactManagerFromUtil(registry, APIConstants.API_KEY); Resource apiResource = registry.get(apiPath); String artifactId = apiResource.getUUID(); if (artifactId == null) { throw new APIManagementException("artifact id is null for : " + apiPath); } GenericArtifact apiArtifact = artifactManager.getGenericArtifact(artifactId); API api = APIUtil.getAPIForPublishing(apiArtifact, registry); APIUtil.updateAPIProductDependencies(api, registry); if (APIConstants.API_GLOBAL_VISIBILITY.equals(api.getVisibility())) { return api; } if (this.tenantDomain == null || !this.tenantDomain.equals(apiTenantDomain)) { throw new APIManagementException("User " + username + " does not have permission to view API : " + api.getId().getApiName()); } return api; } catch (RegistryException e) { String msg = "Failed to get API from : " + apiPath; throw new APIManagementException(msg, e); } catch (org.wso2.carbon.user.api.UserStoreException e) { String msg = "Failed to get API from : " + apiPath; throw new APIManagementException(msg, e); } }

Target:
public API getRevisionAPI(APIIdentifier identifier, APIRevision apiRevision) throws APIManagementException { String apiPath = APIUtil.getRevisionPath(apiRevision.getApiUUID(),apiRevision.getId()) + APIConstants.API_KEY; Registry registry; try { String apiTenantDomain = getTenantDomain(identifier); int apiTenantId = getTenantManager() .getTenantId(apiTenantDomain); if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(apiTenantDomain)) { APIUtil.loadTenantRegistry(apiTenantId); } if (this.tenantDomain == null || !this.tenantDomain.equals(apiTenantDomain)) { registry = getRegistryService().getGovernanceUserRegistry( getTenantAwareUsername(APIUtil.replaceEmailDomainBack(identifier.getProviderName())), apiTenantId); } else { registry = this.registry; } GenericArtifactManager artifactManager = getAPIGenericArtifactManagerFromUtil(registry, APIConstants.API_KEY); Resource apiResource = registry.get(apiPath); String artifactId = apiResource.getUUID(); if (artifactId == null) { throw new APIManagementException("artifact id is null for : " + apiPath); } GenericArtifact apiArtifact = artifactManager.getGenericArtifact(artifactId); API api = APIUtil.getAPIForPublishing(apiArtifact, registry); APIUtil.updateAPIProductDependencies(api, registry); api.setSwaggerDefinition(getOpenAPIDefinition(identifier)); if (APIConstants.API_GLOBAL_VISIBILITY.equals(api.getVisibility())) { return api; } if (this.tenantDomain == null || !this.tenantDomain.equals(apiTenantDomain)) { throw new APIManagementException("User " + username + " does not have permission to view API : " + api.getId().getApiName()); } return api; } catch (RegistryException e) { String msg = "Failed to get API from : " + apiPath; throw new APIManagementException(msg, e); } catch (org.wso2.carbon.user.api.UserStoreException e) { String msg = "Failed to get API from : " + apiPath; throw new APIManagementException(msg, e); } }