[MNG-6855] Simplify some code

Closes #279
This commit is contained in:
Lipmanpoi 2019-08-17 01:44:56 +08:00 committed by Sylwester Lachiewicz
parent ace32fdbe0
commit e6c897efb6
4 changed files with 13 additions and 14 deletions

View File

@ -82,29 +82,29 @@ public class PluginVersionResolutionException
private static String format( LocalRepository localRepository, List<RemoteRepository> remoteRepositories )
{
String repos = "[";
StringBuilder repos = new StringBuilder( "[" );
if ( localRepository != null )
{
repos += localRepository.getId() + " (" + localRepository.getBasedir() + ")";
repos.append( localRepository.getId() ).append( " (" ).append( localRepository.getBasedir() ).append( ")" );
}
if ( remoteRepositories != null && !remoteRepositories.isEmpty() )
{
for ( RemoteRepository repository : remoteRepositories )
{
repos += ", ";
repos.append( ", " );
if ( repository != null )
{
repos += repository.getId() + " (" + repository.getUrl() + ")";
repos.append( repository.getId() ).append( " (" ).append( repository.getUrl() ).append( ")" );
}
}
}
repos += "]";
repos.append( "]" );
return repos;
return repos.toString();
}
}

View File

@ -330,11 +330,10 @@ public class ArtifactTransferEvent
{
return false;
}
else if ( !source.equals( other.source ) )
else
{
return false;
return source.equals( other.source );
}
return true;
}
}

View File

@ -192,7 +192,7 @@ public abstract class AbstractMavenTransferListener
public String formatProgress( long progressedSize, long size )
{
Validate.isTrue( progressedSize >= 0L, "progressed file size cannot be negative: %s", progressedSize );
Validate.isTrue( size >= 0L && progressedSize <= size || size < 0L,
Validate.isTrue( size < 0L || progressedSize <= size,
"progressed file size cannot be greater than size: %s > %s", progressedSize, size );
if ( size >= 0L && progressedSize != size )

View File

@ -360,15 +360,15 @@ public class DefaultModelBuilder
}
else if ( !parentIds.add( parentData.getId() ) )
{
String message = "The parents form a cycle: ";
StringBuilder message = new StringBuilder( "The parents form a cycle: " );
for ( String modelId : parentIds )
{
message += modelId + " -> ";
message.append( modelId ).append( " -> " );
}
message += parentData.getId();
message.append( parentData.getId() );
problems.add( new ModelProblemCollectorRequest( ModelProblem.Severity.FATAL, ModelProblem.Version.BASE )
.setMessage( message ) );
.setMessage( message.toString() ) );
throw problems.newModelBuildingException();
}