elharo commented on code in PR #97:
URL:
https://github.com/apache/maven-project-info-reports-plugin/pull/97#discussion_r1962539448
##########
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);
+ }
+ avatarsProvider.setBaseUrl(avatarBaseUrl);
+ avatarsProvider.setOutputDirectory(getReportOutputDirectory());
+
+ ProjectTeamRenderer r = new ProjectTeamRenderer(
Review Comment:
r --> renderer
##########
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:
This doesn't handle the exception, just pretends it's not going to happen.
Checked or unchecked it needs to be handled. I don't think it can be handled
here, so throw the IOException and handle a failure where it's called from.
##########
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 do you want to do here when getExternalAvatarUrl( fails and throws an
exception? Probably just don't call sink.figureGraphics below.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]