Skip to content

[core] Include XML validation details in ruleset loading errors #6912

Closed

Description

@AB-xdev

Relevant piece of code:

RuleSetLoader withReporter(@NonNull PmdReporter reporter) {

Is your feature request related to a problem? Please describe.
I want to supply a custom PmdReporter because the default error message when loading a ruleset fails only contains "Cannot load ruleset ruleset.xml: An XML validation error occurred" while not specifying what exactly went wrong.

My custom PmdReporter records that error and add it as a suppressed exception.

Describe the solution you'd like
RuleSetLoader#withReporter is publicly accessible

Describe alternatives you've considered
Reflection

Activity

  1. added
    an:enhancement
    on Jul 29, 2026
  2. UncleOwen commented on Aug 5, 2026

    @UncleOwen
    Member

    That sounds like an XY problem.

    Your real problem seems to be the vague error message. I’ve found that frustrating myself. Let's make this ticket about fixing the error message instead of extending the public API.

  3. arimu1 commented on Aug 6, 2026

    @arimu1
    Contributor

    Thanks @UncleOwen for the redirect — agreed this is better solved by fixing the vague RuleSetLoadException message rather than exposing withReporter.

    I'll close #6937 (API expansion) as out of scope. If I pursue a fix, it will be a separate PR that puts the XML validation detail into the exception message itself so callers get useful feedback without needing a custom reporter.

  4. AB-xdev commented on Aug 6, 2026

    @AB-xdev
    Author

    Your real problem seems to be the vague error message. I’ve found that frustrating myself. Let's make this ticket about fixing the error message instead of extending the public API.

    That's correct, however why don't also (additionally) make the method public? I see no disadvantages doing this...

  5. adangel commented on Aug 14, 2026

    @adangel
    Member

    AFAIR, the reporter can be set via PMDConfiguration#setReporter and the RuleSetLoader should be created with RuleSetLoader#fromPmdConfig - then it preserves the initially set reporter.

  6. AB-xdev commented on Aug 18, 2026

    @AB-xdev
    Author

    AFAIR, the reporter can be set via PMDConfiguration#setReporter and the RuleSetLoader should be created with RuleSetLoader#fromPmdConfig - then it preserves the initially set reporter.

    I don't think that creating an entire PMDConfiguration - that I don't even need in that place - just to set the reporter - because there is no publicly accessible method - is a good practice and intuitive.

  7. changed the title [-]`RuleSetLoader#withReporter` is not publicly accessible[/-] [+][core] Include XML validation details in ruleset loading errors[/+] on Oct 4, 2026
  8. added this to the 7.29.0 milestone on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    an:enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions