Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-17034

NullPointerException when publishing Checkstyle results

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Component/s: checkstyle-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.503
      Maven 3.0.5
      maven-checkstyle-plugin 2.8
    • Similar Issues:

      Description

      I upgraded my version of the Checkstyle plugin from 3.32 to 3.34 and started getting NullPointerExceptions when building the Apache Shindig project.

      The exception is coming from code that was introduced by this changeset: https://github.com/jenkinsci/checkstyle-plugin/commit/e79892bdb3873059ab04ad1e0569311262353f4c

      My guess is that "mojo.getConfigurationValue("outputFile", String.class)" is null or empty. I'm not sure what that should be returning or how it gets set in the environment. Have I missed some newly required configuration?

      Here's the NPE:
      mavenExecutionResult exceptions not empty
      message : Internal error: java.lang.NullPointerException
      cause : null
      Stack trace :
      org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException
      at org.apache.maven.lifecycle.internal.BuilderCommon.handleBuildError(BuilderCommon.java:128)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:95)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
      at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
      at hudson.maven.Maven3Builder.call(Maven3Builder.java:100)
      at hudson.maven.Maven3Builder.call(Maven3Builder.java:66)
      at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:326)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
      Caused by: java.lang.NullPointerException
      at java.util.regex.Matcher.getTextLength(Matcher.java:1234)
      at java.util.regex.Matcher.reset(Matcher.java:308)
      at java.util.regex.Matcher.<init>(Matcher.java:228)
      at java.util.regex.Pattern.matcher(Pattern.java:1088)
      at hudson.FilePath.normalize(FilePath.java:250)
      at hudson.FilePath.<init>(FilePath.java:196)
      at hudson.plugins.checkstyle.CheckStyleReporter.getFileName(CheckStyleReporter.java:128)
      at hudson.plugins.checkstyle.CheckStyleReporter.perform(CheckStyleReporter.java:123)
      at hudson.plugins.analysis.core.HealthAwareReporter.postExecute(HealthAwareReporter.java:313)
      at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:453)
      at hudson.maven.Maven3Builder$MavenExecutionListener.mojoSucceeded(Maven3Builder.java:435)
      at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:87)
      at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:228)
      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:84)
      ... 24 more

        Attachments

          Activity

          Hide
          ssievers Stanton Sievers added a comment -

          Update: If the MojoInfo.getConfigurationValue is doing what I think it is doing, the code that's throwing the exception is trying to create a new FilePath for the value of "outputFile", as specified here: http://maven.apache.org/plugins/maven-checkstyle-plugin/checkstyle-mojo.html#outputFile

          This is an optional parameter according to the maven-checkstyle-plugin documentation and thus is not defined in my project. One solution may be to pass the defaultValue defined in the maven-checkstyle-plugin documentation to the MojoInfo.getConfigurationValue API. Another would be to check for null before trying to create a new FilePath.

          Show
          ssievers Stanton Sievers added a comment - Update: If the MojoInfo.getConfigurationValue is doing what I think it is doing, the code that's throwing the exception is trying to create a new FilePath for the value of "outputFile", as specified here: http://maven.apache.org/plugins/maven-checkstyle-plugin/checkstyle-mojo.html#outputFile This is an optional parameter according to the maven-checkstyle-plugin documentation and thus is not defined in my project. One solution may be to pass the defaultValue defined in the maven-checkstyle-plugin documentation to the MojoInfo.getConfigurationValue API. Another would be to check for null before trying to create a new FilePath.
          Hide
          drulli Ulli Hafner added a comment -

          Interesting, I thought that optional in maven means that if not defined then the default value will be returned...

          Show
          drulli Ulli Hafner added a comment - Interesting, I thought that optional in maven means that if not defined then the default value will be returned...
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/hudson/plugins/checkstyle/CheckStyleReporter.java
          http://jenkins-ci.org/commit/checkstyle-plugin/5c5b08d0e62229beee69a8cbbc3e8ca3c1d1cce8
          Log:
          [FIXED JENKINS-17034] Fixed NPE during guessing of result file path.


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/hudson/plugins/checkstyle/CheckStyleReporter.java http://jenkins-ci.org/commit/checkstyle-plugin/5c5b08d0e62229beee69a8cbbc3e8ca3c1d1cce8 Log: [FIXED JENKINS-17034] Fixed NPE during guessing of result file path. – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .
          Hide
          ssievers Stanton Sievers added a comment -

          I've verified that this is working on my Jenkins system after upgrading to org.jvnet.hudson.plugins:checkstyle:3.35.

          Show
          ssievers Stanton Sievers added a comment - I've verified that this is working on my Jenkins system after upgrading to org.jvnet.hudson.plugins:checkstyle:3.35.

            People

            • Assignee:
              drulli Ulli Hafner
              Reporter:
              ssievers Stanton Sievers
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: