distinguish if a validation was done on XML or PDF
(cherry picked from commit cd7edc31e694fc49f1e16789c0e9795bce2c754d)
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
- log whether a XML or a PDF file was validated
|
||||||
|
|
||||||
2.4.0
|
2.4.0
|
||||||
=======
|
=======
|
||||||
2022-01-13
|
2022-01-13
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public class ZUGFeRDValidator {
|
|||||||
finalStringResult
|
finalStringResult
|
||||||
.append("<validation filename='" + context.getFilename() + "' datetime='" + isoDF.format(date) + "'>");
|
.append("<validation filename='" + context.getFilename() + "' datetime='" + isoDF.format(date) + "'>");
|
||||||
|
|
||||||
|
boolean isPDF=false;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (filename == null) {
|
if (filename == null) {
|
||||||
@@ -114,7 +115,7 @@ public class ZUGFeRDValidator {
|
|||||||
xv.disableNotices();
|
xv.disableNotices();
|
||||||
}
|
}
|
||||||
byte[] pdfSignature = { '%', 'P', 'D', 'F' };
|
byte[] pdfSignature = { '%', 'P', 'D', 'F' };
|
||||||
boolean isPDF = searcher.indexOf(file, pdfSignature) == 0;
|
isPDF = searcher.indexOf(file, pdfSignature) == 0;
|
||||||
if (isPDF) {
|
if (isPDF) {
|
||||||
pdfv.setFilename(filename);
|
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()
|
+ " Signature:" + Signature + " Checksum:" + sha1Checksum + " Profile:" + context.getProfile()
|
||||||
+ " Version:" + context.getGeneration() + " Took:" + duration + "ms Errors:["+context.getCSVResult()+"] "+toBeAppended);
|
+ " Version:" + context.getGeneration() + " Took:" + duration + "ms Errors:["+context.getCSVResult()+"] "+toBeAppended);
|
||||||
wasCompletelyValid = ((pdfValidity) && (xmlValidity));
|
wasCompletelyValid = ((pdfValidity) && (xmlValidity));
|
||||||
|
|||||||
Reference in New Issue
Block a user