Skip to content

Commit d81a602

Browse files
committed
Correct aggregation issue with reported results
1 parent 7aa1b57 commit d81a602

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

jsonvalidator-common/src/main/java/eu/europa/ec/itb/json/validation/JSONValidator.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,19 @@ private ReportPair createReport(List<Message> messages) {
366366
report.getReports().getInfoOrWarningOrError().add(elementForReport);
367367
if (aggregateReportItems != null) {
368368
// Aggregate based on severity and message (without location prefix).
369-
aggregateReportItems.updateForReportItem(elementForReport, e -> String.format("%s|%s", elementForReport.getName().getLocalPart(), message.getDescription()));
369+
aggregateReportItems.updateForReportItem(elementForReport, e -> {
370+
var description = message.getDescription();
371+
if (description != null) {
372+
int positionStart = description.indexOf('[');
373+
if (positionStart == 0) {
374+
int positionEnd = description.indexOf("] ");
375+
if (positionEnd > positionStart) {
376+
description = description.substring(positionEnd+2);
377+
}
378+
}
379+
}
380+
return String.format("%s|%s", elementForReport.getName().getLocalPart(), description);
381+
});
370382
}
371383
}
372384
}

0 commit comments

Comments
 (0)