Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavadocStyleCheck crashes for some Javadoc comments with HTML comments #4564

Closed
denizarsan opened this Issue Jun 30, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@denizarsan
Copy link

denizarsan commented Jun 30, 2017

$ javac C.java

$ javadoc C.java > /dev/null; echo $? # even Javadoc raises no warnings, although the resulting C.html has an unbalanced comment

0

$ cat C.java

// simplified from https://github.com/BaseXdb/basex/blob/909ead894070416fad83164c8170efd288719dee/basex-core/src/main/java/org/basex/build/BuildText.java
public class C {
    /** DTD: <!--. */
    public int i;
}

$ cat config.xml

<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
  <module name="TreeWalker">
    <module name="JavadocStyle"/>
  </module>
</module>

$ java -jar checkstyle-7.8.2-all.jar -c config.xml C.java

Starting audit...
com.puppycrawl.tools.checkstyle.api.CheckstyleException: Exception was thrown while processing C.java
        at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:295)
        at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:213)
        at com.puppycrawl.tools.checkstyle.Main.runCheckstyle(Main.java:425)
        at com.puppycrawl.tools.checkstyle.Main.runCli(Main.java:359)
        at com.puppycrawl.tools.checkstyle.Main.main(Main.java:174)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
        at com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.skipHtmlComment(TagParser.java:217)
        at com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.parseTags(TagParser.java:99)
        at com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.<init>(TagParser.java:57)
        at com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck.checkHtmlTags(JavadocStyleCheck.java:351)
        at com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck.checkComment(JavadocStyleCheck.java:214)
        at com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck.visitToken(JavadocStyleCheck.java:152)
        at com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:370)
        at com.puppycrawl.tools.checkstyle.TreeWalker.processIter(TreeWalker.java:507)
        at com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:312)
        at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:184)
        at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:78)
        at com.puppycrawl.tools.checkstyle.Checker.processFile(Checker.java:316)
        at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:286)
        ... 4 more
Checkstyle ends with 1 errors.

The Javadoc comment has an unbalanced HTML comment, but Javadoc does
not complain, whereas Checkstyle crashes with an uncaught exception.

@romani

This comment has been minimized.

Copy link
Member

romani commented Jul 3, 2017

I remove GSoC label as it is not related to new generation of javadoc Checks (that are based on ANTLR grammar), JavadocStyleCheck is old Check that is based on regexp parsing, completely error prone approach.
We will cover this case when this Check reimplemented to grammar parsed approach.

@romani romani added the approved label Jul 3, 2017

@Vladlis

This comment has been minimized.

Copy link
Member

Vladlis commented Jul 6, 2017

@romani

We will cover this case when this Check reimplemented to grammar parsed approach.

That is why I added this issue to GSoC project - to be sure it is cover after the check is reimplemented.

@romani

This comment has been minimized.

Copy link
Member

romani commented Jul 15, 2017

lets focus on critical issues for GSoC: performance and reliable parsing ...... as we do this ... all issues with javadoc label cuold be addressed.

rnveach added a commit to rnveach/checkstyle that referenced this issue Feb 20, 2019

romani added a commit that referenced this issue Feb 21, 2019

@romani romani added the bug label Feb 21, 2019

@romani romani added this to the 8.18 milestone Feb 21, 2019

@romani

This comment has been minimized.

Copy link
Member

romani commented Feb 21, 2019

Fix is merged

@romani romani closed this Feb 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.