maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r895009 - /maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java
Date Fri, 01 Jan 2010 13:30:11 GMT
Author: bentmann
Date: Fri Jan  1 13:30:11 2010
New Revision: 895009

URL: http://svn.apache.org/viewvc?rev=895009&view=rev
Log:
o Polished logging

Modified:
    maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java

Modified: maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java?rev=895009&r1=895008&r2=895009&view=diff
==============================================================================
--- maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java
(original)
+++ maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java
Fri Jan  1 13:30:11 2010
@@ -438,7 +438,7 @@
         };
 
         // used if failFast is false
-        String failedPatches = null;
+        List failedPatches = new ArrayList();
 
         for ( Iterator it = patchesApplied.entrySet().iterator(); it.hasNext(); )
         {
@@ -449,24 +449,19 @@
             try
             {
                 getLog().info( "Applying patch: " + patchName );
-                int result = executeCommandLine( cli, consumer, consumer );
 
-                getLog().info( "patch command returned: " + result );
+                int result = executeCommandLine( cli, consumer, consumer );
 
                 if ( result != 0 )
                 {
                     if ( failFast )
                     {
-                        throw new MojoExecutionException( "Patch command failed (exit value
!= 0) for " + patchName
-                            + ". Please see debug output for more information." );
+                        throw new MojoExecutionException( "Patch command failed with exit
code " + result + " for "
+                            + patchName + ". Please see console and debug output for more
information." );
                     }
                     else
                     {
-                        if ( failedPatches == null )
-                        {
-                            failedPatches = new String();
-                        }
-                        failedPatches = failedPatches + patchName + "\n";
+                        failedPatches.add( patchName );
                     }
                 }
             }
@@ -477,10 +472,13 @@
             }
         }
 
-        if ( failedPatches != null )
+        if ( !failedPatches.isEmpty() )
         {
-            getLog().info( "Failed applying one or more patches:" );
-            getLog().info( failedPatches );
+            getLog().error( "Failed applying one or more patches:" );
+            for ( Iterator it = failedPatches.iterator(); it.hasNext(); )
+            {
+                getLog().error( "* " + it.next() );
+            }
             throw new MojoExecutionException( "Patch command failed for one or more patches."
                 + " Please see console and debug output for more information." );
         }
@@ -493,12 +491,17 @@
     {
         if ( getLog().isDebugEnabled() )
         {
-            getLog().debug( "Executing:\n" + cli + "\n" );
+            getLog().debug( "Executing: " + cli );
         }
 
-        getLog().info( Commandline.toString( cli.getShellCommandline() ) );
+        int result = CommandLineUtils.executeCommandLine( cli, out, err );
+
+        if ( getLog().isDebugEnabled() )
+        {
+            getLog().debug( "Exit code: " + result );
+        }
 
-        return CommandLineUtils.executeCommandLine( cli, out, err );
+        return result;
     }
 
     private void writeTrackingFile( Map patchesApplied )



Mime
View raw message