continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r209439 - in /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum: buildcontroller/DefaultBuildController.java core/action/ExecuteBuilderContinuumAction.java utils/ContinuumUtils.java
Date Wed, 06 Jul 2005 10:20:45 GMT
Author: trygvis
Date: Wed Jul  6 03:20:41 2005
New Revision: 209439

URL: http://svn.apache.org/viewcvs?rev=209439&view=rev
Log:
Fixing http://jira.codehaus.org/browse/CONTINUUM-160: "results with building state".
o Fixing a related issue where a exception from the ExecuteBuilder action would
  result in a duplicate build result.

Added:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
  (with props)
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/ExecuteBuilderContinuumAction.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=209439&r1=209438&r2=209439&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
Wed Jul  6 03:20:41 2005
@@ -16,8 +16,6 @@
  * limitations under the License.
  */
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -33,6 +31,7 @@
 import org.apache.maven.continuum.scm.UpdateScmResult;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.apache.maven.continuum.utils.ContinuumUtils;
 
 import org.codehaus.plexus.action.ActionManager;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -185,7 +184,7 @@
 
                 ContinuumBuild build = makeBuildResult( scmResult, startTime, forced );
 
-                build.setError( throwableToString( e ) );
+                build.setError( ContinuumUtils.throwableToString( e ) );
 
                 buildId = storeBuild( project, build );
 
@@ -261,23 +260,5 @@
         Collection builds = store.getBuildsForProject( project.getId(), 0, 0 );
 
         return builds.size() == 0;
-    }
-
-    public static String throwableToString( Throwable error )
-    {
-        if ( error == null )
-        {
-            return "";
-        }
-
-        StringWriter writer = new StringWriter();
-
-        PrintWriter printer = new PrintWriter( writer );
-
-        error.printStackTrace( printer );
-
-        printer.flush();
-
-        return writer.getBuffer().toString();
     }
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=209439&r1=209438&r2=209439&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
Wed Jul  6 03:20:41 2005
@@ -21,13 +21,14 @@
 import java.util.Map;
 
 import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.utils.ContinuumUtils;
+import org.apache.maven.continuum.buildcontroller.DefaultBuildController;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutionResult;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.scm.UpdateScmResult;
-import org.apache.maven.continuum.store.AbstractContinuumStore;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -110,6 +111,14 @@
             build.setStandardError( result.getStandardError() );
 
             build.setExitCode( result.getExitCode() );
+        }
+        catch( Throwable e )
+        {
+            build.setState( ContinuumProjectState.ERROR );
+
+            build.setSuccess( false );
+
+            build.setError( ContinuumUtils.throwableToString( e ) );
         }
         finally
         {

Added: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java?rev=209439&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
(added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
Wed Jul  6 03:20:41 2005
@@ -0,0 +1,45 @@
+package org.apache.maven.continuum.utils;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.StringWriter;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class ContinuumUtils
+{
+    public static String throwableToString( Throwable error )
+    {
+        if ( error == null )
+        {
+            return "";
+        }
+
+        StringWriter writer = new StringWriter();
+
+        PrintWriter printer = new PrintWriter( writer );
+
+        error.printStackTrace( printer );
+
+        printer.flush();
+
+        return writer.getBuffer().toString();
+    }
+}

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/ContinuumUtils.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message