-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1060 from RomaPrograms/overflow-memory-todo
Fixed issue: #905.
- Loading branch information
Showing
8 changed files
with
58 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,8 +35,8 @@ | |
import javax.xml.bind.annotation.XmlRootElement; | ||
import javax.xml.bind.annotation.adapters.XmlAdapter; | ||
import java.util.Collections; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
import java.util.List; | ||
import java.util.ArrayList; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Carl Wilson</a> | ||
|
@@ -52,27 +52,27 @@ final class ValidationResultImpl implements ValidationResult { | |
private final int totalAssertions; | ||
@XmlElementWrapper | ||
@XmlElement(name = "assertion") | ||
private final Set<TestAssertion> assertions; | ||
private final List<TestAssertion> assertions; | ||
@XmlAttribute | ||
private final boolean isCompliant; | ||
|
||
private final ValidationProfile validationProfile; | ||
|
||
private ValidationResultImpl() { | ||
this(Profiles.defaultProfile(), Collections.<TestAssertion>emptySet(), | ||
this(Profiles.defaultProfile(), Collections.<TestAssertion>emptyList(), | ||
false); | ||
} | ||
|
||
private ValidationResultImpl(final ValidationProfile validationProfile, | ||
final Set<TestAssertion> assertions, final boolean isCompliant) { | ||
final List<TestAssertion> assertions, final boolean isCompliant) { | ||
this(validationProfile, assertions, isCompliant, assertions.size()); | ||
} | ||
|
||
private ValidationResultImpl(final ValidationProfile validationProfile, | ||
final Set<TestAssertion> assertions, final boolean isCompliant, int totalAssertions) { | ||
final List<TestAssertion> assertions, final boolean isCompliant, int totalAssertions) { | ||
super(); | ||
this.flavour = validationProfile.getPDFAFlavour(); | ||
this.assertions = new HashSet<>(assertions); | ||
this.assertions = new ArrayList<>(assertions); | ||
this.isCompliant = isCompliant; | ||
this.totalAssertions = totalAssertions; | ||
this.profileDetails = validationProfile.getDetails(); | ||
|
@@ -115,8 +115,8 @@ public int getTotalAssertions() { | |
* { @inheritDoc } | ||
*/ | ||
@Override | ||
public Set<TestAssertion> getTestAssertions() { | ||
return Collections.unmodifiableSet(this.assertions); | ||
public List<TestAssertion> getTestAssertions() { | ||
return Collections.unmodifiableList(this.assertions); | ||
} | ||
|
||
/** | ||
|
@@ -183,18 +183,18 @@ static ValidationResultImpl defaultInstance() { | |
} | ||
|
||
static ValidationResultImpl fromValues(final ValidationProfile validationProfile, | ||
final Set<TestAssertion> assertions, final boolean isCompliant, final int totalChecks) { | ||
final List<TestAssertion> assertions, final boolean isCompliant, final int totalChecks) { | ||
return new ValidationResultImpl(validationProfile, assertions, isCompliant, totalChecks); | ||
} | ||
|
||
static ValidationResultImpl fromValidationResult(ValidationResult toConvert) { | ||
Set<TestAssertion> assertions = toConvert.getTestAssertions(); | ||
List<TestAssertion> assertions = toConvert.getTestAssertions(); | ||
return fromValues(toConvert.getValidationProfile(), assertions, | ||
toConvert.isCompliant(), toConvert.getTotalAssertions()); | ||
} | ||
|
||
static ValidationResultImpl stripPassedTests(ValidationResult toStrip) { | ||
Set<TestAssertion> assertions = toStrip.getTestAssertions(); | ||
List<TestAssertion> assertions = toStrip.getTestAssertions(); | ||
return fromValues(toStrip.getValidationProfile(), stripPassedTests(assertions), | ||
toStrip.isCompliant(), toStrip.getTotalAssertions()); | ||
} | ||
|
@@ -211,12 +211,12 @@ public ValidationResultImpl marshal(ValidationResult validationResult) { | |
} | ||
} | ||
|
||
static Set<TestAssertion> stripPassedTests(final Set<TestAssertion> toStrip) { | ||
Set<TestAssertion> strippedSet = new HashSet<>(); | ||
static List<TestAssertion> stripPassedTests(final List<TestAssertion> toStrip) { | ||
List<TestAssertion> strippedList = new ArrayList<>(); | ||
for (TestAssertion test : toStrip) { | ||
if (test.getStatus() != Status.PASSED) | ||
strippedSet.add(test); | ||
strippedList.add(test); | ||
} | ||
return strippedSet; | ||
return strippedList; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
import org.verapdf.pdfa.validation.profiles.ValidationProfile; | ||
|
||
import javax.xml.bind.JAXBException; | ||
import java.util.Set; | ||
import java.util.List; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Carl Wilson</a> | ||
|
@@ -54,7 +54,7 @@ private ValidationResults() { | |
* compliant with the indicated flavour | ||
* @return a new ValidationResult instance populated from the values | ||
*/ | ||
public static ValidationResult resultFromValues(final ValidationProfile validationProfile, final Set<TestAssertion> assertions, | ||
public static ValidationResult resultFromValues(final ValidationProfile validationProfile, final List<TestAssertion> assertions, | ||
final boolean isCompliant) { | ||
if (validationProfile == null) | ||
throw new NullPointerException(VALIDATION_PROFILE_NOT_NULL_MESSAGE); | ||
|
@@ -75,7 +75,7 @@ public static ValidationResult resultFromValues(final ValidationProfile validati | |
* @param totalAssertions | ||
* @return a new ValidationResult instance populated from the values | ||
*/ | ||
public static ValidationResult resultFromValues(final ValidationProfile validationProfile, final Set<TestAssertion> assertions, | ||
public static ValidationResult resultFromValues(final ValidationProfile validationProfile, final List<TestAssertion> assertions, | ||
final boolean isCompliant, final int totalAssertions) { | ||
if (validationProfile == null) | ||
throw new NullPointerException(VALIDATION_PROFILE_NOT_NULL_MESSAGE); | ||
|
@@ -92,7 +92,7 @@ public static ValidationResult resultFromValues(final ValidationProfile validati | |
* the Set of TestAssertions reported by during validation | ||
* @return a new ValidationResult instance populated from the values | ||
*/ | ||
public static ValidationResult resultFromValues(final ValidationProfile validationProfile, final Set<TestAssertion> assertions) { | ||
public static ValidationResult resultFromValues(final ValidationProfile validationProfile, final List<TestAssertion> assertions) { | ||
if (validationProfile == null) | ||
throw new NullPointerException(VALIDATION_PROFILE_NOT_NULL_MESSAGE); | ||
if (assertions == null) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,9 +32,7 @@ | |
import javax.xml.bind.annotation.XmlAttribute; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.adapters.XmlAdapter; | ||
import java.util.Collections; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
import java.util.*; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Carl Wilson</a> | ||
|
@@ -62,10 +60,10 @@ final class RuleSummaryImpl implements RuleSummary { | |
@XmlElement | ||
private final String test; | ||
@XmlElement(name = "check") | ||
private final Set<Check> checks; | ||
private final List<Check> checks; | ||
|
||
private RuleSummaryImpl(final RuleId ruleId, final Status status, final int passedChecks, final int failedChecks, | ||
final String description, final String object, final String test, final Set<Check> checks) { | ||
final String description, final String object, final String test, final List<Check> checks) { | ||
PDFAFlavour.Specification specification = ruleId.getSpecification(); | ||
this.specification = specification == null ? null : specification.getId(); | ||
this.clause = ruleId.getClause(); | ||
|
@@ -77,12 +75,12 @@ private RuleSummaryImpl(final RuleId ruleId, final Status status, final int pass | |
this.description = description; | ||
this.object = object; | ||
this.test = test; | ||
this.checks = ((checks != null) && !checks.isEmpty()) ? new HashSet<>(checks) : null; | ||
this.checks = ((checks != null) && !checks.isEmpty()) ? new ArrayList<>(checks) : null; | ||
} | ||
|
||
private RuleSummaryImpl(final RuleId ruleId, final Status status, final String description, final String object, | ||
final String test) { | ||
this(ruleId, status, 0, 0, description, object, test, Collections.<Check>emptySet()); | ||
this(ruleId, status, 0, 0, description, object, test, Collections.<Check>emptyList()); | ||
} | ||
|
||
private RuleSummaryImpl() { | ||
|
@@ -174,7 +172,7 @@ public String getTest() { | |
* @return the checks | ||
*/ | ||
@Override | ||
public Set<Check> getChecks() { | ||
public List<Check> getChecks() { | ||
return this.checks; | ||
} | ||
|
||
|
@@ -191,7 +189,7 @@ public RuleSummaryImpl marshal(RuleSummary summary) { | |
} | ||
|
||
static final RuleSummary fromValues(final RuleId id, final String description, final String object, final String test, | ||
Set<TestAssertion> assertions, boolean logPassedChecks, int maxNumberOfDisplayedFailedChecks) { | ||
List<TestAssertion> assertions, boolean logPassedChecks, int maxNumberOfDisplayedFailedChecks) { | ||
if (id == null) { | ||
throw new NullPointerException("Argument id can not be null"); | ||
} | ||
|
@@ -201,7 +199,7 @@ static final RuleSummary fromValues(final RuleId id, final String description, f | |
if (assertions == null) { | ||
throw new NullPointerException("Argument assertions can not be null"); | ||
} | ||
Set<Check> checks = new HashSet<>(); | ||
List<Check> checks = new ArrayList<>(); | ||
Status status = Status.PASSED; | ||
int passedChecks = 0; | ||
int failedChecks = 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters