CauseParameterInExceptionCheck: NullPointerException occurred during the analysis #355

Closed
rdiachenko opened this Issue Jun 10, 2015 · 3 comments

Projects

None yet

3 participants

@rdiachenko
Member
public enum A{
    B;
    private A() {}
}
<module name="CauseParameterInException">
      <property name="severity" value="warning"/>
</module>
[ERROR] NullPointerException occurred during the analysis of file /SomeClass.java.
java.lang.NullPointerException
        at com.github.sevntu.checkstyle.checks.design.CauseParameterInExceptionCheck.getClassDef(CauseParameterInExceptionCheck.java:244)
        at com.github.sevntu.checkstyle.checks.design.CauseParameterInExceptionCheck.visitToken(CauseParameterInExceptionCheck.java:154)
        at com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:393)
        at com.puppycrawl.tools.checkstyle.TreeWalker.processIter(TreeWalker.java:482)
        at com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:322)
        at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:195)
        at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:76)
        at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:260)
        at org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor.executeCheckstyle(DefaultCheckstyleExecutor.java:253)
        at org.apache.maven.plugin.checkstyle.AbstractCheckstyleReport.executeReport(AbstractCheckstyleReport.java:473)
        at org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:155)
        at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:255)
        at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:143)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        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:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        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)

Reproduced on:
checkstyle 6.7
sevntu-checkstyle 1.13.3

@romani romani referenced this issue in checkstyle/checkstyle Jun 15, 2015
Closed

UT coverage for AvoidStarImportCheck. #1128 #1212

@igieon
Contributor
igieon commented Sep 24, 2015

I have same problem with
checkstyle 6.10.1
sevntu-checkstyle 1.13.6

                            <dependency>
                                <groupId>com.puppycrawl.tools</groupId>
                                <artifactId>checkstyle</artifactId>
                                <version>6.10.1</version>
                            </dependency>
                            <dependency>
                                <groupId>com.github.sevntu.checkstyle</groupId>
                                <artifactId>sevntu-checkstyle-maven-plugin</artifactId>
                                <version>1.13.6</version>
                            </dependency>
    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:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    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:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    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)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.16:check failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:144)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: java.lang.NullPointerException
    at com.github.sevntu.checkstyle.checks.design.CauseParameterInExceptionCheck.getClassDef(CauseParameterInExceptionCheck.java:244)
    at com.github.sevntu.checkstyle.checks.design.CauseParameterInExceptionCheck.visitToken(CauseParameterInExceptionCheck.java:154)
    at com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:392)
    at com.puppycrawl.tools.checkstyle.TreeWalker.processIter(TreeWalker.java:503)
    at com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:334)
    at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:209)
    at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:79)
    at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:265)
    at org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor.executeCheckstyle(DefaultCheckstyleExecutor.java:252)
    at org.apache.maven.plugin.checkstyle.CheckstyleViolationCheckMojo.execute(CheckstyleViolationCheckMojo.java:538)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
@romani romani added this to the 1.14.1 milestone Oct 7, 2015
@romani
Member
romani commented Oct 7, 2015

merged.

@romani romani closed this Oct 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment