maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From micha...@apache.org
Subject svn commit: r1645346 - /maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
Date Sat, 13 Dec 2014 20:05:09 GMT
Author: michaelo
Date: Sat Dec 13 20:05:09 2014
New Revision: 1645346

URL: http://svn.apache.org/r1645346
Log:
Set license name to Unnamed in dep report if no name has been provided and append comma if
there is more than one license.

Modified:
    maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java?rev=1645346&r1=1645345&r2=1645346&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
(original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
Sat Dec 13 20:05:09 2014
@@ -1031,10 +1031,18 @@ public class DependenciesRenderer
                 sink.bold_();
                 if ( !licenses.isEmpty() )
                 {
-                    for ( License element : licenses )
+
+                    for ( Iterator<License> it = licenses.iterator(); it.hasNext();
)
                     {
-                        String licenseName = element.getName();
-                        String licenseUrl = element.getUrl();
+                        License license = it.next();
+
+                        String licenseName = license.getName();
+                        if ( StringUtils.isEmpty( licenseName ) )
+                        {
+                            licenseName = getI18nString( "unnamed" );
+                        }
+
+                        String licenseUrl = license.getUrl();
 
                         if ( licenseUrl != null )
                         {
@@ -1047,6 +1055,11 @@ public class DependenciesRenderer
                             sink.link_();
                         }
 
+                        if ( it.hasNext() )
+                        {
+                            sink.text( ", " );
+                        }
+
                         licenseMap.put( licenseName, artifactName );
                     }
                 }
@@ -1105,12 +1118,13 @@ public class DependenciesRenderer
         for ( Map.Entry<String, Object> entry : licenseMap.entrySet() )
         {
             String licenseName = entry.getKey();
-            sink.paragraph();
-            sink.bold();
             if ( StringUtils.isEmpty( licenseName ) )
             {
                 licenseName = getI18nString( "unnamed" );
             }
+
+            sink.paragraph();
+            sink.bold();
             sink.text( licenseName );
             sink.text( ": " );
             sink.bold_();



Mime
View raw message