[ 
http://jira.codehaus.org/browse/MPIR-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=151301#action_151301
 ] 
Jörgen Rydenius commented on MPIR-131:
--------------------------------------

I encountered the same problem. I do not think that blacklisted repositories 
are the problem, I think it is declared repositories that do not host *any* of 
the dependency artifacts. Blacklisted repositories are filtered out before 
reaching DependenciesRenderer.java:1182. I do not have a test case to provide, 
but suggest the following patch that completely solved this problem for me:

{{
Index: 
src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
===================================================================
--- 
src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
   (revision 706043)
+++ 
src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
   (working copy)
@@ -1178,8 +1178,8 @@
         for ( Iterator itrepo = repoIdList.iterator(); itrepo.hasNext(); )
         {
             String repokey = (String) itrepo.next();
-
-            totalRow[idnum++] = totalByRepo.get( repokey ).toString();
+            Integer dependencies = (Integer) totalByRepo.get( repokey );
+            totalRow[idnum++] = dependencies != null ? dependencies.toString() 
: "0";
         }

         tableRow( totalRow );
}}

> NPE in printArtifactsLocations() for blacklisted repo
> -----------------------------------------------------
>
>                 Key: MPIR-131
>                 URL: http://jira.codehaus.org/browse/MPIR-131
>             Project: Maven 2.x Project Info Reports Plugin
>          Issue Type: Bug
>          Components: dependencies
>    Affects Versions: 2.1
>         Environment: Linux (Sun JDK 1.6), Windows (IBM VM 1.4). No direct 
> Internet access; going through local Artifactory repository.
>            Reporter: Klaus Brunner
>            Priority: Critical
>
> I'm getting NPEs when running the reports plugin at this location:
> [INFO] Generating "Dependencies" report.
> [WARNING] The repository url 'http://repo1.maven.org/maven2' is invalid - 
> Repository 'central' will be blacklisted.
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] null
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Trace
> java.lang.NullPointerException
>       at 
> org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.printArtifactsLocations(DependenciesRenderer.java:1182)
>       at 
> org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderSectionDependencyRepositoryLocations(DependenciesRenderer.java:641)
>       at 
> org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderBody(DependenciesRenderer.java:274)
>       at 
> org.apache.maven.reporting.AbstractMavenReportRenderer.render(AbstractMavenReportRenderer.java:65)
>       at 
> org.apache.maven.report.projectinfo.DependenciesReport.executeReport(DependenciesReport.java:239)
> Taking a brief look with the debugger, it appears that the totalByRepo map in 
> DependenciesRenderer.printArtifactsLocations() is empty - so looking up any 
> entry will of course return null and result in an NPE here:
>             totalRow[idnum++] = totalByRepo.get( repokey ).toString();
> Note that this used to work fine before the 2.1 release.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to