@@ -44,7 +44,7 @@ This file is part of the iText (R) project.
44
44
package com .itextpdf .test .pdfa ;
45
45
46
46
import java .util .logging .Level ;
47
- import org . verapdf . component . Log ;
47
+ import java . util . stream . Collectors ;
48
48
import org .verapdf .component .LogsSummary ;
49
49
import org .verapdf .component .LogsSummaryImpl ;
50
50
import org .verapdf .core .VeraPDFException ;
@@ -103,14 +103,16 @@ public String validate(String filePath) {
103
103
errorMessage = "VeraPDF execution failed - specified file is encrypted. See report: " + xmlReportPath ;
104
104
} else if (summary .getValidationSummary ().getNonCompliantPdfaCount () != 0 ) {
105
105
errorMessage = "VeraPDF verification failed. See verification results: " + xmlReportPath ;
106
- } else if (logsSummary .getLogsCount () != 0 ) {
107
- errorMessage = "The following warnings and errors occurred while parsing current file:" ;
108
- for (Log log : logsSummary .getLogs ()) {
109
- errorMessage += "\n " + log .getLevel () + ": " + log .getMessage ();
110
- }
111
- errorMessage += "\n See verification results:" + xmlReportPath ;
112
106
} else {
113
107
System .out .println ("VeraPDF verification finished. See verification report: " + xmlReportPath );
108
+
109
+ if (logsSummary .getLogsCount () != 0 ) {
110
+ errorMessage = "The following warnings and errors were logged during validation:" ;
111
+ errorMessage += logsSummary .getLogs ().stream ()
112
+ .map (log -> "\n " + log .getLevel () + ": " + log .getMessage ())
113
+ .sorted ()
114
+ .collect (Collectors .joining ());
115
+ }
114
116
}
115
117
} catch (IOException | VeraPDFException exc ) {
116
118
errorMessage = "VeraPDF execution failed:\n " + exc .getMessage ();
0 commit comments