GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [core] "Unable to create ValueRepresentation" when using `@LiteralText` (XPath) · Issue #6330 · pmd/pmd

[core] "Unable to create ValueRepresentation" when using @LiteralText (XPath) #6330

New issue
Copy link
New issue
Copy link
Closed
#6342
Closed
[core] "Unable to create ValueRepresentation" when using @LiteralText (XPath)#6330
#6342
Copy link
Labels
a:bugPMD crashes or fails to analyse a file.
Milestone
7.20.0

Description

@Vampire
Vampire
opened on Dec 17, 2025
Issue body actions

Affects PMD Version: 7.19.0

Description:

I configured the XPath rule given below and got the mentioned exception during analysis.

Exception Stacktrace:

Exception applying rule UseAsManyArgumentsAsPlaceholdersInLogMethod on file [...], continuing with next rule
org.apache.commons.lang3.exception.ContextedRuntimeException: java.lang.RuntimeException: Unable to create ValueRepresentation for value of type: class net.sourceforge.pmd.lang.document.Chars
Exception Context:
	[1:Rule applied on node=!debug only! [MethodCall:113:17]logger.atInfo().log("Got no {} restrictions injected")]
---------------------------------
	at net.sourceforge.pmd.util.AssertionUtil.contexted(AssertionUtil.java:256)
	at net.sourceforge.pmd.lang.rule.internal.RuleApplicator.applyOnIndex(RuleApplicator.java:79)
	at net.sourceforge.pmd.lang.rule.internal.RuleApplicator.apply(RuleApplicator.java:57)
	at net.sourceforge.pmd.lang.rule.internal.RuleSets.apply(RuleSets.java:183)
	at net.sourceforge.pmd.lang.impl.PmdRunnable.processSource(PmdRunnable.java:140)
	at net.sourceforge.pmd.lang.impl.PmdRunnable.run(PmdRunnable.java:80)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.RuntimeException: Unable to create ValueRepresentation for value of type: class net.sourceforge.pmd.lang.document.Chars
	at net.sourceforge.pmd.lang.rule.xpath.internal.DomainConversion.getAtomicRepresentation(DomainConversion.java:151)
	at net.sourceforge.pmd.lang.rule.xpath.internal.DomainConversion.convert(DomainConversion.java:61)
	at net.sourceforge.pmd.lang.rule.xpath.internal.AstAttributeNode.atomize(AstAttributeNode.java:73)
	at net.sf.saxon.tree.iter.AtomizingIterator.next(AtomizingIterator.java:64)
	at net.sf.saxon.tree.iter.AtomizingIterator.next(AtomizingIterator.java:28)
	at net.sf.saxon.expr.ItemMappingIterator.next(ItemMappingIterator.java:156)
	at net.sf.saxon.expr.CardinalityCheckingIterator.<init>(CardinalityCheckingIterator.java:55)
	at net.sf.saxon.expr.CardinalityChecker.checkCardinality(CardinalityChecker.java:258)
	at net.sf.saxon.expr.CardinalityChecker$CardinalityCheckerElaborator.lambda$elaborateForPull$0(CardinalityChecker.java:506)
	at net.sf.saxon.expr.elab.LazyPullEvaluator.evaluate(LazyPullEvaluator.java:39)
	at net.sf.saxon.expr.FunctionCall$FunctionCallElaborator.evaluateArguments(FunctionCall.java:671)
	at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPull$3(SystemFunctionCall.java:628)
	at net.sf.saxon.functions.Count$CountFnElaborator.lambda$elaborateForItem$0(Count.java:130)
	at net.sf.saxon.expr.ValueComparison$ValueComparisonElaborator.lambda$elaborateForItem$1(ValueComparison.java:546)
	at net.sf.saxon.expr.elab.ItemElaborator.lambda$elaborateForPull$0(ItemElaborator.java:36)
	at net.sf.saxon.expr.FilterExpression$FilterExprElaborator$PositionalFilteredIterator.next(FilterExpression.java:1331)
	at net.sourceforge.pmd.lang.rule.xpath.internal.SaxonXPathRuleQuery.evaluate(SaxonXPathRuleQuery.java:127)
	at net.sourceforge.pmd.lang.rule.xpath.XPathRule.apply(XPathRule.java:101)
	at net.sourceforge.pmd.lang.rule.internal.RuleApplicator.applyOnIndex(RuleApplicator.java:77)
	... 9 more
Exception occurred on node !debug only! [MethodCall:113:17]logger.atInfo().log("Got no {} restrictions injected")

Code Sample demonstrating the issue:

logger.atInfo().log("Got no {} restrictions injected");

Steps to reproduce:

//MethodCall
[@MethodName = "log"]
[
    *[1]/descendant::VariableAccess[pmd-java:typeIs("org.apache.logging.log4j.Logger")]
    or *[1]/descendant-or-self::VariableAccess[pmd-java:typeIs("org.apache.logging.log4j.LogBuilder")]
]
[count(tokenize(ArgumentList/*[1]/self::StringLiteral/@LiteralText, "\{\}")) != count(ArgumentList/*)]

Running PMD through: Gradle

Activity

  1. Vampire
    added
    a:bugPMD crashes or fails to analyse a file.
    on Dec 17, 2025
  2. oowekyala
    added a commit that references this issue on Dec 17, 2025

    Fix pmd#6330 - cannot access Chars attribute from XPath

    This issue will close once commit 47829c1 is merged into the 'main' branch.
    47829c1
  3. oowekyala
    added this to the 7.20.0 milestone on Dec 17, 2025
  4. oowekyala
    added a commit that references this issue on Dec 17, 2025

    Fix pmd#6330 - cannot access Chars attribute from XPath

    This issue will close once commit 26c632b is merged into the 'main' branch.
    26c632b
  5. adangel
    changed the title [-][java] "Unable to create ValueRepresentation" when using `@LiteralText`[/-] [+][java] "Unable to create ValueRepresentation" when using `@LiteralText` (XPath)[/+] on Dec 18, 2025
  6. adangel
    changed the title [-][java] "Unable to create ValueRepresentation" when using `@LiteralText` (XPath)[/-] [+][core] "Unable to create ValueRepresentation" when using `@LiteralText` (XPath)[/+] on Dec 19, 2025
  7. adangel
    closed this as completedin #6342on Dec 19, 2025
  8. adangel
    added 2 commits that reference this issue on Dec 19, 2025

    [doc] Update release notes (#6330, #6342)

    bbb7438

    [core] Fix #6330: Cannot access Chars attribute from XPath (#6342)

    e50ac05
  9. wener-tiobe
    added a commit that references this issue on Feb 10, 2026

    RM-37163: CPD 7.21.0 upgrade (#8)

    This issue will close once commit 6a1959a is merged into the 'tiobe_pmd7' branch.
    6a1959a
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

    a:bugPMD crashes or fails to analyse a file.

    Type

    No type

    Projects

    No projects

      Milestone

      • 7.20.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.