Skip to content

Fix NPE in clipToMediaBox() - #718

Merged
MaximPlusov merged 3 commits into
integrationfrom
media-box
Aug 6, 2026
Merged

Fix NPE in clipToMediaBox()#718
MaximPlusov merged 3 commits into
integrationfrom
media-box

Conversation

@LonelyMidoriya

@LonelyMidoriya LonelyMidoriya commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of annotations with missing or invalid geometry.
    • Prevented incorrect clipping when a page has no media box.
    • Operations now safely return an unavailable result when required page or annotation bounds are missing.

@LonelyMidoriya LonelyMidoriya self-assigned this Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@LonelyMidoriya, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f00c4cf-63ee-4609-9a3c-e9a3b7a67f76

📥 Commits

Reviewing files that changed from the base of the PR and between 15d4229 and 8e0e172.

📒 Files selected for processing (1)
  • src/main/java/org/verapdf/pd/PDPage.java
📝 Walkthrough

Walkthrough

The change adds null and length checks before annotation crop-box and page media-box coordinate access. Both methods return null when required geometry is unavailable or invalid.

Changes

Bounding-box validation

Layer / File(s) Summary
Geometry guards
src/main/java/org/verapdf/pd/PDAnnotation.java, src/main/java/org/verapdf/pd/PDPage.java
isOutsideCropBox validates both geometry arrays. clipToMediaBox handles a missing media box before accessing its coordinates.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: maximplusov

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change in PDPage.clipToMediaBox and identifies the null-pointer exception being fixed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch media-box

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MaximPlusov
MaximPlusov merged commit d56121e into integration Aug 6, 2026
9 checks passed
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

Successfully merging this pull request may close these issues.

2 participants