Skip to content

Commit

Permalink
Upgraded VeraPdf to 1.16.1
Browse files Browse the repository at this point in the history
* #9936 Upgraded VeraPdf to 1.16.1
Changed exit code checking to allow parsing of code 1 (which now means invalid pdf)

* Made exitcode2.sh executable
  • Loading branch information
ra-magnus-welander authored Mar 15, 2021
1 parent af9a845 commit 3ddc21a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion PdfAValidator/PdfAValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public async Task<Report> ValidateWithDetailedReportAsync(string pathToPdfFile)

process.WaitForExit();

if (process.ExitCode == 0)
if (process.ExitCode == 0 || process.ExitCode == 1)
{
ValidateVeraPdfOutputToBeXml(outputResult, PathJava, VeraPdfStartScript);
var veraPdfReport = DeserializeXml<Report>(outputResult);
Expand Down
Binary file modified PdfAValidator/VeraPdf.Linux.zip
Binary file not shown.
Binary file modified PdfAValidator/VeraPdf.Windows.zip
Binary file not shown.
10 changes: 5 additions & 5 deletions PdfAValidatorTest/PdfAValidatorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,23 @@ public static async Task ShouldFailGracefullWithUnrecognicedVeraPdfOutput()
}

[Fact]
public static async Task ShouldFailGracefullWithExitcode1()
public static async Task ShouldFailGracefullWithExitcode2()
{
var somethingThatReturnsExitcode1 = "./TestExecuteables/exitcode1.bat";
var somethingThatReturnsExitcode2 = "./TestExecuteables/exitcode2.bat";

if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
somethingThatReturnsExitcode1 = "./TestExecuteables/exitcode1.sh";
somethingThatReturnsExitcode2 = "./TestExecuteables/exitcode2.sh";
}

var veraPdfException = await Assert.ThrowsAsync<VeraPdfException>(async () =>
{
// Using default ctor to get Java bins for the test
using var pdfAValidator = new PdfAValidator(somethingThatReturnsExitcode1, "SomeValue");
using var pdfAValidator = new PdfAValidator(somethingThatReturnsExitcode2, "SomeValue");
await pdfAValidator.ValidateAsync("./TestPdfFiles/FromLibreOffice.pdf");
});

Assert.Equal($"Calling VeraPdf exited with 1 caused an error: \nCustom JAVACMD: SomeValue\nVeraPdfStartScript: {somethingThatReturnsExitcode1}", veraPdfException.Message);
Assert.Equal($"Calling VeraPdf exited with 2 caused an error: \nCustom JAVACMD: SomeValue\nVeraPdfStartScript: {somethingThatReturnsExitcode2}", veraPdfException.Message);
}

private static void AssertVeraPdfBinCreation(string? scriptPath)
Expand Down
8 changes: 4 additions & 4 deletions PdfAValidatorTest/PdfAValidatorTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
<ItemGroup>
<None Remove="TestExecuteables\exitcode0.bat" />
<None Remove="TestExecuteables\exitcode0.sh" />
<None Remove="TestExecuteables\exitcode1.sh" />
<None Remove="TestExecuteables\exitcode2.bat" />
<None Remove="TestExecuteables\exitcode2.sh" />
<None Remove="TestPdfFiles\FontsNotEmbedded.pdf" />
<None Remove="TestPdfFiles\FromLibreOffice.pdf" />
<None Remove="TestPdfFiles\FromLibreOfficeNonPdfA.pdf" />
<None Remove="TestExecuteables\exitcode1.bat" />
</ItemGroup>

<ItemGroup>
<Content Include="TestExecuteables\exitcode1.sh">
<Content Include="TestExecuteables\exitcode2.sh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestExecuteables\exitcode0.sh">
Expand All @@ -34,7 +34,7 @@
<Content Include="TestPdfFiles\FontsNotEmbedded.pdf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestExecuteables\exitcode1.bat">
<Content Include="TestExecuteables\exitcode2.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestExecuteables\exitcode0.bat">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
EXIT 1
EXIT 2
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
exit 1
exit 2

0 comments on commit 3ddc21a

Please sign in to comment.