fix: Remove first tab character and replace any others with spaces.
@@ -19,6 +19,8 @@ import java.util.Set;
import java.util.SortedMap;
import java.util.stream.Collectors;
+import org.codehaus.plexus.util.StringUtils;
+
import com.synopsys.integration.common.util.Bds;
import com.synopsys.integration.detect.configuration.DetectInfo;
import com.synopsys.integration.detect.tool.detector.DetectorToolResult;
@@ -63,7 +65,7 @@ public class FormattedOutputManager {
formattedOutput.detectVersion = detectInfo.getDetectVersion();
formattedOutput.results = Bds.of(detectResults)
- .map(result -> new FormattedResultOutput(result.getResultLocation(), result.getResultMessage(), result.getResultSubMessages()))
+ .map(result -> new FormattedResultOutput(result.getResultLocation(), result.getResultMessage(), removeTabsFromMessages(result.getResultSubMessages())))
.toList();
formattedOutput.status = Bds.of(statusSummaries)
@@ -102,6 +104,17 @@ public class FormattedOutputManager {
return formattedOutput;
}
+ private List<String> removeTabsFromMessages(List<String> messages) {
+ if (messages.isEmpty()) {
+ return messages;
+ }
+ return messages.stream()
+ .filter(StringUtils::isNotBlank)
+ .map(message -> StringUtils.replaceOnce(message, "\t", ""))
+ .map(message -> StringUtils.replace(message, "\t", " "))
+ .collect(Collectors.toList());
+ }
+
private FormattedDetectorOutput convertDetector(DetectorEvaluation evaluation) {
FormattedDetectorOutput detectorOutput = new FormattedDetectorOutput();
detectorOutput.folder = evaluation.getDetectableEnvironment().getDirectory().toString();
