[ 
https://issues.apache.org/jira/browse/MCHECKSTYLE-287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16062271#comment-16062271
 ] 

Michael Osipov commented on MCHECKSTYLE-287:
--------------------------------------------

Something seems to be wrong here:

{noformat}
PS D:\Entwicklung\Projekte\mcheckstyle-287-demo> mvn clean install
[INFO] Scanning for projects...
[WARNING] The project mcheckstyle-issue-287:parent:pom:1.0-SNAPSHOT uses 
prerequisites which is only intended for maven-plugin projects but not for non 
maven-plugin projects. For such purposes you should use the 
maven-enforcer-plugin. See 
https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Reproduce issue MCHECKSTYLE-287
[INFO] Custom checkstyle rules
[INFO] Dummy project code
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Reproduce issue MCHECKSTYLE-287 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ parent ---
[INFO]
[INFO] --- maven-checkstyle-plugin:2.17:check (checkstyle-validation) @ parent 
---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Reproduce issue MCHECKSTYLE-287 .................... FAILURE [  0.531 s]
[INFO] Custom checkstyle rules ............................ SKIPPED
[INFO] Dummy project code ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.630 s
[INFO] Finished at: 2017-06-25T11:21:30+02:00
[INFO] Final Memory: 9M/241M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check 
(checkstyle-validation) on project parent: Execution checkstyle-validation of 
goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check failed: Plugin 
org.apache.maven.plugins:maven-checkstyle-plugin:2.17 or one of its 
dependencies could not be resolved: Failure to find 
mcheckstyle-issue-287:csrules:jar:1.0-SNAPSHOT in 
http://repository.apache.org/snapshots was cached in the local repository, 
resolution will not be reattempted until the update interval of 
apache.snapshots has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
{noformat}

> checkstyle report throws NPE
> ----------------------------
>
>                 Key: MCHECKSTYLE-287
>                 URL: https://issues.apache.org/jira/browse/MCHECKSTYLE-287
>             Project: Maven Checkstyle Plugin
>          Issue Type: Bug
>    Affects Versions: 2.13, 2.14
>            Reporter: Thomas Scheffler
>         Attachments: mcheckstyle-287-demo.tgz, patch1.diff, projects.tar.gz
>
>
> I don't know what triggers this bug. Somehow 
> org.apache.maven.plugin.checkstyle.AbstractCheckstyleReport.collectArtifacts(String)
>  produces a List which contains the null object. And therefor an exception is 
> thrown here (2.14):
> {noformat}
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project 
> oaipmh: Execution default-site of goal 
> org.apache.maven.plugins:maven-site-plugin:3.3:site failed. 
> NullPointerException -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
> goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on 
> project oaipmh: Execution default-site of goal 
> org.apache.maven.plugins:maven-site-plugin:3.3:site failed.
>       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:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       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-site of goal org.apache.maven.plugins:maven-site-plugin:3.3:site 
> failed.
>       at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
>       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
>       ... 19 more
> Caused by: java.lang.NullPointerException
>       at 
> org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor.configureResourceLocator(DefaultCheckstyleExecutor.java:852)
>       at 
> org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor.executeCheckstyle(DefaultCheckstyleExecutor.java:102)
>       at 
> org.apache.maven.plugin.checkstyle.AbstractCheckstyleReport.executeReport(AbstractCheckstyleReport.java:474)
>       at 
> org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:156)
>       at 
> org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:255)
>       at 
> org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:219)
>       at 
> org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(DefaultSiteRenderer.java:319)
>       at 
> org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:135)
>       at 
> org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:175)
>       at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:138)
>       at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
>       ... 20 more
> {noformat}
> Looking at the code, you see a null check is done for the list, bit not for 
> elements of that list:
> {noformat}
>         // MCHECKSTYLE-225: load licenses from additional artifacts, not from 
> classpath
>         if ( additionalArtifacts != null )
>         {
>             for ( Artifact licenseArtifact : additionalArtifacts )
>             {
>                 try
>                 {
>                     resourceManager.addSearchPath( "jar", "jar:" + 
> licenseArtifact.getFile().toURI().toURL() );
>                 }
>                 catch ( MalformedURLException e )
>                 {
>                     // noop
>                 }
>             }
>         }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to