mirror of https://github.com/apache/maven.git
[MNG-6827] Replace deprecated StringUtils#defaultString() from Plexus Utils
This closes #302
This commit is contained in:
parent
01780c0ff3
commit
a659ade9a0
|
@ -44,9 +44,8 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
|
||||||
|
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
|
import org.junit.Assert;
|
||||||
|
|
||||||
public class TestFileManager
|
public class TestFileManager
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Collection;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.maven.RepositoryUtils;
|
import org.apache.maven.RepositoryUtils;
|
||||||
import org.apache.maven.model.Dependency;
|
import org.apache.maven.model.Dependency;
|
||||||
|
@ -258,7 +259,7 @@ public class DefaultPluginDependenciesResolver
|
||||||
{
|
{
|
||||||
final String premanagedScope = DependencyManagerUtils.getPremanagedScope( node );
|
final String premanagedScope = DependencyManagerUtils.getPremanagedScope( node );
|
||||||
buffer.append( " (scope managed from " );
|
buffer.append( " (scope managed from " );
|
||||||
buffer.append( StringUtils.defaultString( premanagedScope, "default" ) );
|
buffer.append( Objects.toString( premanagedScope, "default" ) );
|
||||||
buffer.append( ')' );
|
buffer.append( ')' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +267,7 @@ public class DefaultPluginDependenciesResolver
|
||||||
{
|
{
|
||||||
final String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node );
|
final String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node );
|
||||||
buffer.append( " (version managed from " );
|
buffer.append( " (version managed from " );
|
||||||
buffer.append( StringUtils.defaultString( premanagedVersion, "default" ) );
|
buffer.append( Objects.toString( premanagedVersion, "default" ) );
|
||||||
buffer.append( ')' );
|
buffer.append( ')' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +275,7 @@ public class DefaultPluginDependenciesResolver
|
||||||
{
|
{
|
||||||
final Boolean premanagedOptional = DependencyManagerUtils.getPremanagedOptional( node );
|
final Boolean premanagedOptional = DependencyManagerUtils.getPremanagedOptional( node );
|
||||||
buffer.append( " (optionality managed from " );
|
buffer.append( " (optionality managed from " );
|
||||||
buffer.append( StringUtils.defaultString( premanagedOptional, "default" ) );
|
buffer.append( Objects.toString( premanagedOptional, "default" ) );
|
||||||
buffer.append( ')' );
|
buffer.append( ')' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +286,7 @@ public class DefaultPluginDependenciesResolver
|
||||||
DependencyManagerUtils.getPremanagedExclusions( node );
|
DependencyManagerUtils.getPremanagedExclusions( node );
|
||||||
|
|
||||||
buffer.append( " (exclusions managed from " );
|
buffer.append( " (exclusions managed from " );
|
||||||
buffer.append( StringUtils.defaultString( premanagedExclusions, "default" ) );
|
buffer.append( Objects.toString( premanagedExclusions, "default" ) );
|
||||||
buffer.append( ')' );
|
buffer.append( ')' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +297,7 @@ public class DefaultPluginDependenciesResolver
|
||||||
DependencyManagerUtils.getPremanagedProperties( node );
|
DependencyManagerUtils.getPremanagedProperties( node );
|
||||||
|
|
||||||
buffer.append( " (properties managed from " );
|
buffer.append( " (properties managed from " );
|
||||||
buffer.append( StringUtils.defaultString( premanagedProperties, "default" ) );
|
buffer.append( Objects.toString( premanagedProperties, "default" ) );
|
||||||
buffer.append( ')' );
|
buffer.append( ')' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.maven.RepositoryUtils;
|
import org.apache.maven.RepositoryUtils;
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
|
@ -269,7 +270,7 @@ public class DefaultProjectDependenciesResolver
|
||||||
{
|
{
|
||||||
final String premanagedScope = DependencyManagerUtils.getPremanagedScope( node );
|
final String premanagedScope = DependencyManagerUtils.getPremanagedScope( node );
|
||||||
buffer.append( " (scope managed from " );
|
buffer.append( " (scope managed from " );
|
||||||
buffer.append( StringUtils.defaultString( premanagedScope, "default" ) );
|
buffer.append( Objects.toString( premanagedScope, "default" ) );
|
||||||
buffer.append( ')' );
|
buffer.append( ')' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +278,7 @@ public class DefaultProjectDependenciesResolver
|
||||||
{
|
{
|
||||||
final String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node );
|
final String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node );
|
||||||
buffer.append( " (version managed from " );
|
buffer.append( " (version managed from " );
|
||||||
buffer.append( StringUtils.defaultString( premanagedVersion, "default" ) );
|
buffer.append( Objects.toString( premanagedVersion, "default" ) );
|
||||||
buffer.append( ')' );
|
buffer.append( ')' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +286,7 @@ public class DefaultProjectDependenciesResolver
|
||||||
{
|
{
|
||||||
final Boolean premanagedOptional = DependencyManagerUtils.getPremanagedOptional( node );
|
final Boolean premanagedOptional = DependencyManagerUtils.getPremanagedOptional( node );
|
||||||
buffer.append( " (optionality managed from " );
|
buffer.append( " (optionality managed from " );
|
||||||
buffer.append( StringUtils.defaultString( premanagedOptional, "default" ) );
|
buffer.append( Objects.toString( premanagedOptional, "default" ) );
|
||||||
buffer.append( ')' );
|
buffer.append( ')' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +297,7 @@ public class DefaultProjectDependenciesResolver
|
||||||
DependencyManagerUtils.getPremanagedExclusions( node );
|
DependencyManagerUtils.getPremanagedExclusions( node );
|
||||||
|
|
||||||
buffer.append( " (exclusions managed from " );
|
buffer.append( " (exclusions managed from " );
|
||||||
buffer.append( StringUtils.defaultString( premanagedExclusions, "default" ) );
|
buffer.append( Objects.toString( premanagedExclusions, "default" ) );
|
||||||
buffer.append( ')' );
|
buffer.append( ')' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +308,7 @@ public class DefaultProjectDependenciesResolver
|
||||||
DependencyManagerUtils.getPremanagedProperties( node );
|
DependencyManagerUtils.getPremanagedProperties( node );
|
||||||
|
|
||||||
buffer.append( " (properties managed from " );
|
buffer.append( " (properties managed from " );
|
||||||
buffer.append( StringUtils.defaultString( premanagedProperties, "default" ) );
|
buffer.append( Objects.toString( premanagedProperties, "default" ) );
|
||||||
buffer.append( ')' );
|
buffer.append( ')' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -527,12 +528,12 @@ public class DefaultModelValidator
|
||||||
if ( equals( existing.getVersion(), dependency.getVersion() ) )
|
if ( equals( existing.getVersion(), dependency.getVersion() ) )
|
||||||
{
|
{
|
||||||
msg = "duplicate declaration of version "
|
msg = "duplicate declaration of version "
|
||||||
+ StringUtils.defaultString( dependency.getVersion(), "(?)" );
|
+ Objects.toString( dependency.getVersion(), "(?)" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg = "version " + StringUtils.defaultString( existing.getVersion(), "(?)" ) + " vs "
|
msg = "version " + Objects.toString( existing.getVersion(), "(?)" ) + " vs "
|
||||||
+ StringUtils.defaultString( dependency.getVersion(), "(?)" );
|
+ Objects.toString( dependency.getVersion(), "(?)" );
|
||||||
}
|
}
|
||||||
|
|
||||||
addViolation( problems, errOn31, Version.V20, prefix + prefix2 + "(groupId:artifactId:type:classifier)",
|
addViolation( problems, errOn31, Version.V20, prefix + prefix2 + "(groupId:artifactId:type:classifier)",
|
||||||
|
|
Loading…
Reference in New Issue