You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@creadur.apache.org by sebb <se...@gmail.com> on 2014/08/11 00:53:26 UTC
Re: svn commit: r1617162 - /creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
On 10 August 2014 22:15, <po...@apache.org> wrote:
> Author: pottlinger
> Date: Sun Aug 10 21:15:56 2014
> New Revision: 1617162
>
> URL: http://svn.apache.org/r1617162
> Log:
> 0.11: NPE-fix
>
> Always ensuring that a list of repositories is existing in case its null.
> Possibly this is a change in the API induced by dependency updates.
>
> Stacktrace was:
> Caused by: java.lang.NullPointerException
> at org.apache.rat.mp.RatReportMojo.getSkinArtifactFile(RatReportMojo.java:114)
> at org.apache.rat.mp.RatReportMojo.execute(RatReportMojo.java:204)
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>
>
> Modified:
> creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
>
> Modified: creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
> URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java?rev=1617162&r1=1617161&r2=1617162&view=diff
> ==============================================================================
> --- creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java (original)
> +++ creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java Sun Aug 10 21:15:56 2014
> @@ -52,8 +52,10 @@ import java.io.IOException;
> import java.io.PrintWriter;
> import java.io.StringWriter;
> import java.io.Writer;
> +import java.util.Collections;
> import java.util.HashMap;
> import java.util.Iterator;
> +import java.util.List;
> import java.util.Locale;
> import java.util.Map;
> import java.util.ResourceBundle;
> @@ -111,7 +113,15 @@ public class RatReportMojo extends Abstr
> factory.createDependencyArtifact( skin.getGroupId(), skin.getArtifactId(), versionSpec, "jar", null,
> null );
>
> - resolver.resolve( artifact, getProject().getRemoteArtifactRepositories(), localRepository );
> + // FIXME Try to avoid NPE / found during 0.11-build checks
> + // API is so old/without type information
> + @SuppressWarnings("unchecked")
> + List<ArtifactRepository> remoteArtifactRepositories = getProject().getRemoteArtifactRepositories();
Fails with NPE - likely because getProject() is null - same issue as
I'd already discovered.
> + if(remoteArtifactRepositories == null) {
> + remoteArtifactRepositories = Collections.emptyList();
> + }
> +
> + resolver.resolve( artifact, remoteArtifactRepositories, localRepository );
> }
> catch ( InvalidVersionSpecificationException e )
> {
>
>
Re: svn commit: r1617162 - /creadur/rat/trunk/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
Posted by "P. Ottlinger" <po...@aiki-it.de>.
Hi *,
Am 11.08.2014 um 00:53 schrieb sebb:
> Fails with NPE - likely because getProject() is null - same issue as
> I'd already discovered.
That's rather strange .... I've replaced the injection of project in
AbstractRatMojo:
//@Parameter(name = "project", readonly = true)
@Component
private MavenProject project;
@Sebb: can you verify if that (r1617203) fixes the problem with your
projects?
I'm not sure how to solve
https://issues.apache.org/jira/browse/RAT-168
-one should invoke maven directly?
-or just check that project is not null in an integration test?
What do you think?
Thanks
Phil