Skip to content

[core] RuleSetWriter: fix indent-number attribute - #6730

Merged
adangel merged 1 commit into
pmd:mainfrom
adangel:core/ruleset-writer
Jun 12, 2026
Merged

adangel merged 1 commit into
pmd:mainfrom
adangel:core/ruleset-writer

Conversation

@adangel

@adangel adangel commented May 28, 2026

Copy link
Copy Markdown
Member

Describe the PR

From the logs of the pmd-eclipse-plugin:

    09:55:38.787 [WorkbenchTestable] DEBUG net.sourceforge.pmd.RuleSetWriter - Couldn't set indentation
    java.lang.IllegalArgumentException: Unrecognized configuration feature: indent-number
        at net.sf.saxon.Configuration.setConfigurationProperty(Configuration.java:4326)
        at net.sf.saxon.jaxp.SaxonTransformerFactory.setAttribute(SaxonTransformerFactory.java:330)
        at net.sourceforge.pmd.RuleSetWriter.write(RuleSetWriter.java:75)
        at net.sourceforge.pmd.eclipse.runtime.writer.impl.RuleSetWriterImpl.write(RuleSetWriterImpl.java:37)
        at net.sourceforge.pmd.eclipse.runtime.preferences.impl.PreferencesManagerImpl.storeRuleSetInStateLocation(PreferencesManagerImpl.java:691)
        at net.sourceforge.pmd.eclipse.runtime.preferences.impl.PreferencesManagerImpl.setRuleSet(PreferencesManagerImpl.java:300)

This probably stopped working a long time ago. The reason is: We have Saxon on the classpath (used for our XPath-based rules) and this doesn't support "indent-number" attribute. But the built-in XML transformer of Java does...

Incidentally, Saxon uses by default 3 spaces for indentation, which we also chose. So there is no real difference, but the exception is annoying.

With this PR, this Illegal Argument Exception doesn't appear anymore.

Related issues

  • none

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@adangel adangel added this to the 7.26.0 milestone May 28, 2026
@pmd-actions-helper

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-05-28 15:26:14+00:00 for 12dbf85)

@adangel
adangel merged commit 11a95a1 into pmd:main Jun 12, 2026
13 checks passed
@adangel
adangel deleted the core/ruleset-writer branch June 12, 2026 08:53
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