[MNG-5934] String handling issues identified by PMD

This commit is contained in:
Alex Henrie 2016-01-19 20:04:59 +01:00 committed by Michael Osipov
parent 0514c1b14e
commit 8d91726f78
38 changed files with 98 additions and 99 deletions

View File

@ -230,7 +230,7 @@ public class DefaultArtifact
{ {
StringBuilder sb = new StringBuilder( 128 ); StringBuilder sb = new StringBuilder( 128 );
sb.append( getGroupId() ); sb.append( getGroupId() );
sb.append( ":" ); sb.append( ':' );
appendArtifactTypeClassifierString( sb ); appendArtifactTypeClassifierString( sb );
return sb.toString(); return sb.toString();
} }
@ -238,11 +238,11 @@ public class DefaultArtifact
private void appendArtifactTypeClassifierString( StringBuilder sb ) private void appendArtifactTypeClassifierString( StringBuilder sb )
{ {
sb.append( getArtifactId() ); sb.append( getArtifactId() );
sb.append( ":" ); sb.append( ':' );
sb.append( getType() ); sb.append( getType() );
if ( hasClassifier() ) if ( hasClassifier() )
{ {
sb.append( ":" ); sb.append( ':' );
sb.append( getClassifier() ); sb.append( getClassifier() );
} }
} }
@ -285,10 +285,10 @@ public class DefaultArtifact
if ( getGroupId() != null ) if ( getGroupId() != null )
{ {
sb.append( getGroupId() ); sb.append( getGroupId() );
sb.append( ":" ); sb.append( ':' );
} }
appendArtifactTypeClassifierString( sb ); appendArtifactTypeClassifierString( sb );
sb.append( ":" ); sb.append( ':' );
if ( getBaseVersionInternal() != null ) if ( getBaseVersionInternal() != null )
{ {
sb.append( getBaseVersionInternal() ); sb.append( getBaseVersionInternal() );
@ -299,7 +299,7 @@ public class DefaultArtifact
} }
if ( scope != null ) if ( scope != null )
{ {
sb.append( ":" ); sb.append( ':' );
sb.append( scope ); sb.append( scope );
} }
return sb.toString(); return sb.toString();

View File

@ -160,7 +160,7 @@ public class ArtifactRepositoryPolicy
buffer.append( checksumPolicy ); buffer.append( checksumPolicy );
buffer.append( ", updates=" ); buffer.append( ", updates=" );
buffer.append( updatePolicy ); buffer.append( updatePolicy );
buffer.append( "}" ); buffer.append( '}' );
return buffer.toString(); return buffer.toString();
} }

View File

@ -175,7 +175,7 @@ public class AbstractArtifactResolutionException
for ( Iterator<String> i = path.iterator(); i.hasNext(); num++ ) for ( Iterator<String> i = path.iterator(); i.hasNext(); num++ )
{ {
sb.append( indentation ); sb.append( indentation );
sb.append( "\t" ); sb.append( '\t' );
sb.append( num ); sb.append( num );
sb.append( ") " ); sb.append( ") " );
sb.append( i.next() ); sb.append( i.next() );
@ -201,8 +201,8 @@ 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( " " ).append( groupId ).append( ":" ).append( artifactId ).append( ":" ).append( type ).append( sb.append( " " ).append( groupId ).append( ':' ).append( artifactId ).append( ':' ).append( type ).append(
":" ).append( version ); ':' ).append( version );
sb.append( LS ); sb.append( LS );
if ( remoteRepositories != null ) if ( remoteRepositories != null )
{ {
@ -235,10 +235,10 @@ public class AbstractArtifactResolutionException
sb.append( ", snapshots=" ).append( snapshots.isEnabled() ); sb.append( ", snapshots=" ).append( snapshots.isEnabled() );
} }
sb.append( ")" ); sb.append( ')' );
if ( i.hasNext() ) if ( i.hasNext() )
{ {
sb.append( "," ).append( LS ).append( " " ); sb.append( ',' ).append( LS ).append( " " );
} }
} }
} }

View File

