You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2008/11/01 18:38:11 UTC

svn commit: r709731 - /maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java

Author: hboutemy
Date: Sat Nov  1 10:38:11 2008
New Revision: 709731

URL: http://svn.apache.org/viewvc?rev=709731&view=rev
Log:
use StringBuffer to build message

Modified:
    maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java

Modified: maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java?rev=709731&r1=709730&r2=709731&view=diff
==============================================================================
--- maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java (original)
+++ maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java Sat Nov  1 10:38:11 2008
@@ -88,9 +88,8 @@
                     {
                         if ( tcs[i].matchesRequirements( params ) )
                         {
-                            getLog(  ).info( "Toolchain (" + type + ") matched:" + tcs[i] );
-                            toolchainManager.storeToolchainToBuildContext( tcs[i],
-                                session );
+                            getLog().info( "Toolchain (" + type + ") matched:" + tcs[i] );
+                            toolchainManager.storeToolchainToBuildContext( tcs[i], session );
                             matched = true;
                             break;
                         }
@@ -102,34 +101,36 @@
                 }
                 catch ( MisconfiguredToolchainException ex )
                 {
-                    throw new MojoExecutionException( "Misconfigured toolchains.",
-                        ex );
+                    throw new MojoExecutionException( "Misconfigured toolchains.", ex );
                 }
             }
             if ( !nonMatchedTypes.isEmpty() )
             {
                 //TODO add the default toolchain instance if defined??
-                String str = "Cannot find matching toolchain definitions for the following toolchain types:";
+                StringBuffer buff = new StringBuffer();
+                buff.append( "Cannot find matching toolchain definitions for the following toolchain types:" );
                 Iterator it = nonMatchedTypes.iterator();
                 while ( it.hasNext() )
                 {
                     String type = (String) it.next();
-                    str = str + "\n" + type;
+                    buff.append( '\n' );
+                    buff.append( type );
                     Map params = toolchains.getParams( type );
                     if ( params.size() > 0 )
                     {
                         Iterator it2 = params.keySet().iterator();
-                        str = str + " [";
+                        buff.append( " [" );
                         while ( it2.hasNext() )
                         {
                             String string = (String) it2.next();
-                            str = str + " " + string + "='" + params.get( string ) + "' ";
+                            buff.append( " " + string + "='" + params.get( string ) + "' " );
                         }
-                        str = str + "]";
+                        buff.append( ']' );
                     }
                 }
-                getLog().error( str );
-                throw new MojoFailureException( str + "\nPlease make sure you define the required toolchains in your ~/.m2/toolchains.xml file." );
+                getLog().error( buff.toString() );
+                throw new MojoFailureException( buff.toString()
+                		+ "\nPlease make sure you define the required toolchains in your ~/.m2/toolchains.xml file." );
             }
         }
         else