log error ids
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
? log error IDs
|
? log error IDs
|
||||||
- closes #579
|
- closes #579
|
||||||
- #581
|
- #581
|
||||||
|
- log error ids
|
||||||
|
|
||||||
2.15.0
|
2.15.0
|
||||||
=======
|
=======
|
||||||
|
|||||||
@@ -135,6 +135,22 @@ public class ValidationContext {
|
|||||||
return String.join(",", errorcodes);
|
return String.join(",", errorcodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @return the unique error IDs as comma separated string
|
||||||
|
*/
|
||||||
|
public String getCSVIDResult() {
|
||||||
|
final ArrayList<String> errorIDs = new ArrayList<>();
|
||||||
|
for (final ValidationResultItem validationResultItem : results) {
|
||||||
|
if (!validationResultItem.getID().isEmpty()) {
|
||||||
|
final String errorID=validationResultItem.getID();
|
||||||
|
errorIDs.add(errorID);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return String.join(",", errorIDs);
|
||||||
|
}
|
||||||
|
|
||||||
public void setInvalid() {
|
public void setInvalid() {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public class ValidationResultItem {
|
|||||||
|
|
||||||
protected String message, location=null;
|
protected String message, location=null;
|
||||||
protected int section =-1;
|
protected int section =-1;
|
||||||
|
protected String id =""; // e.g. "FX-SCH-A-000026"
|
||||||
|
|
||||||
|
|
||||||
private ESeverity severity=ESeverity.error;
|
private ESeverity severity=ESeverity.error;
|
||||||
@@ -103,6 +104,15 @@ public class ValidationResultItem {
|
|||||||
return severity;
|
return severity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ValidationResultItem setID(String id) {
|
||||||
|
this.id=id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
public int getSection() {
|
public int getSection() {
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -453,6 +453,7 @@ public class XMLValidator extends Validator {
|
|||||||
|
|
||||||
String thisFailText = "";
|
String thisFailText = "";
|
||||||
String thisFailID = "";
|
String thisFailID = "";
|
||||||
|
String thisFailIDStr = "";
|
||||||
String thisFailTest = "";
|
String thisFailTest = "";
|
||||||
String thisFailLocation = "";
|
String thisFailLocation = "";
|
||||||
if (failedAsserts.getLength() > 0) {
|
if (failedAsserts.getLength() > 0) {
|
||||||
@@ -461,7 +462,8 @@ public class XMLValidator extends Validator {
|
|||||||
//nodes.item(i).getTextContent())) {
|
//nodes.item(i).getTextContent())) {
|
||||||
Node currentFailNode = failedAsserts.item(nodeIndex);
|
Node currentFailNode = failedAsserts.item(nodeIndex);
|
||||||
if (currentFailNode.getAttributes().getNamedItem("id") != null) {
|
if (currentFailNode.getAttributes().getNamedItem("id") != null) {
|
||||||
thisFailID = " [ID " + currentFailNode.getAttributes().getNamedItem("id").getNodeValue() + "]";
|
thisFailID = currentFailNode.getAttributes().getNamedItem("id").getNodeValue();
|
||||||
|
thisFailIDStr = " [ID " + thisFailID + "]";
|
||||||
}
|
}
|
||||||
if (currentFailNode.getAttributes().getNamedItem("test") != null) {
|
if (currentFailNode.getAttributes().getNamedItem("test") != null) {
|
||||||
thisFailTest = currentFailNode.getAttributes().getNamedItem("test").getNodeValue();
|
thisFailTest = currentFailNode.getAttributes().getNamedItem("test").getNodeValue();
|
||||||
@@ -494,8 +496,8 @@ public class XMLValidator extends Validator {
|
|||||||
|
|
||||||
LOGGER.info("FailedAssert ", thisFailText);
|
LOGGER.info("FailedAssert ", thisFailText);
|
||||||
|
|
||||||
context.addResultItem(new ValidationResultItem(severity, thisFailText + thisFailID + " from " + xsltFilename + ")")
|
context.addResultItem(new ValidationResultItem(severity, thisFailText + thisFailIDStr + " from " + xsltFilename + ")")
|
||||||
.setLocation(thisFailLocation).setCriterion(thisFailTest).setSection(section)
|
.setLocation(thisFailLocation).setCriterion(thisFailTest).setSection(section).setID(thisFailID)
|
||||||
.setPart(EPart.fx));
|
.setPart(EPart.fx));
|
||||||
failedRules++;
|
failedRules++;
|
||||||
|
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ public class ZUGFeRDValidator {
|
|||||||
LOGGER.info("Parsed PDF:" + pdfResult + " 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()
|
+ " Version:" + context.getGeneration() + " Took:" + duration + "ms Errors:[" + context.getCSVResult()
|
||||||
+ "] " + toBeAppended);
|
+ "] ErrorIDs: [" + context.getCSVIDResult() + "]" + toBeAppended);
|
||||||
wasCompletelyValid = ((pdfValidity) && (xmlValidity));
|
wasCompletelyValid = ((pdfValidity) && (xmlValidity));
|
||||||
return sw.toString();
|
return sw.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user