Skip to content

Commit 98c9115

Browse files
YianZhaoGMishx
authored andcommitted
fix(rest): avoid NPE in obligation Boolean filter
Signed-off-by: Alex <alextanzhao22@gmail.com>
1 parent 931b19f commit 98c9115

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/core/RestControllerHelper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,10 +549,10 @@ public void addEmbeddedLicenses(HalResource<Release> halComponent, Set<String> l
549549
}
550550

551551
public Set<String> getObligationIdsFromRequestWithValueTrue(Map<String, Boolean> reqBodyMaps) {
552-
Map<String, Boolean> obligationIdsRequest = reqBodyMaps.entrySet().stream()
553-
.filter(reqBodyMap-> reqBodyMap.getValue().equals(true))
554-
.collect(Collectors.toMap(reqBodyMap-> reqBodyMap.getKey(),reqBodyMap -> reqBodyMap.getValue()));
555-
return obligationIdsRequest.keySet();
552+
return reqBodyMaps.entrySet().stream()
553+
.filter(entry -> Boolean.TRUE.equals(entry.getValue()))
554+
.map(Map.Entry::getKey)
555+
.collect(Collectors.toSet());
556556
}
557557

558558
public boolean checkDuplicateLicense(List<License> licenses, String licenseId) {

0 commit comments

Comments
 (0)