From cbb5657526f1fd8c29d13a32d7214e3f59b77aa1 Mon Sep 17 00:00:00 2001 From: Vincent Siveton Date: Tue, 26 Jul 2005 12:33:12 +0000 Subject: [PATCH] MNG-588: Throw an exception if two index files already exist git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@225290 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/maven/doxia/DoxiaMojo.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java b/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java index 7c3b71e6da..9baa9a032b 100644 --- a/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java +++ b/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java @@ -560,10 +560,20 @@ public boolean accept( File file ) if ( indexFound.size() > 1 ) { - // TODO throw an Exception? - getLog().warn( "More than one index file exists in the project site directory. Checks the result." ); - return true; + StringBuffer sb = new StringBuffer( "\n" ); + for ( Iterator it = indexFound.iterator(); it.hasNext(); ) + { + sb.append( " * " ); + sb.append( ( (File) it.next() ).getAbsolutePath() ); + if ( it.hasNext() ) + { + sb.append( "\n" ); + } + } + throw new MavenReportException( "More than one index file exists in the project site directory. " + + "You have to delete one of these files: " + sb.toString() ); } + if ( indexFound.size() == 1 ) { getLog().warn( "One index file was found in the project site directory." );