maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From micha...@apache.org
Subject svn commit: r1777717 - /maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java
Date Fri, 06 Jan 2017 21:09:39 GMT
Author: michaelo
Date: Fri Jan  6 21:09:39 2017
New Revision: 1777717

URL: http://svn.apache.org/viewvc?rev=1777717&view=rev
Log:
[MPIR-352] Use protocol-agnostic URL for Gravatar

Submitted-by: Eric Barboni <skygo@apache.org>

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

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java?rev=1777717&r1=1777716&r2=1777717&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java
(original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java
Fri Jan  6 21:09:39 2017
@@ -139,6 +139,8 @@ public class TeamReport
 
         private final boolean showAvatarImages;
 
+        private final String protocol;
+
         ProjectTeamRenderer( Sink sink, Model model, I18N i18n, Locale locale, Log log, boolean
showAvatarImages )
         {
             super( sink, i18n, locale );
@@ -146,6 +148,16 @@ public class TeamReport
             this.model = model;
             this.log = log;
             this.showAvatarImages = showAvatarImages;
+
+            // prepare protocol for gravatar
+            if ( model.getUrl() != null && model.getUrl().startsWith( "https://"
) )
+            {
+                this.protocol = "https";
+        }
+            else
+            {
+                this.protocol = "http";
+            }
         }
 
         @Override
@@ -336,7 +348,7 @@ public class TeamReport
 
         private String getSpacerGravatarUrl()
         {
-            return "http://www.gravatar.com/avatar/00000000000000000000000000000000?d=blank&f=y&"
+ AVATAR_SIZE;
+            return protocol + "://www.gravatar.com/avatar/00000000000000000000000000000000?d=blank&f=y&"
+ AVATAR_SIZE;
         }
 
         private String getGravatarUrl( String email )
@@ -359,7 +371,7 @@ public class TeamReport
                 {
                     sb.append( Integer.toString( ( aByteData & lowerEightBitsOnly ) +
0x100, 16 ).substring( 1 ) );
                 }
-                return "http://www.gravatar.com/avatar/" + sb.toString() + "?d=mm&" +
AVATAR_SIZE;
+                return protocol + "://www.gravatar.com/avatar/" + sb.toString() + "?d=mm&"
+ AVATAR_SIZE;
             }
             catch ( NoSuchAlgorithmException e )
             {



Mime
View raw message