A RetroSearch Logo

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

Search Query:

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

[apex] CPD fails to parse string literals with escaped characters · Issue #5053 · pmd/pmd · GitHub

Affects PMD Version:
PMD 7.2.0

Description:

PMD 7.2.0 CPD fails when parsing Apex class with string characters such as \u, ", %, etc.
This did not occur in PMD 6.55

Exception Stacktrace:

[TRACE] Tokenizing C:\Users\myname\Downloads\pmd-dist-7.2.0-bin\pmd-bin-7.2.0\bin\PMD7CPD.cls
line 4:86 token recognition error at: ''\u00A'
line 4:98 token recognition error at: '"'
line 4:102 token recognition error at: '%'
line 4:103 token recognition error at: '"'
line 4:104 token recognition error at: '');\n    }    \n}'

Code Sample demonstrating the issue:

 public with sharing class PMD7CPD {
    public static void example(){
      String str = 'alice'; 
      str = str.replace('alice', '<bob></charlie>dan<!--JohannHeinrichvonThünen-->' + '\u00A0' + '"100%"');
    }    
}

Steps to reproduce:

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

  1. In the folder where the pmd binary resides, create a file named PMD7CPD.cls and paste in the above apex code
  2. Invoke PMD CPD 7.2 via pmd cpd --debug --dir ./ --minimum-tokens 100 --language apex --format csv > result.csv

Running PMD through: Command line (Bash)

OpenJDK 17


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