Uploaded image for project: 'Maven Checkstyle Plugin'
  1. Maven Checkstyle Plugin
  2. MCHECKSTYLE-333

Intermittent NPE on checkstyle:check

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.17
    • None
    • None
    • None
    • OSX El Captain, java 8, maven 3.x, checkstyle 6.19

    Description

      I generally run checkstyle:check manually but I wanted to integrate it into the validate phase of my root build.

      After doing this, it will intermittent fail with an NPE:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (checkstyle) on project dropwizard-api: Execution checkstyle of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check failed. NullPointerException -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (checkstyle) on project dropwizard-api: Execution checkstyle of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check failed.
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
      	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:863)
      	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
      	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:498)
      	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 checkstyle of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check failed.
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
      	... 20 more
      Caused by: java.lang.NullPointerException
      	at java.util.zip.ZipFile.getZipEntry(ZipFile.java:566)
      	at java.util.zip.ZipFile.access$900(ZipFile.java:60)
      	at java.util.zip.ZipFile$ZipEntryIterator.next(ZipFile.java:524)
      	at java.util.zip.ZipFile$ZipEntryIterator.nextElement(ZipFile.java:499)
      	at java.util.zip.ZipFile$ZipEntryIterator.nextElement(ZipFile.java:480)
      	at java.util.jar.JarFile$JarEntryIterator.next(JarFile.java:257)
      	at java.util.jar.JarFile$JarEntryIterator.nextElement(JarFile.java:266)
      	at java.util.jar.JarFile$JarEntryIterator.nextElement(JarFile.java:247)
      	at org.codehaus.plexus.resource.loader.JarHolder.getEntries(JarHolder.java:132)
      	at org.codehaus.plexus.resource.loader.JarResourceLoader.loadJar(JarResourceLoader.java:100)
      	at org.codehaus.plexus.resource.loader.JarResourceLoader.initialize(JarResourceLoader.java:63)
      	at org.codehaus.plexus.resource.loader.JarResourceLoader.getResource(JarResourceLoader.java:141)
      	at org.apache.maven.plugin.checkstyle.resource.LicenseResourceManager.getResource(LicenseResourceManager.java:75)
      	at org.codehaus.plexus.resource.DefaultResourceManager.getResourceAsFile(DefaultResourceManager.java:91)
      	at org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor.getOverridingProperties(DefaultCheckstyleExecutor.java:564)
      	at org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor.getConfiguration(DefaultCheckstyleExecutor.java:379)
      	at org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor.executeCheckstyle(DefaultCheckstyleExecutor.java:217)
      	at org.apache.maven.plugin.checkstyle.CheckstyleViolationCheckMojo.execute(CheckstyleViolationCheckMojo.java:538)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
      	... 21 more
      [ERROR]
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      

      My pom config:

        <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-checkstyle-plugin</artifactId>
                      <version>2.17</version>
                      <configuration>
                          <configLocation>build-tools/src/main/resources/checkstyle/checkstyle.xml</configLocation>
                          <includeTestSourceDirectory>true</includeTestSourceDirectory>
                          <suppressionsLocation>build-tools/src/main/resources/checkstyle/suppressions.xml</suppressionsLocation>
                          <linkXRef>false</linkXRef>
                      </configuration>
                      <executions>
                          <execution>
                              <id>checkstyle</id>
                              <phase>validate</phase>
                              <goals>
                                  <goal>check</goal>
                              </goals>
                              <configuration>
                                  <failOnViolation>true</failOnViolation>
                                  <encoding>UTF-8</encoding>
                                  <consoleOutput>true</consoleOutput>
                                  <failsOnError>true</failsOnError>
                                  <linkXRef>false</linkXRef>
                              </configuration>
                          </execution>
                      </executions>
                      <dependencies>
                          <dependency>
                              <groupId>org.coner</groupId>
                              <artifactId>build-tools</artifactId>
                              <version>1.0</version>
                          </dependency>
                          <dependency>
                              <groupId>com.puppycrawl.tools</groupId>
                              <artifactId>checkstyle</artifactId>
                              <version>6.19</version>
                          </dependency>
                      </dependencies>
                  </plugin>
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            littlewing4b8 James Short
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: