Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.

Commit 08ecbf5

Browse files
Merge pull request #188 from tatlax3636/npe-fix
Handle NPE in filteredForBap and filteredForASV for infra evaluator
2 parents 2444ab8 + ca0f17e commit 08ecbf5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<artifactId>api-audit</artifactId>
55
<packaging>jar</packaging>
66
<name>${project.groupId}:${project.artifactId}</name>
7-
<version>3.7.32-SNAPSHOT</version>
7+
<version>3.7.33-SNAPSHOT</version>
88
<description>Hygieia Audit Rest API Layer</description>
99
<url>https://github.com/Hygieia/${repository.name}</url>
1010

src/main/java/com/capitalone/dashboard/evaluator/InfrastructureEvaluator.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,22 @@ private InfrastructureAuditResponse getInfrastructureScanResponse(CollectorItem
7272
infrastructureAuditResponse.setLastUpdated(collectorItem.getLastUpdated());
7373

7474
List<InfrastructureScan> infrastructureScans = infrastructureScanRepository.findByCollectorItemIdAndTimestampIsBetweenOrderByTimestampDesc(collectorItem.getId(), beginDate - 1, endDate + 1);
75+
7576
List<InfrastructureScan> filteredForBAP = StringUtils.isEmpty(businessComponent) ? Collections.EMPTY_LIST :
76-
infrastructureScans.stream().filter(infrastructureScan -> infrastructureScan.getBusinessApplication().equalsIgnoreCase(businessComponent)).collect(Collectors.toList());
77+
infrastructureScans.stream().filter(infrastructureScan ->
78+
businessComponent.equalsIgnoreCase(infrastructureScan.getBusinessApplication())).collect(Collectors.toList()
79+
);
7780

7881
if (CollectionUtils.isNotEmpty(filteredForBAP)) {
7982
List<InfrastructureScan> sortedDistinctForBAP = getSortedAndDistinctByInstanceId(filteredForBAP);
8083
setInfraAudit(infrastructureAuditResponse, sortedDistinctForBAP, InfrastructureAuditStatus.INFRA_SCAN_BUSS_COMP_CRITICAL, InfrastructureAuditStatus.INFRA_SCAN_BUSS_COMP_HIGH, InfrastructureAuditStatus.INFRA_SCAN_BUSS_COMP_OK);
8184
infrastructureAuditResponse.setInfrastructureScans(sortedDistinctForBAP);
8285
} else {
8386
infrastructureAuditResponse.addAuditStatus(InfrastructureAuditStatus.INFRA_SEC_SCAN_BUSS_COMP_NOT_FOUND);
87+
8488
List<InfrastructureScan> filteredForASV = StringUtils.isEmpty(businessService) ? Collections.EMPTY_LIST :
85-
infrastructureScans.stream().filter(infrastructureScan -> infrastructureScan.getBusinessService().equalsIgnoreCase(businessService)).collect(Collectors.toList());
89+
infrastructureScans.stream().filter(infrastructureScan -> businessService.equalsIgnoreCase(infrastructureScan.getBusinessService())).collect(Collectors.toList());
90+
8691
if (CollectionUtils.isNotEmpty(filteredForASV)) {
8792
List<InfrastructureScan> sortedDistinctForASV = getSortedAndDistinctByInstanceId(filteredForASV);
8893
setInfraAudit(infrastructureAuditResponse, sortedDistinctForASV, InfrastructureAuditStatus.INFRA_SEC_SCAN_BUSS_APP_CRITICAL, InfrastructureAuditStatus.INFRA_SEC_SCAN_BUSS_APP_HIGH, InfrastructureAuditStatus.INFRA_SEC_SCAN_BUSS_APP_OK);

0 commit comments

Comments
 (0)