Skip to content

fix: null-check getLABEL() in StructMapValidator to prevent NPE on unlabelled divs#379

Open
luis100 wants to merge 1 commit into
masterfrom
fix/issue-378-null-label-npe-struct-map-validator
Open

fix: null-check getLABEL() in StructMapValidator to prevent NPE on unlabelled divs#379
luis100 wants to merge 1 commit into
masterfrom
fix/issue-378-null-label-npe-struct-map-validator

Conversation

@luis100

@luis100 luis100 commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #378

  • StructMapValidator.validateCSIP88 (and 9 other methods in the same class) called getLABEL().equals(...) or getLABEL().matches(...) without a null guard, crashing with a NullPointerException when a <structMap> or <div> element has no LABEL attribute.
  • LABEL is optional in the METS schema, so metadata-only / no-representations packages are valid inputs that previously aborted the entire validation run with no report produced.
  • All 10 unguarded call-sites are now wrapped with getLABEL() != null && to match the pattern already used consistently elsewhere in the same file.

Test plan

  • mvn compile — clean
  • mvn test (25 tests) — all pass
  • Reproduce with the minimal METS from the issue (div without LABEL, no representations folder) — validation should complete and return a CSIP88 failure result instead of throwing

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y4iKxBwBcXisaP7MJVJ6VN

…Validator

Fixes NullPointerException in validateCSIP88 (and 9 other methods) when
a CSIP <div> or <structMap> element has no LABEL attribute. LABEL is
optional in the METS schema, so packages without a representations folder
(metadata-only SIPs) could crash the entire validation run instead of
producing a report.

Fixes #378

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y4iKxBwBcXisaP7MJVJ6VN
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug java Pull requests that update java code labels Jul 2, 2026
@luis100 luis100 requested review from 006627 and AntonioG70 July 2, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug java Pull requests that update java code size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NullPointerException in StructMapValidator.validateCSIP88 when a CSIP <div> has no LABEL

1 participant