continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r765355 [3/5] - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/taskqueue/ continuum-api/src/main/java/org/apache/continuum/utils/shell/ continuum-api/src/main/java/org/apache/maven/continuum/build/settings/ continuum-...
Date Wed, 15 Apr 2009 20:59:11 GMT
Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java Wed Apr 15 20:59:07 2009
@@ -19,6 +19,11 @@
  * under the License.
  */
 
+import java.io.File;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.utils.ContinuumUtils;
@@ -34,11 +39,6 @@
 import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 
-import java.io.File;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -114,7 +114,7 @@
 
         context.put( KEY_BUILD_ID, Integer.toString( buildResult.getId() ) );
 
-        context.put( KEY_CANCELLED, new Boolean( false ) );
+        context.put( KEY_CANCELLED, false );
 
         buildResult = buildResultDao.getBuildResult( buildResult.getId() );
 
@@ -133,10 +133,10 @@
         catch ( ContinuumBuildCancelledException e )
         {
             getLogger().info( "Cancelled build" );
-            
+
             buildResult.setState( ContinuumProjectState.CANCELLED );
-            
-            context.put( KEY_CANCELLED, new Boolean( true ) );
+
+            context.put( KEY_CANCELLED, true );
         }
         catch ( Throwable e )
         {
@@ -156,7 +156,7 @@
 
                 project.setOldState( 0 );
 
-                int buildResultId = getOldBuildId( context ); 
+                int buildResultId = getOldBuildId( context );
 
                 project.setLatestBuildId( buildResultId );
 
@@ -187,9 +187,9 @@
                 // ----------------------------------------------------------------------
                 // Copy over the buildResult result
                 // ----------------------------------------------------------------------
-    
+
                 buildResultDao.updateBuildResult( buildResult );
-    
+
                 buildResult = buildResultDao.getBuildResult( buildResult.getId() );
 
                 notifier.goalsCompleted( project, buildDefinition, buildResult );

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectGroupAction.java Wed Apr 15 20:59:07 2009
@@ -19,13 +19,13 @@
  * under the License.
  */
 
+import java.util.Map;
+
 import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 
-import java.util.Map;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -51,6 +51,6 @@
 
         projectGroup = projectGroupDao.addProjectGroup( projectGroup );
 
-        context.put( KEY_PROJECT_GROUP_ID, new Integer( projectGroup.getId() ) );
+        context.put( KEY_PROJECT_GROUP_ID, projectGroup.getId() );
     }
 }

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java Wed Apr 15 20:59:07 2009
@@ -19,6 +19,13 @@
  * under the License.
  */
 
+import java.io.File;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
 import org.apache.continuum.utils.shell.ExecutionResult;
 import org.apache.continuum.utils.shell.ShellCommandHelper;
 import org.apache.maven.artifact.Artifact;
@@ -38,13 +45,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -52,8 +52,8 @@
 public abstract class AbstractBuildExecutor
     implements ContinuumBuildExecutor, Initializable
 {
-    protected Logger log = LoggerFactory.getLogger( getClass() );
-    
+    protected final Logger log = LoggerFactory.getLogger( getClass() );
+
     private static final String SUDO_EXECUTABLE = "sudo";
 
     private static final String CHROOT_EXECUTABLE = "chroot";
@@ -96,7 +96,7 @@
     //
     // ----------------------------------------------------------------------
 
-    private String id;
+    private final String id;
 
     private boolean resolveExecutable;
 
@@ -185,8 +185,8 @@
      * @param defaultExecutable
      * @return The executable path
      */
-    protected String findExecutable( Project project, String executable, String defaultExecutable,
-                                     boolean resolveExecutable, File workingDirectory )
+    protected String findExecutable( String executable, String defaultExecutable, boolean resolveExecutable,
+                                   File workingDirectory )
     {
         // ----------------------------------------------------------------------
         // If we're not searching the path for the executable, prefix the
@@ -246,8 +246,7 @@
 
         File workingDirectory = getWorkingDirectory( project );
 
-        String actualExecutable =
-            findExecutable( project, executable, defaultExecutable, resolveExecutable, workingDirectory );
+        String actualExecutable = findExecutable( executable, defaultExecutable, resolveExecutable, workingDirectory );
 
         // ----------------------------------------------------------------------
         // Execute the build
@@ -276,9 +275,9 @@
                 workingDirectory = chrootJailDirectory; // not really used but must exist
             }
 
-            ExecutionResult result = getShellCommandHelper().executeShellCommand( workingDirectory, actualExecutable,
-                                                                                  arguments, output, project.getId(),
-                                                                                  environments );
+            ExecutionResult result =
+                getShellCommandHelper().executeShellCommand( workingDirectory, actualExecutable, arguments, output,
+                                                             project.getId(), environments );
 
             log.info( "Exit code: " + result.getExitCode() );
 
@@ -299,8 +298,9 @@
         }
         catch ( Exception e )
         {
-            throw new ContinuumBuildExecutorException( "Error while executing shell command. " +
-                "The most common error is that '" + executable + "' " + "is not in your path.", e );
+            throw new ContinuumBuildExecutorException(
+                "Error while executing shell command. " + "The most common error is that '" + executable + "' " +
+                    "is not in your path.", e );
         }
     }
 
@@ -408,7 +408,8 @@
         getShellCommandHelper().killProcess( project.getId() );
     }
 
