Skip to content

Commit

Permalink
issue #126: Skip records without errors from issue-details.csv
Browse files Browse the repository at this point in the history
  • Loading branch information
pkiraly committed Jan 31, 2022
1 parent b634de4 commit e46b319
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/main/java/de/gwdg/metadataqa/marc/cli/Validator.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,22 +195,24 @@ public void processRecord(MarcRecord marcRecord, int i) {
}

private void processDetails(MarcRecord marcRecord) {
if (parameters.doSummary()) {
Map<Integer, Integer> errorIds = new HashMap<>();
for (ValidationError error : marcRecord.getValidationErrors()) {
if (error.getId() == null)
error.setId(hashedIndex.get(error.hashCode()));
count(error.getId(), errorIds);
List<ValidationError> errors = marcRecord.getValidationErrors();
if (!errors.isEmpty()) {
String message = null;
if (parameters.doSummary()) {
Map<Integer, Integer> errorIds = new HashMap<>();
for (ValidationError error : errors) {
if (error.getId() == null)
error.setId(hashedIndex.get(error.hashCode()));
count(error.getId(), errorIds);
}
message = ValidationErrorFormatter.formatSimple(
marcRecord.getId(parameters.getTrimId()), parameters.getFormat(), errorIds
);
} else {
message = ValidationErrorFormatter.format(errors, parameters.getFormat(), parameters.getTrimId());
}
String message = ValidationErrorFormatter.formatSimple(
marcRecord.getId(parameters.getTrimId()), parameters.getFormat(), errorIds
);
print(detailsFile, message);
} else {
String message = ValidationErrorFormatter.format(
marcRecord.getValidationErrors(), parameters.getFormat(), parameters.getTrimId()
);
print(detailsFile, message);
if (message != null)
print(detailsFile, message);
}
}

Expand Down

0 comments on commit e46b319

Please sign in to comment.