clean up code a little before attempting a bugfix

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@226476 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-07-30 05:59:30 +00:00
parent 3f2362e528
commit 475b0eb767
1 changed files with 49 additions and 54 deletions

View File

@ -75,14 +75,11 @@ public class DoxiaMojo
private static final String DEFAULT_TEMPLATE = RESOURCE_DIR + "/maven-site.vm";
/** OutputName of all project info report files generated by Maven */
private static final String[] PROJECT_INFO_FILES = new String[] { "integration",
"dependencies",
"issue-tracking",
"license",
"mail-lists",
"source-repository",
"team-list" };
/**
* OutputName of all project info report files generated by Maven
*/
private static final String[] PROJECT_INFO_FILES = new String[]{"integration", "dependencies", "issue-tracking",
"license", "mail-lists", "source-repository", "team-list"};
/**
* Patterns which should be excluded by default.
@ -363,7 +360,7 @@ public class DoxiaMojo
}
// Exception if a file is duplicate
if ( ( duplicate.entrySet() != null ) && ( duplicate.entrySet().size() > 0 ) )
if ( duplicate.size() > 0 )
{
StringBuffer sb = null;
@ -376,8 +373,9 @@ public class DoxiaMojo
{
if ( sb == null )
{
sb = new StringBuffer( "Some files are duplicates in the site directory or in the generated-site directory. "
+ "Review the following files:" );
sb = new StringBuffer(
"Some files are duplicates in the site directory or in the generated-site directory. " +
"Review the following files:" );
}
sb.append( "\n" ).append( entry.getKey() ).append( "\n" );
@ -457,8 +455,9 @@ public class DoxiaMojo
if ( parentProject != null )
{
// TODO Handle user plugin configuration
File parentSiteDir = new File( parentProject.getBasedir(), parentProject.getBuild().getDirectory()
+ File.separator + "site" + File.separator + project.getArtifactId() );
File parentSiteDir = new File( parentProject.getBasedir(),
parentProject.getBuild().getDirectory() + File.separator +
"site" + File.separator + project.getArtifactId() );
if ( !parentSiteDir.exists() )
{
@ -527,7 +526,8 @@ public class DoxiaMojo
return buffer.toString();
}
private void writeReportSubMenu( List reports, StringBuffer buffer, Locale locale, String key, String indexFilename )
private void writeReportSubMenu( List reports, StringBuffer buffer, Locale locale, String key,
String indexFilename )
{
if ( reports.size() > 0 )
{
@ -573,7 +573,9 @@ public class DoxiaMojo
buffer.append( " <item name=\"" );
buffer.append( module );
buffer.append( "\" href=\"" + module + "/index.html\"/>\n" );
buffer.append( "\" href=\"" );
buffer.append( module );
buffer.append( "/index.html\"/>\n" );
}
}
@ -653,7 +655,7 @@ public class DoxiaMojo
if ( addModules )
{
if ( ( project.getModules() != null ) && ( project.getModules().size() > 0 ) )
if ( project.getModules() != null && project.getModules().size() > 0 )
{
props.put( "modules", getModulesMenu( locale ) );
}
@ -1050,7 +1052,7 @@ public class DoxiaMojo
* @param directory the directory to scan
* @param duplicate the map to update
* @throws IOException if any
**/
*/
private static void tryToFindDuplicates( File directory, Map duplicate )
throws IOException
{
@ -1059,18 +1061,11 @@ public class DoxiaMojo
duplicate = new HashMap();
}
// The pattern as comma separated
StringBuffer excludePattern = new StringBuffer();
for ( int i = 0; i < DEFAULT_EXCLUDES.length; i++ )
{
excludePattern.append( DEFAULT_EXCLUDES[i] ).append( "," );
}
excludePattern.deleteCharAt( excludePattern.length() - 1 );
List siteFiles = FileUtils.getFileNames( directory, null, excludePattern.toString(), false );
String defaultExcludes = StringUtils.join( DEFAULT_EXCLUDES, "," );
List siteFiles = FileUtils.getFileNames( directory, null, defaultExcludes, false );
for ( Iterator it = siteFiles.iterator(); it.hasNext(); )
{
String currentFile = ( (String) it.next() );
String currentFile = (String) it.next();
if ( currentFile.lastIndexOf( File.separator ) == -1 )
{
@ -1089,8 +1084,8 @@ public class DoxiaMojo
String filePattern = "**/" + key + ".*";
List files = FileUtils.getFileNames( directory, filePattern, excludePattern.toString(), true );
if ( ( files != null ) && ( files.size() > 0 ) )
List files = FileUtils.getFileNames( directory, filePattern, defaultExcludes, true );
if ( files != null && files.size() > 0 )
{
List tmp = (List) duplicate.get( key.toLowerCase() );
if ( tmp == null )