yegor256 / qulice

Quality Police for Java projects: aggregator of Checkstyle and PMD
https://www.qulice.com
Other
299 stars 110 forks source link

ArrayIndexOutOfBoundsException in JavadocEmptyLineCheck on valid Java code #747

Open mkordas opened 8 years ago

mkordas commented 8 years ago

On the following code I get ArrayIndexOutOfBoundsException from Qulice:

class Test {
    /**
     **/
    void test() {}
}

As this is valid Java code, Qulice should not fail on it.

Stacktrace:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.qulice:qulice-maven-plugin:0.16.4:check (default) on project a: Execution default of goal com.qulice:qulice-maven-plugin:0.16.4:check failed: Failed to process files
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal com.qulice:qulice-maven-plugin:0.16.4:check failed: Failed to process files
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 25 more
Caused by: java.lang.IllegalStateException: Failed to process files
    at com.qulice.checkstyle.CheckstyleValidator.validate(CheckstyleValidator.java:102)
    at com.qulice.maven.CheckMojo.run(CheckMojo.java:94)
    at com.qulice.maven.CheckMojo.doExecute(CheckMojo.java:66)
    at com.qulice.maven.AbstractQuliceMojo.execute(AbstractQuliceMojo.java:174)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    ... 26 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Exception was thrown while processing Test.java
    at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:282)
    at com.qulice.checkstyle.CheckstyleValidator.validate(CheckstyleValidator.java:100)
    ... 30 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: -2
    at com.qulice.checkstyle.JavadocEmptyLineCheck.visitToken(JavadocEmptyLineCheck.java:86)
    at com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:375)
    at com.puppycrawl.tools.checkstyle.TreeWalker.processIter(TreeWalker.java:486)
    at com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:317)
    at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:189)
    at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:80)
    at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:266)
    ... 31 more
krzyk commented 8 years ago

@davvd valid bug

krzyk commented 8 years ago

@davvd this is postponed

davvd commented 8 years ago

@davvd valid bug

@krzyk I just added bug tag here

davvd commented 8 years ago

@davvd this is postponed

@krzyk sure, thanks, I added "postponed" label to it

davvd commented 8 years ago

@davvd this is postponed

@krzyk right, I'll try to find someone else for this task

davvd commented 8 years ago

@mkordas thank you for reporting this, I added 15 mins to your acc, transaction 56e91e45c1b21975970000c8

dgroup commented 6 years ago

As a workaround, you may generate the copyright header for each *.java file :). It works for my project.

fourgates commented 6 years ago

I am also having this issue.