Pull request #211: RSS-292: Fixed incompatible comparision in getLongestBlockOrElse in scm

Merge in RED/redaction-report-service from RSS-292 to master

* commit '43566d07b2b0a398063ef676e6823ae3842438d3':
  RSS-292: Fixed incompatible comparision in getLongestBlockOrElse in scm
This commit is contained in:
Dominique Eiflaender 2022-12-12 14:28:31 +01:00
commit 57796c7941

View File

@ -594,16 +594,16 @@ public class RSSPoc2Service {
String transformation = String.format("Longest value of type '%s' if present or else '%s'", type, elseValue);
var firstEntryOptional = redactionLog.getRedactionLogEntry()
var entries = redactionLog.getRedactionLogEntry()
.stream()
.filter(r -> r.getType().equals(type))
.sorted(Comparator.comparing(s -> s.getValue().length()))
.sorted(Collections.reverseOrder())
.findFirst();
.collect(Collectors.toList());
if (firstEntryOptional.isPresent()) {
var firstEntry = firstEntryOptional.get();
if (!entries.isEmpty()) {
var firstEntry = entries.get(entries.size() - 1);
return SCMComponent.builder().originalValue(firstEntry.getValue()).scmAnnotations(List.of(toScmAnnotations(firstEntry))).transformation(transformation).build();
}