@ -84,8 +84,9 @@ public class MultipleArtifactsNotFoundException
private static String constructMessage( List<Artifact> artifacts ) private static String constructMessage( List<Artifact> artifacts )
{ {
StringBuilder buffer = new StringBuilder( "Missing:\n" ); StringBuilder buffer = new StringBuilder( 256 );
buffer.append( "Missing:\n" );
buffer.append( "----------\n" ); buffer.append( "----------\n" );
int counter = 0; int counter = 0;

View File

@ -111,7 +111,7 @@ public class DefaultArtifactVersion
{ {
comparable = new ComparableVersion( version ); comparable = new ComparableVersion( version );
int index = version.indexOf( "-" ); int index = version.indexOf( '-' );
String part1; String part1;
String part2 = null; String part2 = null;

View File

@ -178,17 +178,17 @@ public class Restriction
{ {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
buf.append( isLowerBoundInclusive() ? "[" : "(" ); buf.append( isLowerBoundInclusive() ? '[' : '(' );
if ( getLowerBound() != null ) if ( getLowerBound() != null )
{ {
buf.append( getLowerBound().toString() ); buf.append( getLowerBound().toString() );
} }
buf.append( "," ); buf.append( ',' );
if ( getUpperBound() != null ) if ( getUpperBound() != null )
{ {
buf.append( getUpperBound().toString() ); buf.append( getUpperBound().toString() );
} }
buf.append( isUpperBoundInclusive() ? "]" : ")" ); buf.append( isUpperBoundInclusive() ? ']' : ')' );
return buf.toString(); return buf.toString();
} }

View File

@ -104,8 +104,8 @@ public class VersionRange
while ( process.startsWith( "[" ) || process.startsWith( "(" ) ) while ( process.startsWith( "[" ) || process.startsWith( "(" ) )
{ {
int index1 = process.indexOf( ")" ); int index1 = process.indexOf( ')' );
int index2 = process.indexOf( "]" ); int index2 = process.indexOf( ']' );
int index = index2; int index = index2;
if ( index2 < 0 || index1 < index2 ) if ( index2 < 0 || index1 < index2 )
@ -171,7 +171,7 @@ public class VersionRange
Restriction restriction; Restriction restriction;
int index = process.indexOf( "," ); int index = process.indexOf( ',' );
if ( index < 0 ) if ( index < 0 )
{ {

View File

@ -151,7 +151,7 @@ class DefaultProblem
{ {
StringBuilder buffer = new StringBuilder( 128 ); StringBuilder buffer = new StringBuilder( 128 );
buffer.append( "[" ).append( getSeverity() ).append( "] " ); buffer.append( '[' ).append( getSeverity() ).append( "] " );
buffer.append( getMessage() ); buffer.append( getMessage() );
buffer.append( " @ " ).append( getLocation() ); buffer.append( " @ " ).append( getLocation() );

View File

@ -175,11 +175,11 @@ public class DefaultArtifactRepository
public String toString() public String toString()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder( 256 );
sb.append( " id: " ).append( getId() ).append( "\n" ); sb.append( " id: " ).append( getId() ).append( '\n' );
sb.append( " url: " ).append( getUrl() ).append( "\n" ); sb.append( " url: " ).append( getUrl() ).append( '\n' );
sb.append( " layout: " ).append( layout != null ? layout : "none" ).append( "\n" ); sb.append( " layout: " ).append( layout != null ? layout : "none" ).append( '\n' );
if ( snapshots != null ) if ( snapshots != null )
{ {

View File

@ -45,10 +45,10 @@ public class ManagedVersionMap
while ( iter.hasNext() ) while ( iter.hasNext() )
{ {
String key = iter.next(); String key = iter.next();
buffer.append( key ).append( "=" ).append( get( key ) ); buffer.append( key ).append( '=' ).append( get( key ) );
if ( iter.hasNext() ) if ( iter.hasNext() )
{ {
buffer.append( "\n" ); buffer.append( '\n' );
} }
} }
return buffer.toString(); return buffer.toString();

View File

@ -85,7 +85,7 @@ public class ModelValidationResult
// //
for ( int i = 0; i < messages.size(); i++ ) for ( int i = 0; i < messages.size(); i++ )
{ {
message.append( indentation ).append( "[" ).append( i ).append( "] " ).append( messages.get( i ) ).append( message.append( indentation ).append( '[' ).append( i ).append( "] " ).append( messages.get( i ) ).append(
NEWLINE ); NEWLINE );
} }

View File

@ -322,21 +322,19 @@ public class MetadataResolutionResult
public String toString() public String toString()
{ {
StringBuilder sb = new StringBuilder(); if ( artifacts == null )
return "";
if ( artifacts != null ) StringBuilder sb = new StringBuilder( 256 );
int i = 1;
sb.append( "---------\n" );
sb.append( artifacts.size() ).append( '\n' );
for ( Artifact a : artifacts )
{ {
int i = 1; sb.append( i ).append( ' ' ).append( a ).append( '\n' );
sb.append( "---------" ).append( "\n" ); i++;
sb.append( artifacts.size() ).append( "\n" );
for ( Artifact a : artifacts )
{
sb.append( i ).append( " " ).append( a ).append( "\n" );
i++;
}
sb.append( "---------" ).append( "\n" );
} }
sb.append( "---------\n" );
return sb.toString(); return sb.toString();
} }

View File

@ -486,13 +486,13 @@ public class MetadataGraph
} }
for ( MetadataGraphVertex v : vertices ) for ( MetadataGraphVertex v : vertices )
{ {
sb.append( "Vertex: " ).append( v.getMd().toString() ).append( "\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 : " ).append( e.toString() ).append( "\n" ); sb.append( " from : " ).append( e.toString() ).append( '\n' );
} }
} }
else else
@ -505,7 +505,7 @@ public class MetadataGraph
{ {
for ( MetadataGraphEdge e : outs ) for ( MetadataGraphEdge e : outs )
{ {
sb.append( " to : " ).append( e.toString() ).append( "\n" ); sb.append( " to : " ).append( e.toString() ).append( '\n' );
} }
} }
else else

View File

@ -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 ).append( "|" ); hashString.append( md.groupId ).append( '|' );
hashString.append( md.artifactId ).append( "|" ); hashString.append( md.artifactId ).append( '|' );
if ( compareVersion ) if ( compareVersion )
{ {
hashString.append( md.version ).append( "|" ); hashString.append( md.version ).append( '|' );
} }
if ( compareScope ) if ( compareScope )
{ {
hashString.append( md.getArtifactScope() ).append( "|" ); hashString.append( md.getArtifactScope() ).append( '|' );
} }
return hashString.toString().hashCode(); return hashString.toString().hashCode();

View File

@ -59,7 +59,7 @@ public class LegacyLocalRepositoryManager
path.append( artifact.getGroupId() ).append( '/' ); path.append( artifact.getGroupId() ).append( '/' );
path.append( artifact.getExtension() ).append( 's' ).append( '/' ); path.append( artifact.getExtension() ).append( "s/" );
path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() ); path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );

View File

@ -33,7 +33,7 @@ public abstract class AbstractProjectInheritanceTestCase
{ {
String className = getClass().getPackage().getName(); String className = getClass().getPackage().getName();
return className.substring( className.lastIndexOf( "." ) + 1 ); return className.substring( className.lastIndexOf( '.' ) + 1 );
} }
protected File projectFile( String name ) protected File projectFile( String name )

View File

@ -132,15 +132,15 @@ public class MavenArtifactRepository
public String toString() public String toString()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder( 256 );
sb.append( " id: " ).append( getId() ).append( "\n" ); sb.append( " id: " ).append( getId() ).append( '\n' );
sb.append( " url: " ).append( getUrl() ).append( "\n" ); sb.append( " url: " ).append( getUrl() ).append( '\n' );
sb.append( " layout: " ).append( layout != null ? layout : "none" ).append( "\n" ); sb.append( " layout: " ).append( layout != null ? layout : "none" ).append( '\n' );
if ( proxy != null ) if ( proxy != null )
{ {
sb.append( " proxy: " ).append( proxy.getHost() ).append( ":" ).append( proxy.getPort() ).append( "\n" ); sb.append( " proxy: " ).append( proxy.getHost() ).append( ':' ).append( proxy.getPort() ).append( '\n' );
} }
if ( snapshots != null ) if ( snapshots != null )
@ -220,7 +220,7 @@ public class MavenArtifactRepository
*/ */
private static String protocol( final String url ) private static String protocol( final String url )
{ {
final int pos = url.indexOf( ":" ); final int pos = url.indexOf( ':' );
if ( pos == -1 ) if ( pos == -1 )
{ {
@ -257,7 +257,7 @@ public class MavenArtifactRepository
else else
{ {
// Now we expect the host // Now we expect the host
int index = retValue.indexOf( "/" ); int index = retValue.indexOf( '/' );
if ( index >= 0 ) if ( index >= 0 )
{ {
retValue = retValue.substring( index + 1 ); retValue = retValue.substring( index + 1 );

View File

@ -197,7 +197,7 @@ public abstract class AbstractRepositoryMetadata
public String extendedToString() public String extendedToString()
{ {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder( 256 );
buffer.append( "\nRepository Metadata\n--------------------------" ); buffer.append( "\nRepository Metadata\n--------------------------" );
buffer.append( "\nGroupId: " ).append( getGroupId() ); buffer.append( "\nGroupId: " ).append( getGroupId() );

View File

@ -343,14 +343,14 @@ public class ArtifactResolutionResult
if ( artifacts != null ) if ( artifacts != null )
{ {
int i = 1; int i = 1;
sb.append( "---------" ).append( "\n" ); sb.append( "---------\n" );
sb.append( artifacts.size() ).append( "\n" ); sb.append( artifacts.size() ).append( '\n' );
for ( Artifact a : artifacts ) for ( Artifact a : artifacts )
{ {
sb.append( i ).append( " " ).append( a ).append( "\n" ); sb.append( i ).append( ' ' ).append( a ).append( '\n' );
i++; i++;
} }
sb.append( "---------" ).append( "\n" ); sb.append( "---------\n" );
} }
return sb.toString(); return sb.toString();

View File

@ -84,7 +84,7 @@ public class LifecyclePhase
} }
else else
{ {
sb.append( "," ); sb.append( ',' );
} }
sb.append( mojo.getGoal() ); sb.append( mojo.getGoal() );
} }

View File

@ -175,7 +175,7 @@ public class MojoExecution
{ {
buffer.append( mojoDescriptor.getId() ); buffer.append( mojoDescriptor.getId() );
} }
buffer.append( " {execution: " ).append( executionId ).append( "}" ); buffer.append( " {execution: " ).append( executionId ).append( '}' );
return buffer.toString(); return buffer.toString();
} }

View File

@ -151,7 +151,7 @@ public class PluginParameterException
if ( StringUtils.isEmpty( expression ) ) if ( StringUtils.isEmpty( expression ) )
{ {
messageBuffer.append( "." ); messageBuffer.append( '.' );
} }
else else
{ {
@ -172,7 +172,7 @@ public class PluginParameterException
MojoDescriptor mojo = getMojoDescriptor(); MojoDescriptor mojo = getMojoDescriptor();
messageBuffer.append( "One or more required plugin parameters are invalid/missing for \'" ) messageBuffer.append( "One or more required plugin parameters are invalid/missing for \'" )
.append( mojo.getPluginDescriptor().getGoalPrefix() ).append( ":" ).append( mojo.getGoal() ) .append( mojo.getPluginDescriptor().getGoalPrefix() ).append( ':' ).append( mojo.getGoal() )
.append( "\'\n" ); .append( "\'\n" );
int idx = 0; int idx = 0;
@ -184,7 +184,7 @@ public class PluginParameterException
decomposeParameterIntoUserInstructions( mojo, param, messageBuffer ); decomposeParameterIntoUserInstructions( mojo, param, messageBuffer );
messageBuffer.append( "\n" ); messageBuffer.append( '\n' );
} }
return messageBuffer.toString(); return messageBuffer.toString();

View File

@ -160,7 +160,7 @@ public class PluginParameterExpressionEvaluator
int index = expr.indexOf( "${" ); int index = expr.indexOf( "${" );
if ( index >= 0 ) if ( index >= 0 )
{ {
int lastIndex = expr.indexOf( "}", index ); int lastIndex = expr.indexOf( '}', index );
if ( lastIndex >= 0 ) if ( lastIndex >= 0 )
{ {
String retVal = expr.substring( 0, index ); String retVal = expr.substring( 0, index );
@ -213,7 +213,7 @@ public class PluginParameterExpressionEvaluator
{ {
try try
{ {
int pathSeparator = expression.indexOf( "/" ); int pathSeparator = expression.indexOf( '/' );
if ( pathSeparator > 0 ) if ( pathSeparator > 0 )
{ {
@ -253,7 +253,7 @@ public class PluginParameterExpressionEvaluator
{ {
try try
{ {
int pathSeparator = expression.indexOf( "/" ); int pathSeparator = expression.indexOf( '/' );
if ( pathSeparator > 0 ) if ( pathSeparator > 0 )
{ {
@ -285,7 +285,7 @@ public class PluginParameterExpressionEvaluator
{ {
try try
{ {
int pathSeparator = expression.indexOf( "/" ); int pathSeparator = expression.indexOf( '/' );
if ( pathSeparator > 0 ) if ( pathSeparator > 0 )
{ {
@ -313,7 +313,7 @@ public class PluginParameterExpressionEvaluator
{ {
try try
{ {
int pathSeparator = expression.indexOf( "/" ); int pathSeparator = expression.indexOf( '/' );
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor(); PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
@ -342,7 +342,7 @@ public class PluginParameterExpressionEvaluator
{ {
try try
{ {
int pathSeparator = expression.indexOf( "/" ); int pathSeparator = expression.indexOf( '/' );
if ( pathSeparator > 0 ) if ( pathSeparator > 0 )
{ {
@ -368,7 +368,7 @@ public class PluginParameterExpressionEvaluator
} }
else if ( expression.startsWith( "basedir" ) ) else if ( expression.startsWith( "basedir" ) )
{ {
int pathSeparator = expression.indexOf( "/" ); int pathSeparator = expression.indexOf( '/' );
if ( pathSeparator > 0 ) if ( pathSeparator > 0 )
{ {
@ -447,7 +447,7 @@ public class PluginParameterExpressionEvaluator
private String stripTokens( String expr ) private String stripTokens( String expr )
{ {
if ( expr.startsWith( "${" ) && ( expr.indexOf( "}" ) == expr.length() - 1 ) ) if ( expr.startsWith( "${" ) && ( expr.indexOf( '}' ) == expr.length() - 1 ) )
{ {
expr = expr.substring( 2, expr.length() - 1 ); expr = expr.substring( 2, expr.length() - 1 );
} }

View File

@ -263,7 +263,7 @@ public class DefaultProjectDependenciesResolver
{ {
buffer.append( " (scope managed from " ).append( premanagedScope ); buffer.append( " (scope managed from " ).append( premanagedScope );
appendManagementSource( buffer, art, "scope" ); appendManagementSource( buffer, art, "scope" );
buffer.append( ")" ); buffer.append( ')' );
} }
String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node ); String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node );
@ -271,7 +271,7 @@ public class DefaultProjectDependenciesResolver
{ {
buffer.append( " (version managed from " ).append( premanagedVersion ); buffer.append( " (version managed from " ).append( premanagedVersion );
appendManagementSource( buffer, art, "version" ); appendManagementSource( buffer, art, "version" );
buffer.append( ")" ); buffer.append( ')' );
} }
} }
else else

View File

@ -1133,9 +1133,9 @@ public class MavenProject
StringBuilder sb = new StringBuilder( 128 ); StringBuilder sb = new StringBuilder( 128 );
sb.append( "MavenProject: " ); sb.append( "MavenProject: " );
sb.append( getGroupId() ); sb.append( getGroupId() );
sb.append( ":" ); sb.append( ':' );
sb.append( getArtifactId() ); sb.append( getArtifactId() );
sb.append( ":" ); sb.append( ':' );
sb.append( getVersion() ); sb.append( getVersion() );
sb.append( " @ " ); sb.append( " @ " );

View File

@ -242,7 +242,7 @@ public class ArtifactTransferEvent
public String toString() public String toString()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder( 64 );
sb.append( "TransferEvent[" ); sb.append( "TransferEvent[" );
@ -259,7 +259,7 @@ public class ArtifactTransferEvent
break; break;
} }
sb.append( "|" ); sb.append( '|' );
switch ( this.getEventType() ) switch ( this.getEventType() )
{ {
case TRANSFER_COMPLETED: case TRANSFER_COMPLETED:
@ -282,9 +282,9 @@ public class ArtifactTransferEvent
break; break;
} }
sb.append( "|" ); sb.append( '|' );
sb.append( this.getLocalFile() ).append( "|" ); sb.append( this.getLocalFile() ).append( '|' );
sb.append( "]" ); sb.append( ']' );
return sb.toString(); return sb.toString();
} }

View File

@ -53,7 +53,7 @@ public abstract class AbstractArtifactMetadata
public String extendedToString() public String extendedToString()
{ {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder( 256 );
buffer.append( "\nArtifact Metadata\n--------------------------" ); buffer.append( "\nArtifact Metadata\n--------------------------" );
buffer.append( "\nGroupId: " ).append( getGroupId() ); buffer.append( "\nGroupId: " ).append( getGroupId() );

View File

@ -59,7 +59,7 @@ public class LegacyLocalRepositoryManager
path.append( artifact.getGroupId() ).append( '/' ); path.append( artifact.getGroupId() ).append( '/' );
path.append( artifact.getExtension() ).append( 's' ).append( '/' ); path.append( artifact.getExtension() ).append( "s/" );
path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() ); path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );

View File

@ -71,7 +71,7 @@ public final class CLIReportingUtils
version.append( "Default locale: " ).append( Locale.getDefault() ).append( ", platform encoding: " ).append( version.append( "Default locale: " ).append( Locale.getDefault() ).append( ", platform encoding: " ).append(
System.getProperty( "file.encoding", "<unknown encoding>" ) ).append( ls ); System.getProperty( "file.encoding", "<unknown encoding>" ) ).append( ls );
version.append( "OS name: \"" ).append( Os.OS_NAME ).append( "\", version: \"" ).append( Os.OS_VERSION ).append( 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( "\"" ); "\", arch: \"" ).append( Os.OS_ARCH ).append( "\", family: \"" ).append( Os.OS_FAMILY ).append( '\"' );
return version.toString(); return version.toString();
} }

View File

@ -1621,7 +1621,7 @@ public class MavenCli
String value; String value;
int i = property.indexOf( "=" ); int i = property.indexOf( '=' );
if ( i <= 0 ) if ( i <= 0 )
{ {

View File

@ -174,7 +174,7 @@ public class ExecutionEventLogger
buffer.append( chars( ' ', padSize ) ); buffer.append( chars( ' ', padSize ) );
} }
buffer.append( buildTimeDuration ); buffer.append( buildTimeDuration );
buffer.append( "]" ); buffer.append( ']' );
} }
else if ( buildSummary instanceof BuildFailure ) else if ( buildSummary instanceof BuildFailure )
{ {
@ -187,7 +187,7 @@ public class ExecutionEventLogger
buffer.append( chars( ' ', padSize ) ); buffer.append( chars( ' ', padSize ) );
} }
buffer.append( buildTimeDuration ); buffer.append( buildTimeDuration );
buffer.append( "]" ); buffer.append( ']' );
} }
logger.info( buffer.toString() ); logger.info( buffer.toString() );

View File

@ -59,7 +59,7 @@ public class UnsupportedSlf4jBindingConfiguration
for ( Map.Entry<URL, Set<Object>> entry : supported.entrySet() ) for ( Map.Entry<URL, Set<Object>> entry : supported.entrySet() )
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append( "(from " ).append( entry.getKey().toExternalForm() ).append( ")" ); sb.append( "(from " ).append( entry.getKey().toExternalForm() ).append( ')' );
for ( Object binding : entry.getValue() ) for ( Object binding : entry.getValue() )
{ {

View File

@ -62,7 +62,7 @@ public class CLIManagerDocumentationTest
public String getOptionsAsHtml() public String getOptionsAsHtml()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder( 512 );
boolean a = true; boolean a = true;
sb.append( "<table border='1' class='zebra-striped'><tr class='a'><th><b>Options</b></th><th><b>Description</b></th></tr>" ); sb.append( "<table border='1' class='zebra-striped'><tr class='a'><th><b>Options</b></th><th><b>Description</b></th></tr>" );
for ( Option option : new CLIManagerExtension().getOptions() ) for ( Option option : new CLIManagerExtension().getOptions() )

View File

@ -914,8 +914,8 @@ public class DefaultModelBuilder
{ {
buffer.append( " of POM " ).append( ModelProblemUtils.toSourceHint( childModel ) ); buffer.append( " of POM " ).append( ModelProblemUtils.toSourceHint( childModel ) );
} }
buffer.append( " points at " ).append( groupId ).append( ":" ).append( artifactId ); buffer.append( " points at " ).append( groupId ).append( ':' ).append( artifactId );
buffer.append( " instead of " ).append( parent.getGroupId() ).append( ":" ); buffer.append( " instead of " ).append( parent.getGroupId() ).append( ':' );
buffer.append( parent.getArtifactId() ).append( ", please verify your project structure" ); buffer.append( parent.getArtifactId() ).append( ", please verify your project structure" );
problems.setSource( childModel ); problems.setSource( childModel );
@ -1028,7 +1028,7 @@ public class DefaultModelBuilder
buffer.append( "Non-resolvable parent POM" ); buffer.append( "Non-resolvable parent POM" );
if ( !containsCoordinates( e.getMessage(), groupId, artifactId, version ) ) if ( !containsCoordinates( e.getMessage(), groupId, artifactId, version ) )
{ {
buffer.append( " " ).append( ModelProblemUtils.toId( groupId, artifactId, version ) ); buffer.append( ' ' ).append( ModelProblemUtils.toId( groupId, artifactId, version ) );
} }
if ( childModel != problems.getRootModel() ) if ( childModel != problems.getRootModel() )
{ {
@ -1221,7 +1221,7 @@ public class DefaultModelBuilder
buffer.append( "Non-resolvable import POM" ); buffer.append( "Non-resolvable import POM" );
if ( !containsCoordinates( e.getMessage(), groupId, artifactId, version ) ) if ( !containsCoordinates( e.getMessage(), groupId, artifactId, version ) )
{ {
buffer.append( " " ).append( ModelProblemUtils.toId( groupId, artifactId, version ) ); buffer.append( ' ' ).append( ModelProblemUtils.toId( groupId, artifactId, version ) );
} }
buffer.append( ": " ).append( e.getMessage() ); buffer.append( ": " ).append( e.getMessage() );

View File

@ -165,7 +165,7 @@ public class DefaultModelProblem
{ {
StringBuilder buffer = new StringBuilder( 128 ); StringBuilder buffer = new StringBuilder( 128 );
buffer.append( "[" ).append( getSeverity() ).append( "] " ); buffer.append( '[' ).append( getSeverity() ).append( "] " );
buffer.append( getMessage() ); buffer.append( getMessage() );
buffer.append( " @ " ).append( ModelProblemUtils.formatLocation( this, null ) ); buffer.append( " @ " ).append( ModelProblemUtils.formatLocation( this, null ) );

View File

@ -51,7 +51,7 @@ public class ModelProblemUtils
File pomFile = model.getPomFile(); File pomFile = model.getPomFile();
if ( pomFile != null ) if ( pomFile != null )
{ {
buffer.append( " (" ).append( pomFile ).append( ")" ); buffer.append( " (" ).append( pomFile ).append( ')' );
} }
return buffer.toString(); return buffer.toString();

View File

@ -54,7 +54,7 @@ public class MojoNotFoundException
{ {
StringBuilder buffer = new StringBuilder( 256 ); StringBuilder buffer = new StringBuilder( 256 );
buffer.append( "Could not find goal '" ).append( goal ).append( "'" ); buffer.append( "Could not find goal '" ).append( goal ).append( '\'' );
if ( pluginDescriptor != null ) if ( pluginDescriptor != null )
{ {

View File

@ -156,7 +156,7 @@ public class DefaultSettingsProblem
{ {
StringBuilder buffer = new StringBuilder( 128 ); StringBuilder buffer = new StringBuilder( 128 );
buffer.append( "[" ).append( getSeverity() ).append( "] " ); buffer.append( '[' ).append( getSeverity() ).append( "] " );
buffer.append( getMessage() ); buffer.append( getMessage() );
buffer.append( " @ " ).append( getLocation() ); buffer.append( " @ " ).append( getLocation() );