Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException @ ClirrReportGenerator.java:64 #7

Closed
mpkorstanje opened this issue Nov 13, 2015 · 5 comments · Fixed by #13
Closed

NullPointerException @ ClirrReportGenerator.java:64 #7

mpkorstanje opened this issue Nov 13, 2015 · 5 comments · Fixed by #13

Comments

@mpkorstanje
Copy link

While running mvn clean site -X with the following configuration for clirr

<reporting>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>clirr-maven-plugin</artifactId>
            <version>2.7</version>
        </plugin>
    </plugins>
</reporting>

I run into the following null pointer exception.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project simmetrics-core: 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 simmetrics-core: 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: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)
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:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 20 more
Caused by: java.lang.NullPointerException
    at org.codehaus.mojo.clirr.ClirrReportGenerator$ApiChangeComparator.compare(ClirrReportGenerator.java:64)
    at org.codehaus.mojo.clirr.ClirrReportGenerator$ApiChangeComparator.compare(ClirrReportGenerator.java:57)
    at java.util.TimSort.binarySort(TimSort.java:292)
    at java.util.TimSort.sort(TimSort.java:235)
    at java.util.Arrays.sort(Arrays.java:1438)
    at java.util.List.sort(List.java:478)
    at java.util.Collections.sort(Collections.java:175)
    at org.codehaus.mojo.clirr.ClirrReportGenerator.doApiChangesTable(ClirrReportGenerator.java:600)
    at org.codehaus.mojo.clirr.ClirrReportGenerator.doApiChanges(ClirrReportGenerator.java:453)
    at org.codehaus.mojo.clirr.ClirrReportGenerator.generateReport(ClirrReportGenerator.java:186)
    at org.codehaus.mojo.clirr.ClirrReport.doReport(ClirrReport.java:316)
    at org.codehaus.mojo.clirr.ClirrReport.generate(ClirrReport.java:227)
    at org.codehaus.mojo.clirr.ClirrReport.generate(ClirrReport.java:363)
    at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:228)
    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:134)
    ... 21 more

If I knew what API changed caused it I'd provide a minimal example. Best I can do currently is provide my current project:

https://github.com/Simmetrics/simmetrics/tree/feature-v4.0.0

Call with mvn clean site -P reports -X

@AnEmortalKid
Copy link

I ran into this same issue too, I think it happens when you have new stuff in a file (https://github.com/mojohaus/clirr-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/clirr/ClirrReportGenerator.java). I think the from for the ApiChange gets initialized to null.

If it helps any, I reverted back to 2.6.2 and things started building.

@brandonheck
Copy link

I'm also running into this issue. Strangely, running the clirr goal by itself (mvn org.codehaus.mojo:clirr-maven-plugin:2.7:clirr) succeeds.

The change that I'm seeing show up (which I expect) is that a protected method was removed from a class. I don't suspect this to be the cause, however, since running the goal stand-alone succeeds.

@brandonheck
Copy link

I take that back; I think I had bumped my dependency version down (per the suggestion from @AnEmortalKid) and then tried running the stand-alone goal without cleaning the directory.

I think I may have found the root cause: I have a class that changed to an enum (went from Java 4 to Java 6) and the Message id is 5000, which it looks like the plugin doesn't recognize.

I can't guarantee that this is what is causing the NPE, but definitely looks suspicious.

@brandonheck
Copy link

If I remove the clirr-maven-plugin from the build section and run the standalone clirr goal (only configured in the reporting section in the pom), it succeeds! The plot thickens...

@brandonheck
Copy link

Debugging more, it is definitely related to the Message id 5000 (added class to superclasses). The APIChange does not have a from because the APIDifference for that does not have an affected method or affected field.

APIChange is new with version 2.7 and seems to be the root of the problem, as it only handles method and field changes, but not a subset of the other changes that clirr-core recognizes.

brandonheck pushed a commit to brandonheck/clirr-maven-plugin that referenced this issue Mar 17, 2016
Quick fix for NullPointerException - fixes mojohaus#7
@olamy olamy closed this as completed in #13 Mar 18, 2016
sbordet added a commit to jetty/jetty.project that referenced this issue Jun 13, 2016
asfgit pushed a commit to apache/commons-jcs that referenced this issue Sep 26, 2016
asfgit pushed a commit to apache/commons-rng that referenced this issue Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants