A RetroSearch Logo

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

Search Query:

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

[html] CPD throws exception on when HTML file is missing closing tag · Issue #5322 · pmd/pmd · GitHub

Affects PMD Version:
7.7.0

Description:

When running CPD with the HTML language, sometimes it throws an exception stopping my execution.
Shouldn't this just be a processing error instead of a full blown exception?

See the stacktrace I'm getting when using the sample file below (which I reduced to be super small to show that it is having issues when there is a missing closing div tag).

Exception Stacktrace:

java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: offset must be in range [0,10723], got -1                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 at net.sourceforge.pmd.lang.html.cpd.HtmlCpdLexer.tokenize(HtmlCpdLexer.java:47)                                                                                                                                                                                                                                                                                                                                                                                     
 at net.sourceforge.pmd.cpd.CpdLexer.tokenize(CpdLexer.java:29)                                                                                                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 at net.sourceforge.pmd.cpd.CpdAnalysis.doTokenize(CpdAnalysis.java:146)                                                                                                                                                                                                                                                                                                                                                                                              
 at net.sourceforge.pmd.cpd.CpdAnalysis.performAnalysis(CpdAnalysis.java:172)                                                                                                                                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 ... 4 more                                                                                                                                                                                                                                                                                                                                                                                                                                                           
 Caused by: java.lang.IndexOutOfBoundsException: offset must be in range [0,10723], got -1                                                                                                                                                                                                                                                                                                                                                                            
 	at net.sourceforge.pmd.util.AssertionUtil.mustBe(AssertionUtil.java:203)                                                                                                                                                                                                                                                                                                                                                                                             
 at net.sourceforge.pmd.util.AssertionUtil.requireInRange(AssertionUtil.java:193)                                                                                                                                                                                                                                                                                                                                                                                     
 	at net.sourceforge.pmd.util.AssertionUtil.requireInInclusiveRange(AssertionUtil.java:179)                                                                                                                                                                                                                                                                                                                                                                            
 at net.sourceforge.pmd.lang.document.SourceCodePositioner.lineColFromOffset(SourceCodePositioner.java:41)                                                                                                                                                                                                                                                                                                                                                            
 at net.sourceforge.pmd.lang.document.RootTextDocument.toLocation(RootTextDocument.java:69)                                                                                                                                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 at net.sourceforge.pmd.lang.ast.Node.getReportLocation(Node.java:117)                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 at net.sourceforge.pmd.lang.html.cpd.HtmlCpdLexer.traverse(HtmlCpdLexer.java:58)                                                                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 at net.sourceforge.pmd.lang.html.cpd.HtmlCpdLexer.traverse(HtmlCpdLexer.java:61)                                                                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 at net.sourceforge.pmd.lang.html.cpd.HtmlCpdLexer.traverse(HtmlCpdLexer.java:61)                                                                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 at net.sourceforge.pmd.lang.html.cpd.HtmlCpdLexer.traverse(HtmlCpdLexer.java:61)                                                                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 at net.sourceforge.pmd.lang.html.cpd.HtmlCpdLexer.traverse(HtmlCpdLexer.java:61)                                                                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 at net.sourceforge.pmd.lang.html.cpd.HtmlCpdLexer.traverse(HtmlCpdLexer.java:61)                                                                                                                                                                                                                                                                                                                                                                                     
 at net.sourceforge.pmd.lang.html.cpd.HtmlCpdLexer.tokenize(HtmlCpdLexer.java:43)                                                                                                                                                                                                                                                                                                                                                                                     
 	... 7 more        

Code Sample demonstrating the issue:

<!doctype html>
<html lang="en">
<body>
<div class='wrapper'>
</body>
</html>
    
    

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