Skip to content

Fix misleading 'XML could not be parsed.' message for non-label targets (directories)#1533

Open
jordanpadams wants to merge 1 commit intomainfrom
bugfix/1510-directory-xml-misleading-message
Open

Fix misleading 'XML could not be parsed.' message for non-label targets (directories)#1533
jordanpadams wants to merge 1 commit intomainfrom
bugfix/1510-directory-xml-misleading-message

Conversation

@jordanpadams
Copy link
Member

🗒️ Summary

Fix misleading (XML could not be parsed.) parenthetical appearing in report output for directories and other non-label targets when running --rule pds4.bundle or pds4.collection.

Root cause: Report.lidvid() used "XML could not be parsed." as its default return value. For non-label targets (directories), TargetExaminer.isTargetALabel() returns false immediately, leaving the default string in place — even though no XML was ever attempted.

Changes:

  • Report.java: Return "" for non-label targets; reserve "LIDVID could not be extracted." for actual label files where LIDVID extraction fails (more accurate, since isTargetALabel() already confirms the XML is parseable before extraction is attempted)
  • FullReport.java: Skip the (lidvid) parenthetical entirely when lidvid is empty

Before:

  PASS: file:/path/to/data/ (XML could not be parsed.)
     WARNING  [warning.sub_directory.unallowed_name] ...

After:

  PASS: file:/path/to/data/
     WARNING  [warning.sub_directory.unallowed_name] ...

🤖 This fix was developed with AI assistance (Claude Sonnet 4.6). ~90% of the implementation was AI-influenced.

⚙️ Test Data and/or Report

Manually verified logic by tracing TargetExaminer.isTargetALabel() and getTargetContent() behavior. Existing test suite passes (mvn compile clean). A dedicated regression test scenario can be added under src/test/resources/github1510/ if desired.

♻️ Related Issues

Fixes #1510

🤓 Reviewer Checklist

  • Documentation: No user-facing docs needed beyond the fix itself
  • Security: No security implications
  • Testing: Logic traced through TargetExaminerisTargetALabel() confirms XML parseable before entering the extraction branch
  • Maintenance: Two small, focused changes to report formatting only

Report.lidvid() was returning 'XML could not be parsed.' as its default
value, which was shown for any non-label target (e.g. directories) that
cannot have XML to parse. Now returns empty string for non-labels so no
parenthetical is shown, reserves 'LIDVID could not be extracted.' for
actual label files where LIDVID extraction fails, and FullReport skips
the parenthetical entirely when lidvid is empty.

Fixes #1510

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@jordanpadams jordanpadams requested a review from a team as a code owner March 20, 2026 15:53
@jordanpadams jordanpadams added the bug Something isn't working label Mar 20, 2026
@jordanpadams jordanpadams self-assigned this Mar 20, 2026
Copy link
Member

@nutjob4life nutjob4life left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code delta: ✓
Maven tests: ✓
Approval: ✅
Maven details:

292 scenarios (292 passed)
876 steps (876 passed)
10m 53.787s
Mar 20, 2026 11:08:05 AM org.junit.platform.launcher.core.DiscoveryIssueNotifier logIssues
WARNING: TestEngine with ID 'cucumber' encountered a non-critical issue during test discovery:

(1) [WARNING] Discovering tests using the cucumber.features property. Other discovery selectors are ignored!

This is a work around for the limited JUnit 5 support in Maven and Gradle. Please request/upvote/sponsor/ect better support for JUnit 5 discovery selectors. For details see: https://github.com/cucumber/cucumber-jvm/pull/2498

If you are using the JUnit 5 Suite Engine, Platform Launcher API or Console Launcher you should not use this property. Please consult the JUnit 5 documentation on test selection.
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 653.9 s -- in io.cucumber.junit.platform.engine.CucumberTestEngine
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 25, Failures: 0, Errors: 0, Skipped: 23
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11:22 min
[INFO] Finished at: 2026-03-20T11:08:05-05:00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When validate reports a directory has a warning it says "XML could not be parsed." which is misleading.

2 participants