Skip to content

Commit

Permalink
Several flavours. Fix empty list of profiles case
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov committed Aug 2, 2024
1 parent 6458cb6 commit bd4f903
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ protected BaseValidator(final List<ValidationProfile> profiles, final int maxNum
}

private void createCompatibleValidators(List<ValidationProfile> profiles) {
if (profiles.isEmpty()) {
return;
}
PDFAFlavour flavour = profiles.get(0).getPDFAFlavour();
PDFAFlavour.PDFSpecification pdfSpecification = flavour.getPart().getPdfSpecification();
for (ValidationProfile profile : profiles) {
Expand All @@ -118,7 +121,7 @@ private void createCompatibleValidators(List<ValidationProfile> profiles) {

@Override
public ValidationProfile getProfile() {
return this.validators.get(0).getProfile();
return this.validators.isEmpty() ? null : this.validators.get(0).getProfile();
}

private List<PDFAFlavour> getFlavours() {
Expand All @@ -131,6 +134,9 @@ private List<PDFAFlavour> getFlavours() {

@Override
public ValidationResult validate(PDFAParser toValidate) throws ValidationException {
if (validators.isEmpty()) {
return null;
}
validators = Collections.singletonList(validators.get(0));
List<ValidationResult> validationResults = validateAll(toValidate);
return validationResults.get(0);
Expand Down

0 comments on commit bd4f903

Please sign in to comment.