A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/3703 below:

[javascript] Error - no Node adapter class registered for XmlPropRef · Issue #3703 · pmd/pmd · GitHub

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4