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 — [javascript] Error - no Node adapter class registered for XmlPropRef · Issue #3703 · pmd/pmd

[javascript] Error - no Node adapter class registered for XmlPropRef #3703

New issue
Copy link
New issue
Copy link
Closed
#3725
Closed
[javascript] Error - no Node adapter class registered for XmlPropRef#3703
#3725
Copy link
Labels
a:bugPMD crashes or fails to analyse a file.
Milestone
6.42.0

Description

@MartGit
MartGit
opened on Dec 28, 2021
Issue body actions

Affects PMD Version:
Version 6.42.0-SNAPSHOT

Make sure, to test with the latest PMD version.

Description:
I get the error below whenever I try to run the custom rule below on the Javascript file (Content included below)

Exception Stacktrace:

Dec 27, 2021 11:53:04 PM net.sourceforge.pmd.processor.PmdRunnable addError
FINE: Error while processing file: /usr/local/google/home/martinsu/work/shg-eng-excellence/apexrules/src/test/java/com/google/rules/pmd/javascript/StandardJSTemplate.js
net.sourceforge.pmd.PMDException: Error while processing /usr/local/google/home/martinsu/work/shg-eng-excellence/apexrules/src/test/java/com/google/rules/pmd/javascript/StandardJSTemplate.js
	at net.sourceforge.pmd.SourceCodeProcessor.processSourceCodeWithoutCache(SourceCodeProcessor.java:128)
	at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:100)
	at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:62)
	at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:85)
	at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:29)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: java.lang.IllegalArgumentException: There is no Node adapter class registered for the Node class: class org.mozilla.javascript.ast.XmlPropRef
	at net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptTreeBuilder.createNodeAdapter(EcmascriptTreeBuilder.java:166)
	at net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptTreeBuilder.buildInternal(EcmascriptTreeBuilder.java:191)
	at net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptTreeBuilder.visit(EcmascriptTreeBuilder.java:217)
	at org.mozilla.javascript.ast.XmlPropRef.visit(XmlPropRef.java:84)
	at org.mozilla.javascript.ast.ExpressionStatement.visit(ExpressionStatement.java:124)
	at net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptTreeBuilder.buildInternal(EcmascriptTreeBuilder.java:205)
	at net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptTreeBuilder.visit(EcmascriptTreeBuilder.java:217)
	at org.mozilla.javascript.ast.ExpressionStatement.visit(ExpressionStatement.java:123)
	at org.mozilla.javascript.ast.ScriptNode.visit(ScriptNode.java:322)
	at net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptTreeBuilder.buildInternal(EcmascriptTreeBuilder.java:205)
	at net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptTreeBuilder.build(EcmascriptTreeBuilder.java:177)
	at net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptParser.parse(EcmascriptParser.java:70)
	at net.sourceforge.pmd.lang.ecmascript.Ecmascript3Parser.parse(Ecmascript3Parser.java:47)
	at net.sourceforge.pmd.lang.AbstractParser.doParse(AbstractParser.java:44)
	at net.sourceforge.pmd.SourceCodeProcessor.parse(SourceCodeProcessor.java:136)
	at net.sourceforge.pmd.SourceCodeProcessor.processSource(SourceCodeProcessor.java:200)
	at net.sourceforge.pmd.SourceCodeProcessor.processSourceCodeWithoutCache(SourceCodeProcessor.java:118)
	... 10 more

Code Sample demonstrating the issue:

import { LightningElement, api, wire, track } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';

export default class InteractionScore extends LightningElement {
  @api recordId;
  @track
  relatedRecords;
  @track showMessage;
  /**
   * @description This is a wire adapter used to get case Object Info
   * @param
   */
  @wire(getRelatedRecordByCaseId, {
    caseId: '$recordId'
  })
  caseObjectInfo({
    error,
    data
  }) {
    if (data) {

  }
  handleDetailAnalysisClick(event) {
  }
  /**
   * @description Method to show toast incase of any error.
   */
  showErrorToast(errorMessage) {
    const evt = new ShowToastEvent({
      title: 'Error Occurred',
      message: errorMessage,
      variant: 'error'
    });
    this.dispatchEvent(evt);
  }
}
}

Steps to reproduce:
Any Javascript rule can be used to reproduce this issue as it fails for any rule on this test file, StandardJSTemplate.js, so please feel free to run this file using any Javascript rule. You will reproduce the issue.

Please provide detailed steps for how we can reproduce the bug.

  1. ... (e.g. if you're using maven: mvn clean verify) Ran mvn clean install to generate the jar that was copied over to PMD/bin
  2. ... Then tested the specific custom rule with this command: ./test.sh -x JavascriptMethodLength.xml -t StandardJSTemplate.js
  3. test.sh is a shell script that runs the pmd command for the specific rule contained in the: JavascriptMethodLength.xml on the Javascript test file: StandardJSTemplate.js
  4. Note that this rule works for other Javascript files that do not contain annotations like @wire, @api, @track. It gives the error above for files with these annotations.

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Running PMD through CLI using the shell script test.sh

Activity

  1. MartGit
    added
    a:bugPMD crashes or fails to analyse a file.
    on Dec 28, 2021
  2. oowekyala commented on Jan 5, 2022

    @oowekyala
    oowekyala
    on Jan 5, 2022
    Member
    More actions

    Thanks for the report! This should be easy to fix by adding a line there:

    pmd/pmd-javascript/src/main/java/net/sourceforge/pmd/lang/ecmascript/ast/EcmascriptTreeBuilder.java

    Line 79 in 72c4bbb

    static {

  3. oowekyala
    added this to the 6.42.0 milestone on Jan 5, 2022
  4. MartGit commented on Jan 5, 2022

    @MartGit
    MartGit
    on Jan 5, 2022
    Author
    More actions

    Thanks @oowekyala. Will this fix be part of the next release? Do you know when to expect this in the master branch?

  5. oowekyala commented on Jan 5, 2022

    @oowekyala
    oowekyala
    on Jan 5, 2022
    Member
    More actions

    Yes I milestoned it for the next release (end of January). It would be nice for someone to volunteer a PR, otherwise I'll fix it before the release

  6. MartGit commented on Jan 7, 2022

    @MartGit
    MartGit
    on Jan 7, 2022
    Author
    More actions

    Thanks @oowekyala. I'll be on the look out for the next release then.

  7. adangel
    changed the title [-][Javascript] Error - no Node adapter class registered for the Node class[/-] [+][javascript] Error - no Node adapter class registered for the Node class[/+] on Jan 8, 2022
  8. adangel
    changed the title [-][javascript] Error - no Node adapter class registered for the Node class[/-] [+][javascript] Error - no Node adapter class registered for XmlPropRef[/+] on Jan 13, 2022
  9. adangel
    added 2 commits that reference this issue on Jan 13, 2022

    [javascript] Add ASTXmlPropRef node

    This issue will close once commit cd71c03 is merged into the 'main' branch.
    cd71c03

    Merge pull request pmd#3725 from adangel:issue-3703-javascript-rhino

    This issue will close once commit 803cfad is merged into the 'main' branch.
    803cfad
  10. adangel
    closed this as completedin cd71c03on Jan 20, 2022
  11. adangel
    closed this as completedin #3725on Jan 20, 2022
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

      • 6.42.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.