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 — [java] Parsing error with textblock containing quote followed by two backslashes · Issue #4364 · pmd/pmd

[java] Parsing error with textblock containing quote followed by two backslashes  #4364

New issue
Copy link
New issue
Copy link
Closed
#4366
Closed
[java] Parsing error with textblock containing quote followed by two backslashes #4364
#4366
Copy link
Assignees
jsotuyod
Labels
a:bugPMD crashes or fails to analyse a file.in:grammarAbout the grammar of a lexer or parser, eg, a parse/lex exception
Milestone
6.54.0

Description

@liamsharp
liamsharp
opened on Jan 26, 2023
Issue body actions

Affects PMD Version:

6.53.0

Description:

Parsing this code:

final static String content = """
    <div class="\\invalid-class></div>
    """;

Exception Stacktrace:

<error filename="Testing.java" msg="PMDException: Error while processing Testing.java">
<![CDATA[net.sourceforge.pmd.PMDException: Error while processing /Testing.java
	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:89)
	at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:30)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: net.sourceforge.pmd.lang.ast.TokenMgrError: Lexical error at line 6, column 38.  Encountered: "\n" (10), after : "\"" (in lexical state 0)
	at net.sourceforge.pmd.lang.java.ast.JavaParserTokenManager.getNextToken(JavaParserTokenManager.java:2388)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.jj_consume_token(JavaParser.java:14327)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.Literal(JavaParser.java:5396)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.PrimaryPrefix(JavaParser.java:4914)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.PrimaryExpression(JavaParser.java:4720)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.PostfixExpression(JavaParser.java:4542)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.UnaryExpressionNotPlusMinus(JavaParser.java:4440)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.UnaryExpression(JavaParser.java:4317)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.MultiplicativeExpression(JavaParser.java:4232)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.AdditiveExpression(JavaParser.java:4179)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.ShiftExpression(JavaParser.java:4122)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.RelationalExpression(JavaParser.java:4061)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.InstanceOfExpression(JavaParser.java:3982)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.EqualityExpression(JavaParser.java:3680)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.AndExpression(JavaParser.java:3640)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.ExclusiveOrExpression(JavaParser.java:3600)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.InclusiveOrExpression(JavaParser.java:3560)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.ConditionalAndExpression(JavaParser.java:3520)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.ConditionalOrExpression(JavaParser.java:3480)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.ConditionalExpression(JavaParser.java:3442)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.Expression(JavaParser.java:3301)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.VariableInitializer(JavaParser.java:2072)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.VariableDeclarator(JavaParser.java:1945)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.FieldDeclaration(JavaParser.java:1897)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.ClassOrInterfaceBodyDeclaration(JavaParser.java:1847)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.ClassOrInterfaceBody(JavaParser.java:1802)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.ClassOrInterfaceDeclaration(JavaParser.java:930)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.TypeDeclaration(JavaParser.java:832)
	at net.sourceforge.pmd.lang.java.ast.JavaParser.CompilationUnit(JavaParser.java:552)
	at net.sourceforge.pmd.lang.java.AbstractJavaParser.parse(AbstractJavaParser.java:62)
	at net.sourceforge.pmd.lang.AbstractParser.doParse(AbstractParser.java:45)
	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
]]>
</error>

Code Sample demonstrating the issue:

public class Testing
{

    final static String content = """
        <div class="\\invalid-class></div>
        """;

    
}

Steps to reproduce:

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

mvn compile

Running PMD through: Maven

Activity

  1. liamsharp
    added
    a:bugPMD crashes or fails to analyse a file.
    on Jan 26, 2023
  2. oowekyala
    added
    in:grammarAbout the grammar of a lexer or parser, eg, a parse/lex exception
    on Jan 26, 2023
  3. jsotuyod commented on Jan 26, 2023

    @jsotuyod
    jsotuyod
    on Jan 26, 2023
    Member
    More actions

    This issue is also present in PMD 7.

    Reacted by Liam Sharp
  4. jsotuyod
    added a commit that references this issue on Jan 26, 2023

    Add failing test case for pmd#4364

    146f907
  5. jsotuyod
    self-assigned this
    on Jan 26, 2023
  6. jsotuyod
    added this to the 6.54.0 milestone on Jan 26, 2023
  7. jsotuyod
    added
    has:pr
    on Jan 26, 2023
  8. jsotuyod
    changed the title [-][java] PMDException with java textblock containing quote followed by two backslashes [/-] [+][java] Parsing error with textblock containing quote followed by two backslashes [/+] on Jan 26, 2023
  9. adangel
    closed this as completedin #4366on Jan 27, 2023
  10. rdesgroppes
    added 2 commits that reference this issue on Apr 26, 2023

    Bump PMD version to last planned release (6.55.0)

    9ed8991

    Bump PMD version to last planned release (6.55.0)

    23e1897
  11. illicitonion
    added a commit that references this issue on Apr 26, 2023

    Bump PMD version to last planned release (6.55.0) (#178)

    d99cc64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @jsotuyod
    jsotuyod

Labels

a:bugPMD crashes or fails to analyse a file.in:grammarAbout the grammar of a lexer or parser, eg, a parse/lex exception

Type

No type

Projects

No projects

    Milestone

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