[ 
https://issues.apache.org/jira/browse/MPIR-478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17928781#comment-17928781
 ] 

ASF GitHub Bot commented on MPIR-478:
-------------------------------------

elharo commented on code in PR #97:
URL: 
https://github.com/apache/maven-project-info-reports-plugin/pull/97#discussion_r1963524553


##########
src/main/java/org/apache/maven/report/projectinfo/TeamReport.java:
##########
@@ -288,32 +334,13 @@ private void renderTeamMember(Contributor member, 
Map<String, Boolean> headersMa
             sink.tableRow_();
         }
 
-        private static final String AVATAR_SIZE = "s=60";
-
-        private String getSpacerGravatarUrl() {
-            return protocol + 
"://www.gravatar.com/avatar/00000000000000000000000000000000?d=blank&f=y&" + 
AVATAR_SIZE;
-        }
-
-        private String getGravatarUrl(String email) {
-            if (email == null) {
-                return null;
-            }
-            email = StringUtils.trim(email);
-            email = email.toLowerCase();
-            MessageDigest md;
+        private String getExternalAvatarUrl(String email) {

Review Comment:
   If breaking the build is the right answer — though I'm not sure it is — then 
that should happen higher up, likely with a MavenReportException or something 
like that. It shouldn't be a  runtime exception from deep inside the code, 
whihc would indicate a bug in the code. An avatar service being unreachable is 
not a bug in the code, so just use a regular IOException here. 



##########
src/main/java/org/apache/maven/report/projectinfo/TeamReport.java:
##########
@@ -83,9 +116,22 @@ public boolean canGenerateReport() throws 
MavenReportException {
     }
 
     @Override
-    public void executeReport(Locale locale) {
-        ProjectTeamRenderer r =
-                new ProjectTeamRenderer(getSink(), project.getModel(), 
getI18N(locale), locale, showAvatarImages);
+    public void executeReport(Locale locale) throws MavenReportException {
+        AvatarsProvider avatarsProvider = 
avatarsProviders.get(avatarProviderName);
+        if (avatarsProvider == null) {
+            throw new MavenReportException("No AvatarsProvider found for name 
" + avatarProviderName);

Review Comment:
   I suggest message then, and not breaking the report. You could also add a 
default image used when the server can't be reached.



##########
src/main/java/org/apache/maven/report/projectinfo/TeamReport.java:
##########
@@ -226,10 +276,7 @@ private void renderTeamMember(Contributor member, 
Map<String, Boolean> headersMa
                 Properties properties = member.getProperties();
                 String picUrl = properties.getProperty("picUrl");
                 if (picUrl == null || picUrl.isEmpty()) {
-                    picUrl = getGravatarUrl(member.getEmail());
-                }
-                if (picUrl == null || picUrl.isEmpty()) {
-                    picUrl = getSpacerGravatarUrl();
+                    picUrl = getExternalAvatarUrl(member.getEmail());

Review Comment:
   What if a user doesn't have an avatar? I don't think I do, for instance. 





> describe use of gravatar.com for profiles in team report
> --------------------------------------------------------
>
>                 Key: MPIR-478
>                 URL: https://issues.apache.org/jira/browse/MPIR-478
>             Project: Maven Project Info Reports Plugin
>          Issue Type: Improvement
>          Components: team
>    Affects Versions: 3.8.0
>            Reporter: Herve Boutemy
>            Assignee: Slawomir Jaranowski
>            Priority: Major
>             Fix For: 3.9.0
>
>
> like MARTIFACT-83, to clarify privacy implications
> see 
> https://github.com/apache/maven-project-info-reports-plugin/blob/master/src/main/java/org/apache/maven/report/projectinfo/TeamReport.java



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to