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

Fix issue #2842: Handle qpdf exit code 3 as success with warnings #2883

Conversation

Abdurrahman-shaikh
Copy link
Contributor

Description of Changes

Please provide a summary of the changes, including:

  • What was changed:

    • Modified the ProcessExecutor class to accept exit code 3 from qpdf as a success with warnings.
    • Added a check to ensure that only qpdf’s exit code 3 is treated as a warning.
    • Added a warning log for qpdf exit code 3 to provide better visibility into the repair process.
  • Why the change was made:

    • The repair process was failing when qpdf returned exit code 3, even though the operation succeeded with warnings. This caused unnecessary errors for users.
    • The changes ensure that PDFs with minor structural issues (e.g., mismatched object counts) are still repaired successfully, while logging warnings for transparency.
    • Added a check to ensure that only qpdf’s exit code 3 is treated as a warning, preventing potential issues with other tools that might use exit code 3 for actual errors.

Closes #2842


Checklist

General

Testing (if applicable)

  • I have tested my changes locally.
    • Verified that exit code 3 is only treated as a warning for qpdf and not for other tools.

Additional Notes

  • The changes align with qpdf's behavior, where exit code 3 indicates a successful operation with warnings.
  • Added a check to ensure that only qpdf’s exit code 3 is treated as a warning, preventing potential issues with other tools.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. Bug Something isn't working labels Feb 4, 2025
@github-actions github-actions bot added the Java Pull requests that update Java code label Feb 4, 2025
@Abdurrahman-shaikh
Copy link
Contributor Author

Looking forward to feedback on this! Let me know if any improvements or refinements are required

@Frooodle Frooodle merged commit 507d217 into Stirling-Tools:main Feb 4, 2025
8 of 9 checks passed
@Abdurrahman-shaikh Abdurrahman-shaikh deleted the fix/issue-2842-repair-pdf-exit-code branch February 5, 2025 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Java Pull requests that update Java code size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
2 participants