Skip to content

Fix check of parentObject in getParent method in PDStructElem - #741

Merged
MaximPlusov merged 1 commit into
integrationfrom
struct-elem
Oct 19, 2026
Merged

MaximPlusov merged 1 commit into
integrationfrom
struct-elem

Conversation

@LonelyMidoriya

@LonelyMidoriya LonelyMidoriya commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of missing or empty parent references in PDF structure data. Documents with these references are now processed without treating them as valid parent elements, helping avoid incorrect structure relationships.

@LonelyMidoriya LonelyMidoriya self-assigned this Oct 19, 2026
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 58f30b34-f42e-4359-bdcf-98155e894859
📥 Commits

Reviewing files that changed from the base of the PR and between 50836fa and e0f227d.

📒 Files selected for processing: 1
  • src/main/java/org/verapdf/pd/structure/PDStructElem.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

PDStructElem.getParent() now returns null when the /P object is absent or empty. It wraps and returns the parent when /P is non-null and non-empty.

Changes: Parent object check

Layer / File(s) Summary
Parent lookup
src/main/java/org/verapdf/pd/structure/PDStructElem.java
getParent() now checks that /P is non-empty before wrapping it as a PDStructElem.

Priority: ⬇️ Low

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to e0f22

The change avoids wrapping missing or empty /P values, while unresolved indirect parents remain available to getParent(). No actionable merge-blocking risk is established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the change to the parentObject check in PDStructElem.getParent and matches the main change in the pull request.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 cdbd343 into integration Oct 19, 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