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

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_r1962763705


##########
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:
   Would it make sense to instead simply not show avatars in the report? 



##########
src/main/java/org/apache/maven/report/projectinfo/avatars/GravatarProvider.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.report.projectinfo.avatars;
+
+import javax.inject.Named;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Locale;
+
+import org.codehaus.plexus.util.IOUtil;
+
+/**
+ * Provider for user avatar from gravatar.com
+ * <p>
+ * <a href="https://docs.gravatar.com/api/avatars/images/";>Gravatar API</a>
+ */
+@Named("gravatar")
+class GravatarProvider implements AvatarsProvider {
+
+    private static final String AVATAR_SIZE = "s=60";
+
+    private static final String AVATAR_DIRECTORY = "avatars";
+
+    private String baseUrl = "https://www.gravatar.com/avatar/";;
+
+    private Path outputDirectory;
+
+    @Override
+    public void setBaseUrl(String baseUrl) {
+        this.baseUrl = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
+    }
+
+    @Override
+    public void setOutputDirectory(File outputDirectory) {
+        this.outputDirectory = outputDirectory.toPath();
+    }
+
+    public String getExternalAvatarUrl(String email) {
+
+        if (email == null || email.isEmpty()) {
+            return getSpacerGravatarUrl();
+        }
+
+        email = email.trim().toLowerCase(Locale.ROOT);
+        MessageDigest md;

Review Comment:
   This can move into the try block, I think. 





> 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