From 4e7dca56c654536bfea833805cd0ee0b512c182f Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Wed, 5 Oct 2005 01:51:48 +0000 Subject: [PATCH] PR: MNG-1046 fixes for the mailing list page git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@294969 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven-project-info-reports-plugin/pom.xml | 4 +-- .../projectinfo/MailingListsReport.java | 35 +++++++++++++------ .../AbstractMavenReportRenderer.java | 4 ++- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/maven-plugins/maven-project-info-reports-plugin/pom.xml b/maven-plugins/maven-project-info-reports-plugin/pom.xml index f2ed0be987..923dbd4937 100644 --- a/maven-plugins/maven-project-info-reports-plugin/pom.xml +++ b/maven-plugins/maven-project-info-reports-plugin/pom.xml @@ -57,7 +57,7 @@ org.apache.maven.reporting maven-reporting-impl - 2.0-beta-1 + 2.0-beta-4-SNAPSHOT org.apache.maven.scm @@ -80,4 +80,4 @@ 1.0-alpha-2 - \ No newline at end of file + diff --git a/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java b/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java index b24e0a1243..7989f6b764 100644 --- a/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java +++ b/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java @@ -26,7 +26,6 @@ import org.codehaus.doxia.sink.Sink; import org.codehaus.doxia.site.renderer.SiteRenderer; import org.codehaus.plexus.util.StringUtils; -import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -44,7 +43,7 @@ public class MailingListsReport { /** * Report output directory. - * + * * @parameter expression="${project.build.directory}/site" * @required */ @@ -52,7 +51,7 @@ public class MailingListsReport /** * Doxia Site Renderer. - * + * * @parameter expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}" * @required * @readonly @@ -61,7 +60,7 @@ public class MailingListsReport /** * The Maven Project. - * + * * @parameter expression="${project}" * @required * @readonly @@ -205,11 +204,11 @@ public class MailingListsReport if ( otherArchives ) { - tableHeader( new String[] { name, subscribe, unsubscribe, post, archive, archivesOther } ); + tableHeader( new String[]{name, subscribe, unsubscribe, post, archive, archivesOther} ); } else { - tableHeader( new String[] { name, subscribe, unsubscribe, post, archive } ); + tableHeader( new String[]{name, subscribe, unsubscribe, post, archive} ); } for ( Iterator i = model.getMailingLists().iterator(); i.hasNext(); ) @@ -225,10 +224,24 @@ public class MailingListsReport textRow.add( createLinkPatternedText( unsubscribe, mailingList.getUnsubscribe() ) ); - textRow.add( createLinkPatternedText( post, mailingList.getPost() ) ); + if ( mailingList.getPost() != null && mailingList.getPost().length() > 0 ) + { + textRow.add( createLinkPatternedText( post, mailingList.getPost() ) ); + } + else + { + textRow.add( "-" ); + } - textRow.add( createLinkPatternedText( getArchiveServer( mailingList.getArchive() ), mailingList - .getArchive() ) ); + if ( mailingList.getArchive() != null && mailingList.getArchive().length() > 0 ) + { + textRow.add( createLinkPatternedText( getArchiveServer( mailingList.getArchive() ), + mailingList.getArchive() ) ); + } + else + { + textRow.add( "-" ); + } if ( ( ( mailingList.getOtherArchives() != null ) ) && ( !mailingList.getOtherArchives().isEmpty() ) ) { @@ -296,7 +309,7 @@ public class MailingListsReport * For instance, if the archive uri is * http://www.mail-archive.com/dev@maven.apache.org, this * method return www.mail-archive.com - * + * * @param uri * @return the server name of a web-based mailing list archive server */ @@ -304,7 +317,7 @@ public class MailingListsReport { if ( StringUtils.isEmpty( uri ) ) { - return "???UNKWOWN???"; + return "???UNKNOWN???"; } int at = uri.indexOf( "//" ); diff --git a/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java b/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java index bbbcea7eb6..1ec8048617 100644 --- a/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java +++ b/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java @@ -456,7 +456,9 @@ public abstract class AbstractMavenReportRenderer String[] schemes = {"http", "https"}; UrlValidator urlValidator = new UrlValidator( schemes ); - if ( EmailValidator.getInstance().isValid( href ) ) + if ( ( EmailValidator.getInstance().isValid( href ) ) || + ( ( href.indexOf( "?" ) != -1 ) && + ( EmailValidator.getInstance().isValid( href.substring( 0, href.indexOf( "?" ) ) ) ) ) ) { return "mailto:" + href; }