Description
When I debugged build of my project I noticed that maven-enforcer-plugin generates lots of NPEs with this stack trace:
at java.util.ArrayList.addAll(ArrayList.java:702) at org.apache.maven.plugins.enforcer.RequirePluginVersions.getReportingPlugins(RequirePluginVersions.java:1062) at org.apache.maven.plugins.enforcer.RequirePluginVersions.getAllPluginEntries(RequirePluginVersions.java:970) at org.apache.maven.plugins.enforcer.RequirePluginVersions.execute(RequirePluginVersions.java:237) at org.apache.maven.plugins.enforcer.EnforceMojo.execute(EnforceMojo.java:199) - locked <0x1eb6> (a org.apache.maven.plugins.enforcer.RequirePluginVersions) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:301) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:165) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:157) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:121) at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:210) at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:195) at java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.lang.Thread.run(Thread.java:829)
Exceptions shouldn't be used for non-exceptional flow.
Also it's considered bad practice to return null from a method which returns collection. Empty collection should be returned instead.
Attachments
Issue Links
- links to