distinguish if a validation was done on XML or PDF

(cherry picked from commit cd7edc31e694fc49f1e16789c0e9795bce2c754d)
This commit is contained in:
jstaerk
2022-01-27 08:51:02 +01:00
parent f255e5b864
commit 3f80c1daaf
2 changed files with 12 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
- log whether a XML or a PDF file was validated
2.4.0
=======
2022-01-13

View File

@@ -90,6 +90,7 @@ public class ZUGFeRDValidator {
finalStringResult
.append("<validation filename='" + context.getFilename() + "' datetime='" + isoDF.format(date) + "'>");
boolean isPDF=false;
try {
if (filename == null) {
@@ -114,7 +115,7 @@ public class ZUGFeRDValidator {
xv.disableNotices();
}
byte[] pdfSignature = { '%', 'P', 'D', 'F' };
boolean isPDF = searcher.indexOf(file, pdfSignature) == 0;
isPDF = searcher.indexOf(file, pdfSignature) == 0;
if (isPDF) {
pdfv.setFilename(filename);
@@ -250,8 +251,15 @@ public class ZUGFeRDValidator {
}
String pdfResult="invalid";
if (!isPDF) {
pdfResult="absent";
} else if (pdfValidity) {
pdfResult="valid";
}
LOGGER.info("Parsed PDF:" + (pdfValidity ? "valid" : "invalid") + " XML:" + (xmlValidity ? "valid" : "invalid")
LOGGER.info("Parsed PDF:" + pdfResult + " XML:" + (xmlValidity ? "valid" : "invalid")
+ " Signature:" + Signature + " Checksum:" + sha1Checksum + " Profile:" + context.getProfile()
+ " Version:" + context.getGeneration() + " Took:" + duration + "ms Errors:["+context.getCSVResult()+"] "+toBeAppended);
wasCompletelyValid = ((pdfValidity) && (xmlValidity));