Author: vsiveton
Date: Fri May 8 10:16:49 2009
New Revision: 772915
URL: http://svn.apache.org/viewvc?rev=772915&view=rev
Log:
o clash if filepath is duplicated in module (similar logic from
DefaultSiteRenderer)
Modified:
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java
Modified:
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java
URL:
http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java?rev=772915&r1=772914&r2=772915&view=diff
==============================================================================
---
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java
(original)
+++
maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/AbstractDocumentRenderer.java
Fri May 8 10:16:49 2009
@@ -26,6 +26,7 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
@@ -162,9 +163,10 @@
* This should follow the standard Maven convention, ie
containing all the site modules.
* @return a Map of files to process.
* @throws java.io.IOException in case of a problem reading the files
under baseDirectory.
+ * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if
any
*/
public Map getFilesToProcess( File baseDirectory )
- throws IOException
+ throws IOException, DocumentRendererException
{
if ( !baseDirectory.isDirectory() )
{
@@ -178,7 +180,8 @@
setBaseDir( baseDirectory.getAbsolutePath() );
- Map filesToProcess = new HashMap();
+ Map filesToProcess = new LinkedHashMap();
+ Map duplicatesFiles = new LinkedHashMap();
for ( Iterator i = siteModuleManager.getSiteModules().iterator();
i.hasNext(); )
{
@@ -206,7 +209,21 @@
for ( Iterator j = docs.iterator(); j.hasNext(); )
{
- String filePath = ( (File) j.next() ).getPath();
+ String filePath = j.next().toString().trim();
+
+ if ( filePath.lastIndexOf( "." ) > 0 )
+ {
+ String key = filePath.substring( 0,
filePath.lastIndexOf( "." ) );
+
+ if ( duplicatesFiles.containsKey( key ) )
+ {
+ throw new DocumentRendererException( "Files '" +
module.getSourceDirectory()
+ + File.separator + filePath + "' clashes with
existing '"
+ + duplicatesFiles.get( key ) + "'." );
+ }
+
+ duplicatesFiles.put( key, module.getSourceDirectory()
+ File.separator + filePath );
+ }
filesToProcess.put( filePath, module );
}