continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r209762 - in /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum: buildcontroller/DefaultBuildController.java core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
Date Fri, 08 Jul 2005 13:17:23 GMT
Author: trygvis
Date: Fri Jul  8 06:17:21 2005
New Revision: 209762

URL: http://svn.apache.org/viewcvs?rev=209762&view=rev
Log:
o Handling the errors in the correct place.

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=209762&r1=209761&r2=209762&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
Fri Jul  8 06:17:21 2005
@@ -87,6 +87,12 @@
         }
 
         // ----------------------------------------------------------------------
+        // TODO: Centralize the error handling from the SCM related actions.
+        // ContinuumScmResult should return a ContinuumScmResult from all
+        // methods, even in a case of failure.
+        // ----------------------------------------------------------------------
+
+        // ----------------------------------------------------------------------
         //
         // ----------------------------------------------------------------------
 
@@ -128,27 +134,7 @@
                     // Check to see if there was a error while checking out the project
                     // ----------------------------------------------------------------------
 
-                    if ( StringUtils.isEmpty( checkoutErrorMessage ) && StringUtils.isEmpty(
checkoutErrorException ) )
-                    {
-                        // TODO: remove once CONTINUUM-193 is resolved
-                        UpdateScmResult updateScmResult = new UpdateScmResult();
-
-                        updateScmResult.setCommandOutput( checkOutScmResult.getCommandOutput()
);
-
-                        updateScmResult.setProviderMessage( checkOutScmResult.getProviderMessage()
);
-
-                        updateScmResult.setSuccess( false );
-
-                        for ( Iterator it = checkOutScmResult.getCheckedOutFiles().iterator();
it.hasNext(); )
-                        {
-                            ScmFile scmFile = (ScmFile) it.next();
-
-                            updateScmResult.getUpdatedFiles().add( scmFile );
-                        }
-
-                        actionContext.put( AbstractContinuumAction.KEY_UPDATE_SCM_RESULT,
updateScmResult );
-                    }
-                    else
+                    if ( !StringUtils.isEmpty( checkoutErrorMessage ) || !StringUtils.isEmpty(
checkoutErrorException ) )
                     {
                         ContinuumBuild build = makeBuildResult( scmResult, startTime, forced
);
 
@@ -172,6 +158,24 @@
 
                         return;
                      }
+
+                    // TODO: remove once CONTINUUM-193 is resolved
+                    UpdateScmResult updateScmResult = new UpdateScmResult();
+
+                    updateScmResult.setCommandOutput( checkOutScmResult.getCommandOutput()
);
+
+                    updateScmResult.setProviderMessage( checkOutScmResult.getProviderMessage()
);
+
+                    updateScmResult.setSuccess( false );
+
+                    for ( Iterator it = checkOutScmResult.getCheckedOutFiles().iterator();
it.hasNext(); )
+                    {
+                        ScmFile scmFile = (ScmFile) it.next();
+
+                        updateScmResult.getUpdatedFiles().add( scmFile );
+                    }
+
+                    actionContext.put( AbstractContinuumAction.KEY_UPDATE_SCM_RESULT, updateScmResult
);
                 }
 
                 scmResult = (UpdateScmResult) actionContext.get( AbstractContinuumAction.KEY_UPDATE_SCM_RESULT
);
@@ -188,7 +192,35 @@
 
                 ContinuumBuild build = makeBuildResult( scmResult, startTime, forced );
 
-                build.setError( ContinuumUtils.throwableToString( e ) );
+                String error;
+
+                // This can happen if the "update project from scm" action fails
+                if ( e instanceof ContinuumScmException )
+                {
+                    ContinuumScmException ex = (ContinuumScmException) e;
+
+                    ScmResult result = ex.getResult();
+
+                    error = "";
+
+                    if ( result != null )
+                    {
+                        error += "Provider message: " + StringUtils.clean( result.getProviderMessage()
) + System.getProperty( "line.separator" );
+                        error += "Command output: " + System.getProperty( "line.separator"
);
+                        error += "-------------------------------------------------------------------------------";
+                        error += StringUtils.clean( result.getCommandOutput() ) + System.getProperty(
"line.separator" );
+                        error += "-------------------------------------------------------------------------------";
+                    }
+
+                    error += "Exception:" + System.getProperty( "line.separator" );
+                    error += ContinuumUtils.throwableToString( e );
+                }
+                else
+                {
+                    error = ContinuumUtils.throwableToString( e );
+                }
+
+                build.setError( error );
 
                 buildId = storeBuild( project, build );
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java?rev=209762&r1=209761&r2=209762&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
Fri Jul  8 06:17:21 2005
@@ -33,23 +33,15 @@
     {
         ContinuumProject project = getProject( context );
 
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
-        getNotifier().checkoutStarted( project );
-
         UpdateScmResult updateScmResult = null;
 
         try
         {
+            getNotifier().checkoutStarted( project );
+
             updateScmResult = getScm().updateProject( project );
 
             context.put( KEY_UPDATE_SCM_RESULT, updateScmResult );
-        }
-        catch( Throwable e )
-        {
-            CheckoutProjectContinuumAction.handleThrowable( e, context );
         }
         finally
         {



Mime
View raw message