Return-Path: Delivered-To: apmail-maven-commits-archive@www.apache.org Received: (qmail 39370 invoked from network); 20 Jan 2011 10:34:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Jan 2011 10:34:52 -0000 Received: (qmail 74492 invoked by uid 500); 20 Jan 2011 10:34:52 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 74287 invoked by uid 500); 20 Jan 2011 10:34:47 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 74280 invoked by uid 99); 20 Jan 2011 10:34:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jan 2011 10:34:47 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jan 2011 10:34:44 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8F4162388999; Thu, 20 Jan 2011 10:34:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1061198 - /maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java Date: Thu, 20 Jan 2011 10:34:23 -0000 To: commits@maven.apache.org From: ltheussl@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110120103423.8F4162388999@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ltheussl Date: Thu Jan 20 10:34:23 2011 New Revision: 1061198 URL: http://svn.apache.org/viewvc?rev=1061198&view=rev Log: simplify code Modified: maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java Modified: maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java?rev=1061198&r1=1061197&r2=1061198&view=diff ============================================================================== --- maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java (original) +++ maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java Thu Jan 20 10:34:23 2011 @@ -357,11 +357,7 @@ public class DefaultSiteTool dir = "src/site"; } - Locale llocale = locale; - if ( llocale == null ) - { - llocale = new Locale( "" ); - } + final Locale llocale = ( locale == null ) ? new Locale( "" ) : locale; File siteDir = new File( basedir, dir ); @@ -392,11 +388,7 @@ public class DefaultSiteTool throw new IllegalArgumentException( "The parameter 'remoteArtifactRepositories' can not be null" ); } - Locale llocale = locale; - if ( llocale == null ) - { - llocale = new Locale( "" ); - } + final Locale llocale = ( locale == null ) ? new Locale( "" ) : locale; try { @@ -450,11 +442,7 @@ public class DefaultSiteTool throw new IllegalArgumentException( "The parameter 'outputEncoding' can not be null" ); } - Locale llocale = locale; - if ( llocale == null ) - { - llocale = Locale.getDefault(); - } + final Locale llocale = ( locale == null ) ? Locale.getDefault() : locale; Map props = new HashMap( 2 ); @@ -529,16 +517,15 @@ public class DefaultSiteTool throw new IllegalArgumentException( "The parameter 'categories' can not be null" ); } - Locale llocale = locale; - if ( llocale == null ) + Menu menu = decorationModel.getMenuRef( "reports" ); + + if ( menu == null ) { - llocale = Locale.getDefault(); + return; } - Menu menu = decorationModel.getMenuRef( "reports" ); + final Locale llocale = ( locale == null ) ? Locale.getDefault() : locale; - if ( menu != null ) - { if ( menu.getName() == null ) { menu.setName( i18n.getString( "site-tool", llocale, "decorationModel.menu.projectdocumentation" ) ); @@ -571,7 +558,6 @@ public class DefaultSiteTool { decorationModel.removeMenuRef( "reports" ); } - } } /** {@inheritDoc} */ @@ -749,12 +735,6 @@ public class DefaultSiteTool throw new IllegalArgumentException( "The parameter 'parentProject' can not be null" ); } - Locale llocale = locale; - if ( llocale == null ) - { - llocale = Locale.getDefault(); - } - Menu menu = decorationModel.getMenuRef( "parent" ); if ( menu == null ) @@ -762,8 +742,13 @@ public class DefaultSiteTool return; } - if ( !keepInheritedRefs || !menu.isInheritAsRef() ) + if ( keepInheritedRefs && menu.isInheritAsRef() ) { + return; + } + + final Locale llocale = ( locale == null ) ? Locale.getDefault() : locale; + String parentUrl = parentProject.getUrl(); if ( parentUrl != null ) @@ -810,7 +795,6 @@ public class DefaultSiteTool item.setHref( parentUrl ); menu.addItem( item ); } - } } /** @@ -861,12 +845,6 @@ public class DefaultSiteTool throw new IllegalArgumentException( "The parameter 'decorationModel' can not be null" ); } - Locale llocale = locale; - if ( llocale == null ) - { - llocale = Locale.getDefault(); - } - Menu menu = decorationModel.getMenuRef( "modules" ); if ( menu == null ) @@ -874,8 +852,13 @@ public class DefaultSiteTool return; } - if ( !keepInheritedRefs || !menu.isInheritAsRef() ) + if ( keepInheritedRefs && menu.isInheritAsRef() ) { + return; + } + + final Locale llocale = ( locale == null ) ? Locale.getDefault() : locale ; + // we require child modules and reactors to process module menu if ( project.getModules().size() > 0 ) { @@ -923,7 +906,6 @@ public class DefaultSiteTool // only remove if project has no modules AND menu is not inherited, see MSHARED-174 decorationModel.removeMenuRef( "modules" ); } - } } /** {@inheritDoc} */