-    public List<Artifact> getDeployableArtifacts( Project project, File workingDirectory, BuildDefinition buildDefinition )
+    public List<Artifact> getDeployableArtifacts( Project project, File workingDirectory,
+                                                  BuildDefinition buildDefinition )
         throws ContinuumBuildExecutorException
     {
         // Not supported by this builder

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/manager/DefaultBuildExecutorManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/manager/DefaultBuildExecutorManager.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/manager/DefaultBuildExecutorManager.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/manager/DefaultBuildExecutorManager.java Wed Apr 15 20:59:07 2009
@@ -19,15 +19,15 @@
  * under the License.
  */
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.HashMap;
-import java.util.Map;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -37,7 +37,7 @@
 public class DefaultBuildExecutorManager
     implements BuildExecutorManager, Initializable
 {
-    private Logger log = LoggerFactory.getLogger( DefaultBuildExecutorManager.class );
+    private static final Logger log = LoggerFactory.getLogger( DefaultBuildExecutorManager.class );
 
     /**
      * @plexus.requirement role="org.apache.maven.continuum.execution.ContinuumBuildExecutor"

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java Wed Apr 15 20:59:07 2009
@@ -19,6 +19,14 @@
  * under the License.
  */
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectDependency;
 import org.apache.maven.continuum.model.project.ProjectDeveloper;
@@ -32,14 +40,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -49,7 +49,7 @@
 public class DefaultMavenOneMetadataHelper
     implements MavenOneMetadataHelper
 {
-    private Logger log = LoggerFactory.getLogger( DefaultMavenOneMetadataHelper.class );
+    private static final Logger log = LoggerFactory.getLogger( DefaultMavenOneMetadataHelper.class );
 
     // ----------------------------------------------------------------------
     // MavenOneMetadataHelper Implementation

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java Wed Apr 15 20:59:07 2009
@@ -19,6 +19,13 @@
  * under the License.
  */
 
+import java.io.File;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
 import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.maven.continuum.execution.AbstractBuildExecutor;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutionResult;
@@ -30,15 +37,9 @@
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.system.Installation;
 import org.apache.maven.continuum.model.system.Profile;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.codehaus.plexus.util.StringUtils;
 
-import java.io.File;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -82,8 +83,8 @@
     public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput )
         throws ContinuumBuildExecutorException
     {
-        String executable = getInstallationService().getExecutorConfigurator( InstallationService.MAVEN1_TYPE )
-            .getExecutable();
+        String executable =
+            getInstallationService().getExecutorConfigurator( InstallationService.MAVEN1_TYPE ).getExecutable();
 
         StringBuffer arguments = new StringBuffer();
 
@@ -108,9 +109,10 @@
         LocalRepository repository = project.getProjectGroup().getLocalRepository();
         if ( repository != null )
         {
-            arguments.append( "\"-Dmaven.repo.local=" ).append( StringUtils.clean(repository.getLocation() ) ).append( "\" " );
+            arguments.append( "\"-Dmaven.repo.local=" ).append( StringUtils.clean( repository.getLocation() ) ).append(
+                "\" " );
         }
-        
+
         arguments.append( StringUtils.clean( buildDefinition.getGoals() ) );
 
         Map<String, String> environments = getEnvironments( buildDefinition );
@@ -174,7 +176,7 @@
 
         try
         {
-            metadataHelper.mapMetadata( projectXmlFile, project );
+            metadataHelper.mapMetadata( new ContinuumProjectBuildingResult(), projectXmlFile, project );
         }
         catch ( MavenOneMetadataHelperException e )
         {

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java Wed Apr 15 20:59:07 2009
@@ -19,6 +19,12 @@
  * under the License.
  */
 
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.maven.artifact.manager.WagonManager;
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -68,13 +74,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -84,7 +83,7 @@
 public class DefaultMavenBuilderHelper
     implements MavenBuilderHelper, Contextualizable, Initializable
 {
-    private Logger log = LoggerFactory.getLogger( DefaultMavenBuilderHelper.class );
+    private static final Logger log = LoggerFactory.getLogger( DefaultMavenBuilderHelper.class );
 
     /**
      * @plexus.requirement
@@ -114,7 +113,7 @@
     private PlexusContainer container;
 
     private LocalRepository repository;
-    
+
     // ----------------------------------------------------------------------
     // MavenBuilderHelper Implementation
     // ----------------------------------------------------------------------
@@ -222,7 +221,7 @@
         {
             List<ProjectDeveloper> developers = new ArrayList<ProjectDeveloper>();
 
-            for ( Developer d : (List<Developer>)mavenProject.getDevelopers() )
+            for ( Developer d : (List<Developer>) mavenProject.getDevelopers() )
             {
                 ProjectDeveloper cd = new ProjectDeveloper();
 
@@ -263,7 +262,7 @@
 
         List<ProjectDependency> dependencies = new ArrayList<ProjectDependency>();
 
-        for ( Dependency dependency : (List<Dependency>)mavenProject.getDependencies() )
+        for ( Dependency dependency : (List<Dependency>) mavenProject.getDependencies() )
         {
             ProjectDependency cd = new ProjectDependency();
 
@@ -276,7 +275,7 @@
             dependencies.add( cd );
         }
 
-        for ( Plugin dependency : (List<Plugin>)mavenProject.getBuildPlugins() )
+        for ( Plugin dependency : (List<Plugin>) mavenProject.getBuildPlugins() )
         {
             ProjectDependency cd = new ProjectDependency();
 
@@ -289,7 +288,7 @@
             dependencies.add( cd );
         }
 
-        for ( ReportPlugin dependency : (List<ReportPlugin>)mavenProject.getReportPlugins() )
+        for ( ReportPlugin dependency : (List<ReportPlugin>) mavenProject.getReportPlugins() )
         {
             ProjectDependency cd = new ProjectDependency();
 
@@ -302,7 +301,7 @@
             dependencies.add( cd );
         }
 
-        for ( Extension dependency : (List<Extension>)mavenProject.getBuildExtensions() )
+        for ( Extension dependency : (List<Extension>) mavenProject.getBuildExtensions() )
         {
             ProjectDependency cd = new ProjectDependency();
 
@@ -358,7 +357,7 @@
             }
         }
 
-        List<ProjectNotifier> notifiers = getNotifiers( result, mavenProject, continuumProject );
+        List<ProjectNotifier> notifiers = getNotifiers( result, mavenProject );
         if ( notifiers != null )
         {
             continuumProject.setNotifiers( notifiers );
@@ -419,9 +418,8 @@
 
                 if ( validationResult != null && validationResult.getMessageCount() > 0 )
                 {
-                    for ( Iterator<String> i = validationResult.getMessages().iterator(); i.hasNext(); )
+                    for ( String valmsg : (List<String>) validationResult.getMessages() )
                     {
-                        String valmsg = i.next();
                         result.addError( ContinuumProjectBuildingResult.ERROR_VALIDATION, valmsg );
                         messages.append( valmsg );
                         messages.append( "\n" );
@@ -431,8 +429,7 @@
 
             if ( cause instanceof ArtifactNotFoundException )
             {
-                result.addError( ContinuumProjectBuildingResult.ERROR_ARTIFACT_NOT_FOUND,
-                                 ( (ArtifactNotFoundException) cause ).toString() );
+                result.addError( ContinuumProjectBuildingResult.ERROR_ARTIFACT_NOT_FOUND, ( cause ).toString() );
                 return null;
             }
 
@@ -518,14 +515,13 @@
         return project.getScm().getConnection();
     }
 
-    private List<ProjectNotifier> getNotifiers( ContinuumProjectBuildingResult result, MavenProject mavenProject,
-                               Project continuumProject )
+    private List<ProjectNotifier> getNotifiers( ContinuumProjectBuildingResult result, MavenProject mavenProject )
     {
         List<ProjectNotifier> notifiers = new ArrayList<ProjectNotifier>();
 
         if ( mavenProject.getCiManagement() != null && mavenProject.getCiManagement().getNotifiers() != null )
         {
-            for ( Notifier projectNotifier : (List<Notifier>)mavenProject.getCiManagement().getNotifiers() )
+            for ( Notifier projectNotifier : (List<Notifier>) mavenProject.getCiManagement().getNotifiers() )
             {
                 ProjectNotifier notifier = new ProjectNotifier();
 
@@ -602,11 +598,9 @@
 
         if ( repository != null )
         {
-            return artifactRepositoryFactory.createArtifactRepository( repository.getName(), 
-                                                                       "file://" + repository.getLocation(), 
-                                                                       repositoryLayout,
-                                                                       null, 
-                                                                       null );
+            return artifactRepositoryFactory.createArtifactRepository( repository.getName(),
+                                                                       "file://" + repository.getLocation(),
+                                                                       repositoryLayout, null, null );
         }
         else if ( !( StringUtils.isEmpty( settings.getLocalRepository() ) ) )
         {
@@ -698,8 +692,8 @@
 
             for ( Profile profile : profiles )
             {
-                message.append( "\n - " ).append( profile.getId() ).append( " (source: " )
-                    .append( profile.getSource() ).append( ")" );
+                message.append( "\n - " ).append( profile.getId() ).append( " (source: " ).append(
+                    profile.getSource() ).append( ")" );
             }
 
         }
@@ -736,10 +730,8 @@
                                        proxy.getPassword(), proxy.getNonProxyHosts() );
             }
 
-            for ( Iterator<Server> i = settings.getServers().iterator(); i.hasNext(); )
+            for ( Server server : (List<Server>) settings.getServers() )
             {
-                Server server = i.next();
-
                 wagonManager.addAuthenticationInfo( server.getId(), server.getUsername(), server.getPassword(),
                                                     server.getPrivateKey(), server.getPassphrase() );
 
@@ -752,10 +744,8 @@
                 }
             }
 
-            for ( Iterator<Mirror> i = settings.getMirrors().iterator(); i.hasNext(); )
+            for ( Mirror mirror : (List<Mirror>) settings.getMirrors() )
             {
-                Mirror mirror = i.next();
-
                 wagonManager.addMirror( mirror.getId(), mirror.getMirrorOf(), mirror.getUrl() );
             }
         }
@@ -789,7 +779,7 @@
             throw new InitializationException( "Can't initialize '" + getClass().getName() + "'", e );
         }
     }
-    
+
     public void setLocalRepository( LocalRepository repository )
     {
         this.repository = repository;

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java Wed Apr 15 20:59:07 2009
@@ -52,7 +52,7 @@
 public class DefaultContinuumInitializer
     implements ContinuumInitializer
 {
-    private Logger log = LoggerFactory.getLogger( DefaultContinuumInitializer.class );
+    private static final Logger log = LoggerFactory.getLogger( DefaultContinuumInitializer.class );
 
     // ----------------------------------------------------------------------
     //  Requirements

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java Wed Apr 15 20:59:07 2009
@@ -19,6 +19,11 @@
  * under the License.
  */
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.continuum.model.project.ProjectScmRoot;
@@ -32,11 +37,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -46,7 +46,7 @@
 public class DefaultContinuumNotificationDispatcher
     implements ContinuumNotificationDispatcher
 {
-    private Logger log = LoggerFactory.getLogger( getClass() );
+    private static final Logger log = LoggerFactory.getLogger( DefaultContinuumNotificationDispatcher.class );
 
     /**
      * @plexus.requirement
@@ -130,10 +130,10 @@
                 projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( project.getProjectGroup().getId() );
 
             Map<String, List<ProjectNotifier>> notifiersMap = new HashMap<String, List<ProjectNotifier>>();
-            
+
             getProjectNotifiers( project, notifiersMap );
             getProjectGroupNotifiers( projectGroup, notifiersMap );
-            
+
             for ( String notifierType : notifiersMap.keySet() )
             {
                 MessageContext context = new MessageContext();
@@ -161,12 +161,12 @@
     {
         try
         {
-            ProjectGroup group =
-                projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( projectScmRoot.getProjectGroup().getId() );
-            
+            ProjectGroup group = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId(
+                projectScmRoot.getProjectGroup().getId() );
+
             Map<String, List<ProjectNotifier>> notifiersMap = new HashMap<String, List<ProjectNotifier>>();
             getProjectGroupNotifiers( group, notifiersMap );
-            
+
             for ( String notifierType : notifiersMap.keySet() )
             {
                 MessageContext context = new MessageContext();
@@ -200,7 +200,7 @@
             log.error( "Error while trying to use the " + notifierType + " notifier.", e );
         }
     }
-    
+
     private void getProjectNotifiers( Project project, Map<String, List<ProjectNotifier>> notifiersMap )
     {
         if ( project.getNotifiers() != null )
@@ -226,8 +226,8 @@
             }
         }
     }
-    
-    private void getProjectGroupNotifiers( ProjectGroup projectGroup, Map<String, List<ProjectNotifier>>  notifiersMap )
+
+    private void getProjectGroupNotifiers( ProjectGroup projectGroup, Map<String, List<ProjectNotifier>> notifiersMap )
     {
         // perform the project group level notifications
         if ( projectGroup.getNotifiers() != null )

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/console/ConsoleNotifier.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/console/ConsoleNotifier.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/console/ConsoleNotifier.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/console/ConsoleNotifier.java Wed Apr 15 20:59:07 2009
@@ -26,7 +26,6 @@
 import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
 import org.apache.maven.continuum.notification.MessageContext;
 import org.apache.maven.continuum.notification.NotificationException;
-import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.codehaus.plexus.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -40,7 +39,7 @@
 public class ConsoleNotifier
     extends AbstractContinuumNotifier
 {
-    private Logger log = LoggerFactory.getLogger( getClass() );
+    private static final Logger log = LoggerFactory.getLogger( ConsoleNotifier.class );
 
     // ----------------------------------------------------------------------
     // Notifier Implementation
@@ -142,11 +141,6 @@
         }
     }
 
-    private void prepareBuildStarted( ProjectScmRoot projectScmRoot )
-    {
-        out( projectScmRoot, "Prepare build started." );
-    }
-
     private void prepareBuildComplete( ProjectScmRoot projectScmRoot )
     {
         if ( StringUtils.isEmpty( projectScmRoot.getError() ) )

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/FormatterTool.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/FormatterTool.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/FormatterTool.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/FormatterTool.java Wed Apr 15 20:59:07 2009
@@ -19,20 +19,20 @@
  * under the License.
  */
 
-import org.apache.maven.continuum.project.ContinuumProjectState;
-
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import org.apache.maven.continuum.project.ContinuumProjectState;
+
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
  */
 public class FormatterTool
 {
-    private String timestampFormatString;
+    private final String timestampFormatString;
 
-    private ThreadLocal timestampFormat = new ThreadLocal();
+    private ThreadLocal<SimpleDateFormat> timestampFormat = new ThreadLocal<SimpleDateFormat>();
 
     public FormatterTool( String timestampFormatString )
     {
@@ -127,9 +127,9 @@
     //
     // ----------------------------------------------------------------------
 
-    private SimpleDateFormat getSimpleDateFormat( ThreadLocal threadLocal, String format )
+    private SimpleDateFormat getSimpleDateFormat( ThreadLocal<SimpleDateFormat> threadLocal, String format )
     {
-        SimpleDateFormat dateFormat = (SimpleDateFormat) threadLocal.get();
+        SimpleDateFormat dateFormat = threadLocal.get();
 
         if ( dateFormat == null )
         {

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java Wed Apr 15 20:59:07 2009
@@ -19,6 +19,23 @@
  * under the License.
  */
 
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+
 import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.configuration.ConfigurationService;
@@ -54,23 +71,6 @@
 import org.slf4j.LoggerFactory;
 import org.springframework.mail.javamail.JavaMailSender;
 
-import javax.mail.Address;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @version $Id$
@@ -79,7 +79,7 @@
     extends AbstractContinuumNotifier
     implements Initializable
 {
-    private Logger log = LoggerFactory.getLogger( getClass() );
+    private static final Logger log = LoggerFactory.getLogger( MailContinuumNotifier.class );
 
     // ----------------------------------------------------------------------
     // Requirements
@@ -167,6 +167,7 @@
 
     /**
      * Customizable mail subject
+     *
      * @plexus.configuration
      */
     private String prepareBuildSubjectFormat = "[continuum] PREPARE BUILD ${state]";
@@ -256,15 +257,15 @@
         String buildOutput = getBuildOutput( project, build );
         BuildDefinition buildDefinition = context.getBuildDefinition();
         ProjectScmRoot projectScmRoot = context.getProjectScmRoot();
-        
+
         boolean isPrepareBuildComplete =
             messageId.equals( ContinuumNotificationDispatcher.MESSAGE_ID_PREPARE_BUILD_COMPLETE );
-        
+
         if ( projectScmRoot == null && isPrepareBuildComplete )
         {
             return;
         }
-        
+
         // ----------------------------------------------------------------------
         // If there wasn't any building done, don't notify
         // ----------------------------------------------------------------------
@@ -350,8 +351,8 @@
 
                 context.put( "project", project );
 
-                context.put( "changesSinceLastSuccess", continuum.getChangesSinceLastSuccess( project.getId(), build
-                    .getId() ) );
+                context.put( "changesSinceLastSuccess",
+                             continuum.getChangesSinceLastSuccess( project.getId(), build.getId() ) );
 
                 context.put( "previousBuild", previousBuild );
 
@@ -429,8 +430,8 @@
         sendMessage( project, notifiers, subject, content, messageContext );
     }
 
-    private void prepareBuildComplete( ProjectScmRoot projectScmRoot, List<ProjectNotifier> notifiers, 
-                                       String messageId, MessageContext messageContext )
+    private void prepareBuildComplete( ProjectScmRoot projectScmRoot, List<ProjectNotifier> notifiers, String messageId,
+                                       MessageContext messageContext )
         throws NotificationException
     {
         // ----------------------------------------------------------------------
@@ -439,7 +440,7 @@
 
         String packageName = getClass().getPackage().getName().replace( '.', '/' );
 
-        String templateName = packageName + "/templates/"  + messageId + ".vm";
+        String templateName = packageName + "/templates/" + messageId + ".vm";
 
         StringWriter writer = new StringWriter();
 
@@ -448,18 +449,18 @@
         try
         {
             VelocityContext context = new VelocityContext();
-            
+
             // ----------------------------------------------------------------------
             // Data objects
             // ----------------------------------------------------------------------
 
-            context.put( "reportUrl", getReportUrl( projectScmRoot.getProjectGroup(), 
-                                                    projectScmRoot, configurationService ) );
+            context.put( "reportUrl",
+                         getReportUrl( projectScmRoot.getProjectGroup(), projectScmRoot, configurationService ) );
 
             context.put( "projectGroup", projectScmRoot.getProjectGroup() );
 
             context.put( "projectScmRoot", projectScmRoot );
-            
+
             // TODO put other profile env var could be a security if they provide passwords ?
 
             // ----------------------------------------------------------------------
@@ -480,7 +481,7 @@
         {
             throw new NotificationException( "Error while generating mail contents.", e );
         }
-        
+
         // ----------------------------------------------------------------------
         // Send the mail
         // ----------------------------------------------------------------------
@@ -497,7 +498,7 @@
 
         sendMessage( projectScmRoot, notifiers, subject, content, messageContext );
     }
-    
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -540,18 +541,18 @@
             // depends on ExecutorId
             if ( MavenTwoBuildExecutor.ID.equals( project.getExecutorId() ) )
             {
-                executorConfigurator = continuum.getInstallationService()
-                    .getExecutorConfigurator( InstallationService.MAVEN2_TYPE );
+                executorConfigurator =
+                    continuum.getInstallationService().getExecutorConfigurator( InstallationService.MAVEN2_TYPE );
             }
             else if ( MavenOneBuildExecutor.ID.equals( project.getExecutorId() ) )
             {
-                executorConfigurator = continuum.getInstallationService()
-                    .getExecutorConfigurator( InstallationService.MAVEN1_TYPE );
+                executorConfigurator =
+                    continuum.getInstallationService().getExecutorConfigurator( InstallationService.MAVEN1_TYPE );
             }
             else if ( AntBuildExecutor.ID.equals( project.getExecutorId() ) )
             {
-                executorConfigurator = continuum.getInstallationService()
-                    .getExecutorConfigurator( InstallationService.ANT_TYPE );
+                executorConfigurator =
+                    continuum.getInstallationService().getExecutorConfigurator( InstallationService.ANT_TYPE );
             }
             else
             {
@@ -559,8 +560,8 @@
             }
         }
 
-        return continuum.getInstallationService().getExecutorConfiguratorVersion( builder == null ? null : builder
-            .getVarValue(), executorConfigurator, profile );
+        return continuum.getInstallationService().getExecutorConfiguratorVersion(
+            builder == null ? null : builder.getVarValue(), executorConfigurator, profile );
     }
 
     private String generateSubject( Project project, BuildResult build )
@@ -575,24 +576,25 @@
 
         StringWriter writer = new StringWriter();
 
-        boolean velocityResults = velocity.getEngine().evaluate( context, writer, "subjectPattern", buildSubjectFormat );
+        boolean velocityRes = velocity.getEngine().evaluate( context, writer, "subjectPattern", buildSubjectFormat );
 
         return writer.toString();
     }
-    
+
     private String generateSubject( ProjectScmRoot projectScmRoot )
         throws Exception
     {
         String state = getState( projectScmRoot );
-        
+
         VelocityContext context = new VelocityContext();
         context.put( "projectScmRoot", projectScmRoot );
         context.put( "state", state );
-    
+
         StringWriter writer = new StringWriter();
-    
-        boolean velocityResults = velocity.getEngine().evaluate( context, writer, "subjectPattern", prepareBuildSubjectFormat );
-    
+
+        boolean velocityResults =
+            velocity.getEngine().evaluate( context, writer, "subjectPattern", prepareBuildSubjectFormat );
+
         return writer.toString();
     }
 
@@ -624,7 +626,7 @@
             return "ERROR: Unknown build state " + state;
         }
     }
-    
+
     private String getState( ProjectScmRoot projectScmRoot )
     {
         int state = projectScmRoot.getState();
@@ -639,13 +641,14 @@
         }
         else
         {
-            log.warn( "Unknown prepare build state " + state + " for SCM Root URL " + projectScmRoot.getScmRootAddress() +
-                      " in projectGroup " + projectScmRoot.getProjectGroup().getId() );
+            log.warn(
+                "Unknown prepare build state " + state + " for SCM Root URL " + projectScmRoot.getScmRootAddress() +
+                    " in projectGroup " + projectScmRoot.getProjectGroup().getId() );
 
             return "ERROR: Unknown build state " + state;
         }
     }
-    
+
     private void sendMessage( Project project, List<ProjectNotifier> notifiers, String subject, String content,
                               MessageContext context )
         throws NotificationException
@@ -664,9 +667,8 @@
 
         if ( fromMailbox == null )
         {
-            log
-                .warn( project.getName() +
-                    ": Project is missing nag email and global from mailbox is missing, not sending mail." );
+            log.warn( project.getName() +
+                ": Project is missing nag email and global from mailbox is missing, not sending mail." );
 
             return;
         }
@@ -714,7 +716,7 @@
                                 log.info( "Recipient: To '" + to + "'." );
                                 message.addRecipient( Message.RecipientType.TO, to );
                             }
-                            
+
                         }
 
                         String committerField = (String) notifier.getConfiguration().get( COMMITTER_FIELD );
@@ -747,8 +749,9 @@
                                             if ( StringUtils.isEmpty( email ) )
                                             {
                                                 //TODO: Add a default domain so mail address won't be required
-                                                log.warn( "no email address is defined in developers list for '" +
-                                                    scmId + "' scm id." );
+                                                log.warn(
+                                                    "no email address is defined in developers list for '" + scmId +
+                                                        "' scm id." );
                                             }
                                             else
                                             {
@@ -778,7 +781,7 @@
 
             message.setSentDate( new Date() );
 
-            if ( message.getAllRecipients() != null && ( (Address[]) message.getAllRecipients() ).length > 0 )
+            if ( message.getAllRecipients() != null && ( message.getAllRecipients() ).length > 0 )
             {
                 javaMailSender.send( message );
             }
@@ -797,12 +800,12 @@
         }
     }
 
-    private void sendMessage( ProjectScmRoot projectScmRoot, List<ProjectNotifier> notifiers, 
-                              String subject, String content, MessageContext context )
+    private void sendMessage( ProjectScmRoot projectScmRoot, List<ProjectNotifier> notifiers, String subject,
+                              String content, MessageContext context )
         throws NotificationException
     {
         ProjectGroup projectGroup = projectScmRoot.getProjectGroup();
-        
+
         if ( notifiers.size() == 0 )
         {
             // This is a useful message for the users when debugging why they don't
@@ -817,15 +820,14 @@
 
         if ( fromMailbox == null )
         {
-            log
-                .warn( projectGroup.getName() +
-                    ": ProjectGroup is missing nag email and global from mailbox is missing, not sending mail." );
+            log.warn( projectGroup.getName() +
+                ": ProjectGroup is missing nag email and global from mailbox is missing, not sending mail." );
 
             return;
         }
 
         MimeMessage message = javaMailSender.createMimeMessage();
-        
+
         try
         {
             message.setSubject( subject );
@@ -839,7 +841,7 @@
             message.setFrom( from );
 
             log.info( "Sending message: From '" + from + "'." );
-            
+
             if ( StringUtils.isEmpty( toOverride ) )
             {
                 for ( ProjectNotifier notifier : notifiers )
@@ -848,7 +850,7 @@
                     {
                         continue;
                     }
-                    
+
                     Map<String, String> conf = notifier.getConfiguration();
                     if ( conf != null )
                     {
@@ -882,7 +884,7 @@
 
             message.setSentDate( new Date() );
 
-            if ( message.getAllRecipients() != null && ( (Address[]) message.getAllRecipients() ).length > 0 )
+            if ( message.getAllRecipients() != null && ( message.getAllRecipients() ).length > 0 )
             {
                 javaMailSender.send( message );
             }
@@ -940,7 +942,7 @@
             return FALLBACK_FROM_MAILBOX;
         }
         // olamy : CONTINUUM-860 if address contains commas we use only the first one
-        if ( address.contains( "," ) )
+        if ( address != null && address.contains( "," ) )
         {
             String[] addresses = StringUtils.split( address, "," );
             return addresses[0];

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/manager/spring/NotifierFactoryBean.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/manager/spring/NotifierFactoryBean.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/manager/spring/NotifierFactoryBean.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/manager/spring/NotifierFactoryBean.java Wed Apr 15 20:59:07 2009
@@ -19,6 +19,9 @@
  * under the License.
  */
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.maven.continuum.notification.Notifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -29,9 +32,6 @@
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 
-import java.util.HashMap;
-import java.util.Map;
-
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
  * @version $Id$
@@ -39,7 +39,7 @@
 public class NotifierFactoryBean
     implements FactoryBean, ApplicationContextAware
 {
-    private Logger log = LoggerFactory.getLogger( getClass() );
+    private static final Logger log = LoggerFactory.getLogger( NotifierFactoryBean.class );
 
     private ApplicationContext applicationContext;
 

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java Wed Apr 15 20:59:07 2009
@@ -19,6 +19,17 @@
  * under the License.
  */
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.UnknownHostException;
+
 import org.apache.commons.io.IOUtils;
 import org.apache.http.HttpException;
 import org.apache.http.HttpResponse;
@@ -27,14 +38,11 @@
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.conn.ClientConnectionManager;
-import org.apache.http.conn.ConnectTimeoutException;
 import org.apache.http.conn.params.ConnManagerPNames;
 import org.apache.http.conn.params.ConnPerRouteBean;
 import org.apache.http.conn.scheme.PlainSocketFactory;
 import org.apache.http.conn.scheme.Scheme;
 import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.conn.scheme.SocketFactory;
-import org.apache.http.conn.ssl.SSLSocketFactory;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
 import org.apache.http.params.BasicHttpParams;
@@ -49,19 +57,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.Socket;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.UnknownHostException;
-
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -72,7 +67,7 @@
 {
     private static final String TMP_DIR = System.getProperty( "java.io.tmpdir" );
 
-    protected Logger log = LoggerFactory.getLogger( AbstractContinuumProjectBuilder.class );
+    protected final Logger log = LoggerFactory.getLogger( getClass() );
 
     private DefaultHttpClient httpClient;
 
@@ -87,7 +82,7 @@
 
         HttpParams params = new BasicHttpParams();
         // TODO put this values to a configuration way ???
-        params.setParameter( ConnManagerPNames.MAX_TOTAL_CONNECTIONS, new Integer( 30 ) );
+        params.setParameter( ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30 );
         params.setParameter( ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean( 30 ) );
         HttpProtocolParams.setVersion( params, HttpVersion.HTTP_1_1 );
 
@@ -107,7 +102,7 @@
         }
         log.info( "Downloading " + url );
 
-        InputStream is = null;
+        InputStream is;
 
         if ( metadata.getProtocol().startsWith( "http" ) )
         {
@@ -117,9 +112,9 @@
             // basic auth
             if ( username != null && password != null )
             {
-                httpClient.getCredentialsProvider()
-                    .setCredentials( new AuthScope( uri.getHost(), uri.getPort() ),
-                                     new UsernamePasswordCredentials( username, password ) );
+                httpClient.getCredentialsProvider().setCredentials( new AuthScope( uri.getHost(), uri.getPort() ),
+                                                                    new UsernamePasswordCredentials( username,
+                                                                                                     password ) );
             }
 
             HttpResponse httpResponse = httpClient.execute( httpGet );
@@ -138,8 +133,8 @@
                 default:
                     log.warn( "skip non handled http return code " + res );
             }
-            is = IOUtils.toInputStream( EntityUtils.toString( httpResponse.getEntity(), EntityUtils
-                .getContentCharSet( httpResponse.getEntity() ) ) );
+            is = IOUtils.toInputStream( EntityUtils.toString( httpResponse.getEntity(), EntityUtils.getContentCharSet(
+                httpResponse.getEntity() ) ) );
         }
         else
         {

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/EasySSLSocketFactory.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/EasySSLSocketFactory.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/EasySSLSocketFactory.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/EasySSLSocketFactory.java Wed Apr 15 20:59:07 2009
@@ -39,24 +39,25 @@
 
 /**
  * This socket factory will create ssl socket that accepts self signed certificate
+ *
  * @author olamy
- * @since 1.2.3
  * @version $Id$
+ * @since 1.2.3
  */
 public class EasySSLSocketFactory
     implements SocketFactory, LayeredSocketFactory
 {
-
-    private Logger log = LoggerFactory.getLogger( getClass() );
+    private static final Logger log = LoggerFactory.getLogger( EasySSLSocketFactory.class );
 
     private SSLContext sslcontext = null;
 
-    private static SSLContext createEasySSLContext() throws IOException
+    private static SSLContext createEasySSLContext()
+        throws IOException
     {
         try
         {
             SSLContext context = SSLContext.getInstance( "SSL" );
-            context.init( null, new TrustManager[] { new EasyX509TrustManager( null ) }, null );
+            context.init( null, new TrustManager[]{new EasyX509TrustManager( null )}, null );
             return context;
         }
         catch ( Exception e )
@@ -66,7 +67,8 @@
         }
     }
 
-    private SSLContext getSSLContext()  throws IOException
+    private SSLContext getSSLContext()
+        throws IOException
     {
         if ( this.sslcontext == null )
         {
@@ -75,10 +77,11 @@
         return this.sslcontext;
     }
 
-    /** 
+    /**
      * @see org.apache.http.conn.scheme.SocketFactory#connectSocket(java.net.Socket, java.lang.String, int, java.net.InetAddress, int, org.apache.http.params.HttpParams)
      */
-    public Socket connectSocket( Socket sock, String host, int port, InetAddress localAddress, int localPort, HttpParams params )
+    public Socket connectSocket( Socket sock, String host, int port, InetAddress localAddress, int localPort,
+                                 HttpParams params )
         throws IOException, UnknownHostException, ConnectTimeoutException
     {
         int connTimeout = HttpConnectionParams.getConnectionTimeout( params );
@@ -104,20 +107,20 @@
 
     }
 
-    /** 
+    /**
      * @see org.apache.http.conn.scheme.SocketFactory#createSocket()
      */
     public Socket createSocket()
         throws IOException
     {
-        if (log.isDebugEnabled())
+        if ( log.isDebugEnabled() )
         {
             log.debug( "create socket" );
         }
         return getSSLContext().getSocketFactory().createSocket();
     }
 
-    /** 
+    /**
      * @see org.apache.http.conn.scheme.SocketFactory#isSecure(java.net.Socket)
      */
     public boolean isSecure( Socket socket )
@@ -126,16 +129,16 @@
         return true;
     }
 
-    /** 
+    /**
      * @see org.apache.http.conn.scheme.LayeredSocketFactory#createSocket(java.net.Socket, java.lang.String, int, boolean)
      */
     public Socket createSocket( Socket socket, String host, int port, boolean autoClose )
         throws IOException, UnknownHostException
     {
-        if (log.isDebugEnabled())
+        if ( log.isDebugEnabled() )
         {
             log.debug( "create socket host " + host + ", port " + port );
-        }        
+        }
         return getSSLContext().getSocketFactory().createSocket();
     }
 
@@ -144,7 +147,7 @@
     //  Both Object.equals() and Object.hashCode() must be overridden 
     //  for the correct operation of some connection managers
     // -------------------------------------------------------------------
-    
+
     public boolean equals( Object obj )
     {
         return ( ( obj != null ) && obj.getClass().equals( EasySSLSocketFactory.class ) );
@@ -156,6 +159,4 @@
     }
 
 
-
-
 }

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/EasyX509TrustManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/EasyX509TrustManager.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/EasyX509TrustManager.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/EasyX509TrustManager.java Wed Apr 15 20:59:07 2009
@@ -34,14 +34,15 @@
 
 /**
  * @author olamy
- * @since 1.2.3
  * @version $Id$
+ * @since 1.2.3
  */
-public class EasyX509TrustManager implements X509TrustManager
+public class EasyX509TrustManager
+    implements X509TrustManager
 {
-    private X509TrustManager standardTrustManager = null;
+    private static final Logger log = LoggerFactory.getLogger( EasyX509TrustManager.class );
 
-    private Logger log = LoggerFactory.getLogger( getClass() );
+    private X509TrustManager standardTrustManager = null;
 
     /**
      * Constructor for EasyX509TrustManager.

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/DefaultContinuumProjectBuilderManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/DefaultContinuumProjectBuilderManager.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/DefaultContinuumProjectBuilderManager.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/DefaultContinuumProjectBuilderManager.java Wed Apr 15 20:59:07 2009
@@ -19,10 +19,10 @@
  * under the License.
  */
 
-import org.apache.maven.continuum.project.builder.ContinuumProjectBuilder;
-
 import java.util.Map;
 
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuilder;
+
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -44,7 +44,7 @@
     public ContinuumProjectBuilder getProjectBuilder( String id )
         throws ContinuumProjectBuilderManagerException
     {
-        ContinuumProjectBuilder projectBuilder = (ContinuumProjectBuilder) projectBuilders.get( id );
+        ContinuumProjectBuilder projectBuilder = projectBuilders.get( id );
 
         if ( projectBuilder == null )
         {

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java Wed Apr 15 20:59:07 2009
@@ -19,6 +19,10 @@
  * under the License.
  */
 
+import java.io.File;
+import java.net.URL;
+import java.util.List;
+
 import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionServiceException;
 import org.apache.maven.continuum.execution.maven.m1.MavenOneBuildExecutor;
@@ -34,10 +38,6 @@
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.codehaus.plexus.util.StringUtils;
 
-import java.io.File;
-import java.net.URL;
-import java.util.Iterator;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -76,8 +76,8 @@
     {
         try
         {
-            return buildProjectsFromMetadata( url, username, password, recursiveProjects, buildDefinitionService
-                .getDefaultMavenOneBuildDefinitionTemplate() );
+            return buildProjectsFromMetadata( url, username, password, recursiveProjects,
+                                              buildDefinitionService.getDefaultMavenOneBuildDefinitionTemplate() );
         }
         catch ( BuildDefinitionServiceException e )
         {
@@ -111,11 +111,9 @@
             {
                 return result;
             }
-            for ( Iterator<BuildDefinition> iterator = buildDefinitionTemplate.getBuildDefinitions().iterator();
-                  iterator
-                      .hasNext(); )
+            for ( BuildDefinition bd : (List<BuildDefinition>) buildDefinitionTemplate.getBuildDefinitions() )
             {
-                project.addBuildDefinition( iterator.next() );
+                project.addBuildDefinition( bd );
             }
             result.addProject( project, MavenOneBuildExecutor.ID );
         }
@@ -127,11 +125,11 @@
         }
         finally
         {
-            if ( pomFile != null && pomFile.exists() )
+            if ( pomFile.exists() )
             {
                 pomFile.delete();
             }
-        }        
+        }
 
         ProjectGroup projectGroup = new ProjectGroup();
 

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java Wed Apr 15 20:59:07 2009
@@ -19,6 +19,9 @@
  * under the License.
  */
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.taskqueue.CheckOutTask;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
@@ -31,9 +34,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.HashMap;
-import java.util.Map;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -63,7 +63,7 @@
         throws TaskExecutionException
     {
         log.info( "Checkout task executor.." );
-        
+
         CheckOutTask task = (CheckOutTask) t;
 
         int projectId = task.getProjectId();
@@ -85,7 +85,7 @@
 
         Map<String, Object> context = new HashMap<String, Object>();
 
-        context.put( AbstractContinuumAction.KEY_PROJECT_ID, new Integer( projectId ) );
+        context.put( AbstractContinuumAction.KEY_PROJECT_ID, projectId );
 
         context.put( AbstractContinuumAction.KEY_PROJECT, project );
 

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java?rev=765355&r1=765354&r2=765355&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java Wed Apr 15 20:59:07 2009
@@ -63,7 +63,7 @@
 public class PrepareBuildProjectsTaskExecutor
     implements TaskExecutor
 {
-    private Logger log = LoggerFactory.getLogger( PrepareBuildProjectsTaskExecutor.class );
+    private static final Logger log = LoggerFactory.getLogger( PrepareBuildProjectsTaskExecutor.class );
 
     /**
      * @plexus.requirement
@@ -74,12 +74,12 @@
      * @plexus.requirement
      */
     private ProjectDao projectDao;
-    
+
     /**
      * @plexus.requirement
      */
     private BuildDefinitionDao buildDefinitionDao;
-    
+
     /**
      * @plexus.requirement
      */
@@ -104,11 +104,11 @@
         throws TaskExecutionException
     {
         PrepareBuildProjectsTask prepareTask = (PrepareBuildProjectsTask) task;
-        
+
         Map<Integer, Integer> projectsBuildDefinitionsMap = prepareTask.getProjectsBuildDefinitionsMap();
         int trigger = prepareTask.getTrigger();
         Set<Integer> projectsId = projectsBuildDefinitionsMap.keySet();
-        Map context = new HashMap();
+        Map<String, Object> context = new HashMap<String, Object>();
         Map<Integer, ScmResult> scmResultMap = new HashMap<Integer, ScmResult>();
 
         try
@@ -116,11 +116,12 @@
             for ( Integer projectId : projectsId )
             {
                 int buildDefinitionId = projectsBuildDefinitionsMap.get( projectId );
-                
+
                 log.info( "Initializing prepare build" );
                 context = initializeContext( projectId, buildDefinitionId );
 
-                log.info( "Starting prepare build of project: " + AbstractContinuumAction.getProject( context ).getName() );
+                log.info(
+                    "Starting prepare build of project: " + AbstractContinuumAction.getProject( context ).getName() );
                 startPrepareBuild( context );
 
                 if ( !checkProjectScmRoot( context ) )
@@ -153,8 +154,9 @@
                 }
                 finally
                 {
-                    log.info( "Ending prepare build of project: " + AbstractContinuumAction.getProject( context).getName() );
-                    scmResultMap.put( AbstractContinuumAction.getProjectId( context ), 
+                    log.info(
+                        "Ending prepare build of project: " + AbstractContinuumAction.getProject( context ).getName() );
+                    scmResultMap.put( AbstractContinuumAction.getProjectId( context ),
                                       AbstractContinuumAction.getScmResult( context, null ) );
                     endProjectPrepareBuild( context );
                 }
@@ -173,19 +175,19 @@
         }
     }
 
-    private Map initializeContext( int projectId, int buildDefinitionId )
+    private Map<String, Object> initializeContext( int projectId, int buildDefinitionId )
         throws TaskExecutionException
     {
-        Map context = new HashMap();
+        Map<String, Object> context = new HashMap<String, Object>();
 
         try
         {
             Project project = projectDao.getProject( projectId );
             ProjectGroup projectGroup = project.getProjectGroup();
-            
+
             List<ProjectScmRoot> scmRoots = projectScmRootDao.getProjectScmRootByProjectGroup( projectGroup.getId() );
             String projectScmUrl = project.getScmUrl();
-            
+
             for ( ProjectScmRoot projectScmRoot : scmRoots )
             {
                 if ( projectScmUrl.contains( projectScmRoot.getScmRootAddress() ) )
@@ -198,17 +200,19 @@
             context.put( AbstractContinuumAction.KEY_PROJECT_GROUP_ID, projectGroup.getId() );
             context.put( AbstractContinuumAction.KEY_PROJECT_ID, projectId );
             context.put( AbstractContinuumAction.KEY_PROJECT, project );
-    
+
             context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION_ID, buildDefinitionId );
-            context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, buildDefinitionDao.getBuildDefinition( buildDefinitionId ) );
+            context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION,
+                         buildDefinitionDao.getBuildDefinition( buildDefinitionId ) );
 
             BuildResult oldBuildResult =
                 buildResultDao.getLatestBuildResultForBuildDefinition( projectId, buildDefinitionId );
 
             if ( oldBuildResult != null )
             {
-                context.put( AbstractContinuumAction.KEY_OLD_SCM_RESULT, 
-                             getOldScmResults( projectId, oldBuildResult.getBuildNumber(), oldBuildResult.getEndTime() ) );
+                context.put( AbstractContinuumAction.KEY_OLD_SCM_RESULT,
+                             getOldScmResults( projectId, oldBuildResult.getBuildNumber(),
+                                               oldBuildResult.getEndTime() ) );
             }
             else
             {
@@ -219,62 +223,58 @@
         {
             throw new TaskExecutionException( "Error initializing pre-build context", e );
         }
-        
+
         return context;
     }
-    
-    private void cleanWorkingDirectory( Map context )
+
+    private void cleanWorkingDirectory( Map<String, Object> context )
         throws TaskExecutionException
     {
         performAction( "clean-working-directory", context );
     }
-    
-    private void updateWorkingDirectory( Map context )
+
+    private void updateWorkingDirectory( Map<String, Object> context )
         throws TaskExecutionException
     {
         performAction( "check-working-directory", context );
-    
+
         boolean workingDirectoryExists =
             AbstractContinuumAction.getBoolean( context, AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS );
-    
+
         ScmResult scmResult;
-    
+
         if ( workingDirectoryExists )
         {
             performAction( "update-working-directory-from-scm", context );
-    
-            scmResult = AbstractContinuumAction.getUpdateScmResult( context, null );
+
+            scmResult = AbstractContinuumAction.getUpdateScmResult( context );
         }
         else
         {
             Project project = AbstractContinuumAction.getProject( context );
-    
+
             context.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY,
-                               workingDirectoryService.getWorkingDirectory( project ).getAbsolutePath() );
-    
+                         workingDirectoryService.getWorkingDirectory( project ).getAbsolutePath() );
+
             performAction( "checkout-project", context );
-    
+
             scmResult = AbstractContinuumAction.getCheckoutResult( context, null );
         }
-    
+
         context.put( AbstractContinuumAction.KEY_SCM_RESULT, scmResult );
     }
-    
-    private boolean checkProjectScmRoot( Map context )
+
+    private boolean checkProjectScmRoot( Map<String, Object> context )
         throws TaskExecutionException
     {
         ProjectScmRoot projectScmRoot = AbstractContinuumAction.getProjectScmRoot( context );
-        
+
         // check state of scm root
-        if ( projectScmRoot.getState() == ContinuumProjectState.ERROR )
-        {
-            return false;
-        }
-        
-        return true;
+        return projectScmRoot.getState() != ContinuumProjectState.ERROR;
+
     }
-    
-    private void startPrepareBuild( Map context )
+
+    private void startPrepareBuild( Map<String, Object> context )
         throws TaskExecutionException
     {
         ProjectScmRoot projectScmRoot = AbstractContinuumAction.getProjectScmRoot( context );
@@ -292,17 +292,17 @@
             }
         }
     }
-    
-    private void endPrepareBuild( Map context )
+
+    private void endPrepareBuild( Map<String, Object> context )
         throws TaskExecutionException
     {
         ProjectScmRoot projectScmRoot = AbstractContinuumAction.getProjectScmRoot( context );
-        
+
         if ( projectScmRoot.getState() != ContinuumProjectState.ERROR )
         {
             projectScmRoot.setState( ContinuumProjectState.UPDATED );
             projectScmRoot.setError( null );
-            
+
             try
             {
                 projectScmRootDao.updateProjectScmRoot( projectScmRoot );
@@ -315,21 +315,20 @@
 
         notifierDispatcher.prepareBuildComplete( projectScmRoot );
     }
-    
+
     /**
-     *  @param context
+     * @param context
      * @throws TaskExecutionException
      */
-    private void endProjectPrepareBuild( Map context )
+    private void endProjectPrepareBuild( Map<String, Object> context )
         throws TaskExecutionException
     {
         ScmResult scmResult = AbstractContinuumAction.getScmResult( context, null );
-        Project project = AbstractContinuumAction.getProject( context );
-        
+
         if ( scmResult == null || !scmResult.isSuccess() )
         {
             String error = convertScmResultToError( scmResult );
-            
+
             updateProjectScmRoot( context, error );
         }
     }
@@ -338,7 +337,7 @@
         throws ContinuumStoreException
     {
         List<BuildResult> results = buildResultDao.getBuildResultsForProjectFromId( projectId, startId );
-    
+
         ScmResult res = new ScmResult();
 
         if ( results != null && results.size() > 0 )
@@ -346,11 +345,11 @@
             for ( BuildResult result : results )
             {
                 ScmResult scmResult = result.getScmResult();
-    
+
                 if ( scmResult != null )
                 {
                     List<ChangeSet> changes = scmResult.getChanges();
-    
+
                     if ( changes != null )
                     {
                         for ( ChangeSet changeSet : changes )
@@ -368,7 +367,7 @@
                 }
             }
         }
-    
+
         return res;
     }
 
@@ -377,9 +376,9 @@
      *
      * @param context The build context
      */
-    private void mergeScmResults( Map context )
+    private void mergeScmResults( Map<String, Object> context )
     {
-        ScmResult oldScmResult = AbstractContinuumAction.getOldScmResult( context, null );
+        ScmResult oldScmResult = AbstractContinuumAction.getOldScmResult( context );
         ScmResult newScmResult = AbstractContinuumAction.getScmResult( context, null );
 
         if ( oldScmResult != null )
@@ -406,11 +405,11 @@
             }
         }
     }
-    
-    private void performAction( String actionName, Map context )
+
+    private void performAction( String actionName, Map<String, Object> context )
         throws TaskExecutionException
     {
-        TaskExecutionException exception = null;
+        TaskExecutionException exception;
 
         try
         {
@@ -426,18 +425,18 @@
         {
             exception = new TaskExecutionException( "Error executing action '" + actionName + "'", e );
         }
-        
+
         ScmResult result = new ScmResult();
-        
+
         result.setSuccess( false );
-        
+
         result.setException( ContinuumUtils.throwableToString( exception ) );
-        
+
         context.put( AbstractContinuumAction.KEY_SCM_RESULT, result );
-        
+
         throw exception;
     }
-    
+
     private String convertScmResultToError( ScmResult result )
     {
         String error = "";
@@ -479,19 +478,19 @@
 
         return error;
     }
-    
-    private void updateProjectScmRoot( Map context, String error )
+
+    private void updateProjectScmRoot( Map<String, Object> context, String error )
         throws TaskExecutionException
     {
         ProjectScmRoot projectScmRoot = AbstractContinuumAction.getProjectScmRoot( context );
-        
+
         try
         {
             projectScmRoot.setState( ContinuumProjectState.ERROR );
             projectScmRoot.setError( error );
 
             projectScmRootDao.updateProjectScmRoot( projectScmRoot );
-            
+
             context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT, projectScmRoot );
         }
         catch ( ContinuumStoreException e )
@@ -500,13 +499,13 @@
         }
     }
 
-    private void buildProjects( int projectGroupId, Map<Integer, Integer> projectsAndBuildDefinitionsMap, 
-                                int trigger, Map<Integer, ScmResult> scmResultMap )
+    private void buildProjects( int projectGroupId, Map<Integer, Integer> projectsAndBuildDefinitionsMap, int trigger,
+                                Map<Integer, ScmResult> scmResultMap )
         throws TaskExecutionException
     {
         List<Project> projects = projectDao.getProjectsWithDependenciesByGroupId( projectGroupId );
         List<Project> projectList;
-        
+
         try
         {
             projectList = ProjectSorter.getSortedProjects( projects, log );
@@ -521,31 +520,30 @@
 
         for ( Project project : projectList )
         {
-            //boolean shouldBuild = false;
-            int buildDefinitionId = 0;
-            
+            int buildDefinitionId;
+
             if ( projectsAndBuildDefinitionsMap.get( project.getId() ) != null )
             {
-                buildDefinitionId = projectsAndBuildDefinitionsMap.get( project.getId() );                
-                //shouldBuild = true;         
+                buildDefinitionId = projectsAndBuildDefinitionsMap.get( project.getId() );
+
                 try
                 {
                     BuildDefinition buildDefinition = buildDefinitionDao.getBuildDefinition( buildDefinitionId );
                     projectsBuildDefinitionsMap.put( project.getId(), buildDefinition );
                     projectsToBeBuilt.add( project );
                 }
-                catch( ContinuumStoreException e )
+                catch ( ContinuumStoreException e )
                 {
                     log.error( "Error while creating build object", e );
                     throw new TaskExecutionException( "Error while creating build object", e );
                 }
             }
-            else if ( project.getState() == ContinuumProjectState.CHECKEDOUT || project.getState() == ContinuumProjectState.NEW ) //check if no build result yet for project
+            else if ( project.getState() == ContinuumProjectState.CHECKEDOUT ||
+                project.getState() == ContinuumProjectState.NEW ) //check if no build result yet for project
             {
                 try
                 {
                     //get default build definition for project
-                    //buildDefinitionId = buildDefinitionDao.getDefaultBuildDefinition( project.getId() ).getId();
                     BuildDefinition buildDefinition = buildDefinitionDao.getDefaultBuildDefinition( project.getId() );
                     projectsBuildDefinitionsMap.put( project.getId(), buildDefinition );
                     projectsToBeBuilt.add( project );
@@ -562,10 +560,10 @@
                 }
             }
         }
-        
+
         try
         {
-            Map context = new HashMap();
+            Map<String, Object> context = new HashMap<String, Object>();
             context.put( AbstractContinuumAction.KEY_PROJECTS, projectsToBeBuilt );
             context.put( AbstractContinuumAction.KEY_PROJECTS_BUILD_DEFINITIONS_MAP, projectsBuildDefinitionsMap );
             context.put( AbstractContinuumAction.KEY_TRIGGER, trigger );
@@ -576,8 +574,8 @@
         }
         catch ( ActionNotFoundException e )
         {
-           log.error( "Error looking up action 'build-project'" );
-           throw new TaskExecutionException( "Error looking up action 'build-project'", e );
+            log.error( "Error looking up action 'build-project'" );
+            throw new TaskExecutionException( "Error looking up action 'build-project'", e );
         }
         catch ( Exception e )
         {



Mime
View raw message