[MNG-6827] Replace deprecated StringUtils#defaultString() from Plexus Utils

This closes #302
This commit is contained in:
Artem Krosheninnikov 2019-12-17 11:30:28 +03:00 committed by Michael Osipov
parent 01780c0ff3
commit a659ade9a0
4 changed files with 17 additions and 15 deletions

View File

@ -44,9 +44,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import junit.framework.Assert;
import org.codehaus.plexus.util.FileUtils;
import org.junit.Assert;
public class TestFileManager
{

View File

@ -23,6 +23,7 @@ import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.apache.maven.RepositoryUtils;
import org.apache.maven.model.Dependency;
@ -258,7 +259,7 @@ public class DefaultPluginDependenciesResolver
{
final String premanagedScope = DependencyManagerUtils.getPremanagedScope( node );
buffer.append( " (scope managed from " );
buffer.append( StringUtils.defaultString( premanagedScope, "default" ) );
buffer.append( Objects.toString( premanagedScope, "default" ) );
buffer.append( ')' );
}
@ -266,7 +267,7 @@ public class DefaultPluginDependenciesResolver
{
final String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node );
buffer.append( " (version managed from " );
buffer.append( StringUtils.defaultString( premanagedVersion, "default" ) );
buffer.append( Objects.toString( premanagedVersion, "default" ) );
buffer.append( ')' );
}
@ -274,7 +275,7 @@ public class DefaultPluginDependenciesResolver
{
final Boolean premanagedOptional = DependencyManagerUtils.getPremanagedOptional( node );
buffer.append( " (optionality managed from " );
buffer.append( StringUtils.defaultString( premanagedOptional, "default" ) );
buffer.append( Objects.toString( premanagedOptional, "default" ) );
buffer.append( ')' );
}
@ -285,7 +286,7 @@ public class DefaultPluginDependenciesResolver
DependencyManagerUtils.getPremanagedExclusions( node );
buffer.append( " (exclusions managed from " );
buffer.append( StringUtils.defaultString( premanagedExclusions, "default" ) );
buffer.append( Objects.toString( premanagedExclusions, "default" ) );
buffer.append( ')' );
}
@ -296,7 +297,7 @@ public class DefaultPluginDependenciesResolver
DependencyManagerUtils.getPremanagedProperties( node );
buffer.append( " (properties managed from " );
buffer.append( StringUtils.defaultString( premanagedProperties, "default" ) );
buffer.append( Objects.toString( premanagedProperties, "default" ) );
buffer.append( ')' );
}
}

View File

@ -23,6 +23,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.Artifact;
@ -269,7 +270,7 @@ public class DefaultProjectDependenciesResolver
{
final String premanagedScope = DependencyManagerUtils.getPremanagedScope( node );
buffer.append( " (scope managed from " );
buffer.append( StringUtils.defaultString( premanagedScope, "default" ) );
buffer.append( Objects.toString( premanagedScope, "default" ) );
buffer.append( ')' );
}
@ -277,7 +278,7 @@ public class DefaultProjectDependenciesResolver
{
final String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node );
buffer.append( " (version managed from " );
buffer.append( StringUtils.defaultString( premanagedVersion, "default" ) );
buffer.append( Objects.toString( premanagedVersion, "default" ) );
buffer.append( ')' );
}
@ -285,7 +286,7 @@ public class DefaultProjectDependenciesResolver
{
final Boolean premanagedOptional = DependencyManagerUtils.getPremanagedOptional( node );
buffer.append( " (optionality managed from " );
buffer.append( StringUtils.defaultString( premanagedOptional, "default" ) );
buffer.append( Objects.toString( premanagedOptional, "default" ) );
buffer.append( ')' );
}
@ -296,7 +297,7 @@ public class DefaultProjectDependenciesResolver
DependencyManagerUtils.getPremanagedExclusions( node );
buffer.append( " (exclusions managed from " );
buffer.append( StringUtils.defaultString( premanagedExclusions, "default" ) );
buffer.append( Objects.toString( premanagedExclusions, "default" ) );
buffer.append( ')' );
}
@ -307,7 +308,7 @@ public class DefaultProjectDependenciesResolver
DependencyManagerUtils.getPremanagedProperties( node );
buffer.append( " (properties managed from " );
buffer.append( StringUtils.defaultString( premanagedProperties, "default" ) );
buffer.append( Objects.toString( premanagedProperties, "default" ) );
buffer.append( ')' );
}
}

View File

@ -53,6 +53,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -527,12 +528,12 @@ public class DefaultModelValidator
if ( equals( existing.getVersion(), dependency.getVersion() ) )
{
msg = "duplicate declaration of version "
+ StringUtils.defaultString( dependency.getVersion(), "(?)" );
+ Objects.toString( dependency.getVersion(), "(?)" );
}
else
{
msg = "version " + StringUtils.defaultString( existing.getVersion(), "(?)" ) + " vs "
+ StringUtils.defaultString( dependency.getVersion(), "(?)" );
msg = "version " + Objects.toString( existing.getVersion(), "(?)" ) + " vs "
+ Objects.toString( dependency.getVersion(), "(?)" );
}
addViolation( problems, errOn31, Version.V20, prefix + prefix2 + "(groupId:artifactId:type:classifier)",