You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2006/11/03 00:16:41 UTC
svn commit: r470591 -
/maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
Author: dennisl
Date: Thu Nov 2 15:16:40 2006
New Revision: 470591
URL: http://svn.apache.org/viewvc?view=rev&rev=470591
Log:
o Make sure that the URLs for "mailing-list" and "download-page" don't have two slashes after each other in them.
Modified:
maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
Modified: maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java?view=diff&rev=470591&r1=470590&r2=470591
==============================================================================
--- maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java (original)
+++ maven/plugins/trunk/maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java Thu Nov 2 15:16:40 2006
@@ -72,6 +72,7 @@
/**
* The language which should be displayed in the DOAP file. The POM doesn't have any
* notions of language yet.
+ *
* @parameter expression="${language}" default-value="Java"
*/
private String language;
@@ -150,8 +151,8 @@
element( "shortdesc", project.getDescription() );
element( "description", project.getDescription() );
rdfResourceElement( "bug-database", project.getIssueManagement().getUrl() );
- rdfResourceElement( "mailing-list", project.getUrl() + "/mail-lists.html" );
- rdfResourceElement( "download-page", project.getUrl() + "/download.html" );
+ rdfResourceElement( "mailing-list", composeUrl( project.getUrl() , "/mail-lists.html" ) );
+ rdfResourceElement( "download-page", composeUrl( project.getUrl() , "/download.html" ) );
element( "programming-language", language );
//TODO: how to lookup category, map it, or just declare it.
rdfResourceElement( "category", "http://projects.apache.org/category/" + category );
@@ -247,6 +248,26 @@
rdfResourceElement( "foaf:mbox", "mailto:" + d.getEmail() );
w.endElement();
w.endElement();
+ }
+ }
+
+ /**
+ * Compose a URL from two parts: a base URL and a file path. This method
+ * makes sure that there will not be two slash '/' characters after each
+ * other.
+ *
+ * @param base The base URL
+ * @param path The file
+ */
+ private String composeUrl( String base, String path )
+ {
+ if ( base.endsWith( "/" ) && path.startsWith( "/" ) )
+ {
+ return base + path.substring( 1 );
+ }
+ else
+ {
+ return base + path;
}
}
}