Skip to content

Commit

Permalink
Merge pull request #1388 from veraPDF/pretty_print_json
Browse files Browse the repository at this point in the history
Pretty print JSON report
  • Loading branch information
MaximPlusov authored Nov 23, 2023
2 parents dcd5336 + c853bb6 commit 226f137
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final class ErrorArgumentImpl implements ErrorArgument {
private final String argumentValue;

private ErrorArgumentImpl() {
this("argument", "", null);
this("argument", null, null);
}

private ErrorArgumentImpl(final String argument, final String name, final String argumentValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static ValidationProfile profileFromValues(final PDFAFlavour flavour, fin
* description or creator are empty.
*/
public static ValidationProfile profileFromSortedValues(final PDFAFlavour flavour, final ProfileDetails details,
final String hash, final SortedSet<Rule> rules, final Set<Variable> variables) {
final String hash, final SortedSet<Rule> rules, final SortedSet<Variable> variables) {
if (flavour == null)
throw new IllegalArgumentException("Parameter flavour can not be null.");
if (details == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public String getTags() {

@Override
public Set<String> getTagsSet() {
return tags != null ? new HashSet<>(Arrays.asList(tags.split(","))) : Collections.emptySet();
return tags != null ? new LinkedHashSet<>(Arrays.asList(tags.split(","))) : Collections.emptySet();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ private ValidationProfileImpl(final PDFAFlavour flavour,

private ValidationProfileImpl(final PDFAFlavour flavour,
final ProfileDetails details, final String hash,
final SortedSet<Rule> rules, final Set<Variable> variables) {
final SortedSet<Rule> rules, final SortedSet<Variable> variables) {
super();
this.flavour = flavour;
this.details = details;
this.hash = hash;
this.rules = rules;
this.variables = new HashSet<>(variables);
this.variables = variables;
}

/**
Expand Down Expand Up @@ -132,8 +132,7 @@ public Set<Rule> getRulesByObject(final String objectName) {
this.objectRuleMap = createObjectRuleMap(this.rules);
}
Set<Rule> objRules = this.objectRuleMap.get(objectName);
return (objRules == null) ? Collections.<Rule> emptySet() : Collections
.unmodifiableSet(objRules);
return objRules == null ? Collections.<Rule> emptySet() : Collections.unmodifiableSet(objRules);
}

/**
Expand All @@ -145,8 +144,7 @@ public Set<Variable> getVariablesByObject(String objectName) {
this.objectVariableMap = createObjectVariableMap(this.variables);
}
Set<Variable> objRules = this.objectVariableMap.get(objectName);
return (objRules == null) ? Collections.<Variable> emptySet() : Collections
.unmodifiableSet(objRules);
return objRules == null ? Collections.<Variable> emptySet() : Collections.unmodifiableSet(objRules);
}

/**
Expand Down Expand Up @@ -249,7 +247,7 @@ static ValidationProfile fromValues(final PDFAFlavour flavour,

static ValidationProfile fromSortedValues(final PDFAFlavour flavour,
final ProfileDetails details, final String hash,
final SortedSet<Rule> rules, final Set<Variable> variables) {
final SortedSet<Rule> rules, final SortedSet<Variable> variables) {
return new ValidationProfileImpl(flavour, details, hash, rules,
variables);
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/org/verapdf/processor/JsonHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.verapdf.ReleaseDetails;
import org.verapdf.component.AuditDuration;
Expand Down Expand Up @@ -49,7 +50,7 @@ public class JsonHandler extends AbstractBatchHandler {

protected JsonHandler(Writer writer, boolean logPassed) {
this.writer = writer;
this.objectMapper = new ObjectMapper();
this.objectMapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
this.logPassed = logPassed;
SimpleModule module = new SimpleModule("FeaturesNodeSerializer", new Version(2, 1,
3, null, null, null));
Expand Down

0 comments on commit 226f137

Please sign in to comment.