Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validation-model 1.11.24 - erroneous compliance result #962

Closed
B748 opened this issue Apr 26, 2018 · 1 comment
Closed

validation-model 1.11.24 - erroneous compliance result #962

B748 opened this issue Apr 26, 2018 · 1 comment
Assignees

Comments

@B748
Copy link

B748 commented Apr 26, 2018

Using test-files from #958 I got correct results when using the published 1.10.3 core & 1.10.5 validation-model artifacts.

However, using the latest 1.11.6 core & 1.11.24 validation-model previously correct designated files fail.

Full code:

public static void main(String[] args) {
        verifyPDFFileWithFlavour(new File("test.pdf"), PDFAFlavour.NO_FLAVOUR);
        verifyPDFFileWithFlavour(new File("test.1a.pdf"), PDFAFlavour.PDFA_1_A);
        verifyPDFFileWithFlavour(new File("test.1b.pdf"), PDFAFlavour.PDFA_1_B);
        verifyPDFFileWithFlavour(new File("test.2a.pdf"), PDFAFlavour.PDFA_2_A);
        verifyPDFFileWithFlavour(new File("test.2b.pdf"), PDFAFlavour.PDFA_2_B);
        verifyPDFFileWithFlavour(new File("test.2u.pdf"), PDFAFlavour.PDFA_2_U);
        verifyPDFFileWithFlavour(new File("test.3a.pdf"), PDFAFlavour.PDFA_3_A);
        verifyPDFFileWithFlavour(new File("test.3b.pdf"), PDFAFlavour.PDFA_3_B);
        verifyPDFFileWithFlavour(new File("test.3u.pdf"), PDFAFlavour.PDFA_3_U);
        System.out.println("DONE");
}

private static String verifyPDFFileWithFlavour(File file, PDFAFlavour flavour) {
    VeraGreenfieldFoundryProvider.initialise();

    System.out.println("> " + file.getName());

    try (PDFAParser parser = Foundries.defaultInstance().createParser(file, flavour)) {
        PDFAValidator validator = Foundries.defaultInstance().createValidator(parser.getFlavour(), false);

        ValidationResult result = validator.validate(parser);

        System.out.println("  Parser flavour: '" + parser.getFlavour() + "'");
        validator.close();

        if (result.isCompliant()) {
            System.out.println("  >> compliant <<");
            return "PDF/A-" + result.getPDFAFlavour().getId();
        } else {
            for (TestAssertion t : result.getTestAssertions()) {
                System.out.println("  --> " + t.getMessage());
            }
        }

        System.out.println("  !! not compliant !!");

    } catch (IOException | ModelParsingException | EncryptedPdfException e) {
        e.printStackTrace();
    } catch (ValidationException e) {
        e.printStackTrace();
    } catch (NoSuchElementException e) {
        System.out.println("  ** NoSuchElementException **");
        return "PDF";
    }

    return "PDF";
}

1.10.3 / 1.10.5 artifacts result:

> test.pdf
  ** NoSuchElementException **
> test.1a.pdf
  Parser flavour: '1a'
  >> compliant <<
> test.1b.pdf
  Parser flavour: '1b'
  >> compliant <<
> test.2a.pdf
  Parser flavour: '2a'
  >> compliant <<
> test.2b.pdf
  Parser flavour: '2b'
  >> compliant <<
> test.2u.pdf
  Parser flavour: '2u'
  >> compliant <<
> test.3a.pdf
  Parser flavour: '3a'
  >> compliant <<
> test.3b.pdf
  Parser flavour: '3b'
  >> compliant <<
> test.3u.pdf
  Parser flavour: '3u'
  >> compliant <<
DONE

Process finished with exit code 0

1.11.6 / 1.11.24 artifacts results:

> test.pdf
  Parser flavour: '1b'
  --> The PDF/A version and conformance level of a file shall be specified using the PDF/A Identification extension schema.
  !! not compliant !!
> test.1a.pdf
  Parser flavour: '1a'
  >> compliant <<
> test.1b.pdf
  Parser flavour: '1b'
  --> A Level A conforming file shall specify the value of pdfaid:conformance as A. A Level B conforming file shall specify the value of pdfaid:conformance as B.
  !! not compliant !!
> test.2a.pdf
  Parser flavour: '2a'
  >> compliant <<
> test.2b.pdf
  Parser flavour: '2b'
  --> A Level A conforming file shall specify the value of pdfaid:conformance as A. A Level B conforming file shall specify the value of 
			pdfaid:conformance as B. A Level U conforming file shall specify the value of pdfaid:conformance as U.
  !! not compliant !!
> test.2u.pdf
  Parser flavour: '2u'
  --> A Level A conforming file shall specify the value of pdfaid:conformance as A. A Level B conforming file shall specify the value of 
			pdfaid:conformance as B. A Level U conforming file shall specify the value of pdfaid:conformance as U.
  !! not compliant !!
> test.3a.pdf
  Parser flavour: '3a'
  >> compliant <<
> test.3b.pdf
  Parser flavour: '3b'
  --> A Level A conforming file shall specify the value of pdfaid:conformance as A. A Level B conforming file shall specify the value of 
			pdfaid:conformance as B. A Level U conforming file shall specify the value of pdfaid:conformance as U.
  !! not compliant !!
> test.3u.pdf
  Parser flavour: '3u'
  --> A Level A conforming file shall specify the value of pdfaid:conformance as A. A Level B conforming file shall specify the value of 
			pdfaid:conformance as B. A Level U conforming file shall specify the value of pdfaid:conformance as U.
  !! not compliant !!
DONE

Process finished with exit code 0
@BezrukovM
Copy link
Contributor

fixed in #963
Now the result will be correct. All files testXY.pdf will be valid against PDF/A-XY flavour. For test.pdf: using NO_FLAVOUR flavour in parser creation means that we want to obtain flavour from file's metadata. In case when there is no data about flavour in metadata (as in test.pdf file) the parser will set default flavour to 1b (this logic may change in future if we will add some non pdfa profiles).
New dependancies versions: 1.11.7 core, 1.11.25 validation-model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants