mirror of https://github.com/apache/maven.git
Code cleanup - It's better (for perfs) to use a chain of append() calls than a unique append with several Strings concatenations
This commit is contained in:
parent
c747fbe4c9
commit
c8e94a5b08
|
@ -199,13 +199,14 @@ public class AbstractArtifactResolutionException
|
||||||
if ( message == null || !message.contains( "from the specified remote repositories:" ) )
|
if ( message == null || !message.contains( "from the specified remote repositories:" ) )
|
||||||
{
|
{
|
||||||
sb.append( LS );
|
sb.append( LS );
|
||||||
sb.append( " " + groupId + ":" + artifactId + ":" + type + ":" + version );
|
sb.append( " " ).append( groupId ).append( ":" ).append( artifactId ).append( ":" ).append( type ).append(
|
||||||
|
":" ).append( version );
|
||||||
sb.append( LS );
|
sb.append( LS );
|
||||||
if ( remoteRepositories != null )
|
if ( remoteRepositories != null )
|
||||||
{
|
{
|
||||||
sb.append( LS );
|
sb.append( LS );
|
||||||
sb.append( "from the specified remote repositories:" );
|
sb.append( "from the specified remote repositories:" );
|
||||||
sb.append( LS + " " );
|
sb.append( LS ).append( " " );
|
||||||
|
|
||||||
if ( remoteRepositories.isEmpty() )
|
if ( remoteRepositories.isEmpty() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,7 +85,8 @@ public class ModelValidationResult
|
||||||
//
|
//
|
||||||
for ( int i = 0; i < messages.size(); i++ )
|
for ( int i = 0; i < messages.size(); i++ )
|
||||||
{
|
{
|
||||||
message.append( indentation + "[" + i + "] " + messages.get( i ) + NEWLINE );
|
message.append( indentation ).append( "[" ).append( i ).append( "] " ).append( messages.get( i ) ).append(
|
||||||
|
NEWLINE );
|
||||||
}
|
}
|
||||||
|
|
||||||
return message.toString();
|
return message.toString();
|
||||||
|
|
|
@ -129,12 +129,12 @@ implements Iterable<ArtifactMetadata>
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder( 256 );
|
StringBuilder sb = new StringBuilder( 256 );
|
||||||
sb.append( "[scope=" + scope.getScope() );
|
sb.append( "[scope=" ).append( scope.getScope() );
|
||||||
if ( classpath != null )
|
if ( classpath != null )
|
||||||
{
|
{
|
||||||
for ( ArtifactMetadata md : classpath )
|
for ( ArtifactMetadata md : classpath )
|
||||||
{
|
{
|
||||||
sb.append( ": " + md.toString() + '{' + md.getArtifactUri() + '}' );
|
sb.append( ": " ).append( md.toString() ).append( '{' ).append( md.getArtifactUri() ).append( '}' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sb.append( ']' );
|
sb.append( ']' );
|
||||||
|
|
|
@ -485,13 +485,13 @@ public class MetadataGraph
|
||||||
}
|
}
|
||||||
for ( MetadataGraphVertex v : vertices )
|
for ( MetadataGraphVertex v : vertices )
|
||||||
{
|
{
|
||||||
sb.append( "Vertex: " + v.getMd().toString() + "\n" );
|
sb.append( "Vertex: " ).append( v.getMd().toString() ).append( "\n" );
|
||||||
List<MetadataGraphEdge> ins = getIncidentEdges( v );
|
List<MetadataGraphEdge> ins = getIncidentEdges( v );
|
||||||
if ( ins != null )
|
if ( ins != null )
|
||||||
{
|
{
|
||||||
for ( MetadataGraphEdge e : ins )
|
for ( MetadataGraphEdge e : ins )
|
||||||
{
|
{
|
||||||
sb.append( " from : " + e.toString() + "\n" );
|
sb.append( " from : " ).append( e.toString() ).append( "\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -504,7 +504,7 @@ public class MetadataGraph
|
||||||
{
|
{
|
||||||
for ( MetadataGraphEdge e : outs )
|
for ( MetadataGraphEdge e : outs )
|
||||||
{
|
{
|
||||||
sb.append( " to : " + e.toString() + "\n" );
|
sb.append( " to : " ).append( e.toString() ).append( "\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -192,17 +192,17 @@ public class MetadataGraphVertex
|
||||||
return super.hashCode();
|
return super.hashCode();
|
||||||
}
|
}
|
||||||
StringBuilder hashString = new StringBuilder( 128 );
|
StringBuilder hashString = new StringBuilder( 128 );
|
||||||
hashString.append( md.groupId + "|" );
|
hashString.append( md.groupId ).append( "|" );
|
||||||
hashString.append( md.artifactId + "|" );
|
hashString.append( md.artifactId ).append( "|" );
|
||||||
|
|
||||||
if ( compareVersion )
|
if ( compareVersion )
|
||||||
{
|
{
|
||||||
hashString.append( md.version + "|" );
|
hashString.append( md.version ).append( "|" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( compareScope )
|
if ( compareScope )
|
||||||
{
|
{
|
||||||
hashString.append( md.getArtifactScope() + "|" );
|
hashString.append( md.getArtifactScope() ).append( "|" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashString.toString().hashCode();
|
return hashString.toString().hashCode();
|
||||||
|
|
|
@ -144,8 +144,8 @@ public class PluginParameterException
|
||||||
String alias = param.getAlias();
|
String alias = param.getAlias();
|
||||||
if ( StringUtils.isNotEmpty( alias ) && !alias.equals( param.getName() ) )
|
if ( StringUtils.isNotEmpty( alias ) && !alias.equals( param.getName() ) )
|
||||||
{
|
{
|
||||||
messageBuffer.append(
|
messageBuffer.append( "\n\n-OR-\n\n<configuration>\n ...\n <" ).append( alias ).append(
|
||||||
"\n\n-OR-\n\n<configuration>\n ...\n <" + alias + ">VALUE</" + alias + ">\n</configuration>\n" );
|
">VALUE</" ).append( alias ).append( ">\n</configuration>\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,13 +55,14 @@ public final class CLIReportingUtils
|
||||||
version.append( createMavenVersionString( properties ) ).append( LS );
|
version.append( createMavenVersionString( properties ) ).append( LS );
|
||||||
version.append( reduce( properties.getProperty( "distributionShortName" ) + " home: "
|
version.append( reduce( properties.getProperty( "distributionShortName" ) + " home: "
|
||||||
+ System.getProperty( "maven.home", "<unknown maven home>" ) ) ).append( LS );
|
+ System.getProperty( "maven.home", "<unknown maven home>" ) ) ).append( LS );
|
||||||
version.append( "Java version: " + System.getProperty( "java.version", "<unknown java version>" )
|
version.append( "Java version: " ).append(
|
||||||
+ ", vendor: " + System.getProperty( "java.vendor", "<unknown vendor>" ) ).append( LS );
|
System.getProperty( "java.version", "<unknown java version>" ) ).append( ", vendor: " ).append(
|
||||||
version.append( "Java home: " + System.getProperty( "java.home", "<unknown java home>" ) ).append( LS );
|
System.getProperty( "java.vendor", "<unknown vendor>" ) ).append( LS );
|
||||||
version.append( "Default locale: " + Locale.getDefault() + ", platform encoding: "
|
version.append( "Java home: " ).append( System.getProperty( "java.home", "<unknown java home>" ) ).append( LS );
|
||||||
+ System.getProperty( "file.encoding", "<unknown encoding>" ) ).append( LS );
|
version.append( "Default locale: " ).append( Locale.getDefault() ).append( ", platform encoding: " ).append(
|
||||||
version.append( "OS name: \"" + Os.OS_NAME + "\", version: \"" + Os.OS_VERSION + "\", arch: \"" + Os.OS_ARCH
|
System.getProperty( "file.encoding", "<unknown encoding>" ) ).append( LS );
|
||||||
+ "\", family: \"" + Os.OS_FAMILY + "\"" );
|
version.append( "OS name: \"" ).append( Os.OS_NAME ).append( "\", version: \"" ).append( Os.OS_VERSION ).append(
|
||||||
|
"\", arch: \"" ).append( Os.OS_ARCH ).append( "\", family: \"" ).append( Os.OS_FAMILY ).append( "\"" );
|
||||||
return version.toString();
|
return version.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class CLIManagerTest
|
||||||
for ( Option option : new CLIManagerExtension().getOptions() )
|
for ( Option option : new CLIManagerExtension().getOptions() )
|
||||||
{
|
{
|
||||||
a = !a;
|
a = !a;
|
||||||
sb.append( "<tr class='" + ( a ? 'a' : 'b' ) + "'><td><code>-<a name='" );
|
sb.append( "<tr class='" ).append( a ? 'a' : 'b' ).append( "'><td><code>-<a name='" );
|
||||||
sb.append( option.getOpt() );
|
sb.append( option.getOpt() );
|
||||||
sb.append( "'>" );
|
sb.append( "'>" );
|
||||||
sb.append( option.getOpt() );
|
sb.append( option.getOpt() );
|
||||||
|
|
Loading…
Reference in New Issue