From 787673e28977e91bb3aa8b726e24896900f7be44 Mon Sep 17 00:00:00 2001 From: rusirijayodaillesinghe Date: Sun, 24 Nov 2024 23:10:05 +0530 Subject: [PATCH] Fix issues related to unit test failures --- .../indexing/service/ContentBasedSearchService.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/service/ContentBasedSearchService.java b/components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/service/ContentBasedSearchService.java index fd3cd2f20..4fc3398f2 100755 --- a/components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/service/ContentBasedSearchService.java +++ b/components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/service/ContentBasedSearchService.java @@ -180,11 +180,14 @@ private SearchResultsBean searchContentInternal(String searchQuery, Map filteredResults = new ArrayList(); - // check the authorization again for the filtered results - for (SolrDocument solrDocument : results) { - String path = getPathFromId((String) solrDocument.getFirstValue("id")); - if ((isAuthorized(registry, path, ActionConstants.GET)) && (registry.resourceExists(path))) { - filteredResults.add(loadResourceByPath(registry, path)); + + if (results != null) { + // check the authorization again for the filtered results + for (SolrDocument solrDocument : results) { + String path = getPathFromId((String) solrDocument.getFirstValue("id")); + if ((isAuthorized(registry, path, ActionConstants.GET)) && (registry.resourceExists(path))) { + filteredResults.add(loadResourceByPath(registry, path)); + } } }