mirror of https://github.com/apache/maven.git
Replace org.apache.commons.lang3.Validate#notNull with java.util.Objects#requireNonNull
This commit is contained in:
parent
6f41a82bb8
commit
72dca39807
|
@ -30,7 +30,8 @@ def tests
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
node(jenkinsEnv.labelForOS(buildOs)) {
|
def osNode = jenkinsEnv.labelForOS(buildOs)
|
||||||
|
node(jenkinsEnv.nodeSelection(osNode)) {
|
||||||
dir('build') {
|
dir('build') {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
checkout scm
|
checkout scm
|
||||||
|
@ -73,7 +74,7 @@ for (String os in runITsOses) {
|
||||||
String stageId = "${os}-jdk${jdk}"
|
String stageId = "${os}-jdk${jdk}"
|
||||||
String stageLabel = "Run ITs ${os.capitalize()} Java ${jdk}"
|
String stageLabel = "Run ITs ${os.capitalize()} Java ${jdk}"
|
||||||
runITsTasks[stageId] = {
|
runITsTasks[stageId] = {
|
||||||
node(osLabel) {
|
node(jenkinsEnv.nodeSelection(osLabel)) {
|
||||||
stage("${stageLabel}") {
|
stage("${stageLabel}") {
|
||||||
// on Windows, need a short path or we hit 256 character limit for paths
|
// on Windows, need a short path or we hit 256 character limit for paths
|
||||||
// using EXECUTOR_NUMBER guarantees that concurrent builds on same agent
|
// using EXECUTOR_NUMBER guarantees that concurrent builds on same agent
|
||||||
|
|
|
@ -33,11 +33,4 @@ under the License.
|
||||||
<name>Maven Builder Support</name>
|
<name>Maven Builder Support</name>
|
||||||
<description>Support for descriptor builders (model, setting, toolchains)</description>
|
<description>Support for descriptor builders (model, setting, toolchains)</description>
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -23,8 +23,7 @@ import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.Objects;
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wraps an ordinary {@link File} as a source.
|
* Wraps an ordinary {@link File} as a source.
|
||||||
|
@ -43,7 +42,7 @@ public class FileSource
|
||||||
*/
|
*/
|
||||||
public FileSource( File file )
|
public FileSource( File file )
|
||||||
{
|
{
|
||||||
this.file = Validate.notNull( file, "file cannot be null" ).getAbsoluteFile();
|
this.file = Objects.requireNonNull( file, "file cannot be null" ).getAbsoluteFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,8 +22,7 @@ package org.apache.maven.building;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Objects;
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wraps an ordinary {@link URL} as a source.
|
* Wraps an ordinary {@link URL} as a source.
|
||||||
|
@ -43,7 +42,7 @@ public class UrlSource
|
||||||
*/
|
*/
|
||||||
public UrlSource( URL url )
|
public UrlSource( URL url )
|
||||||
{
|
{
|
||||||
this.url = Validate.notNull( url, "url cannot be null" );
|
this.url = Objects.requireNonNull( url, "url cannot be null" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,8 +22,8 @@ package org.apache.maven.artifact.repository;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.RepositoryUtils;
|
import org.apache.maven.RepositoryUtils;
|
||||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||||
|
@ -89,7 +89,7 @@ public class LegacyLocalRepositoryManager
|
||||||
|
|
||||||
private LegacyLocalRepositoryManager( ArtifactRepository delegate )
|
private LegacyLocalRepositoryManager( ArtifactRepository delegate )
|
||||||
{
|
{
|
||||||
this.delegate = Validate.notNull( delegate, "delegate cannot be null" );
|
this.delegate = Objects.requireNonNull( delegate, "delegate cannot be null" );
|
||||||
|
|
||||||
ArtifactRepositoryLayout layout = delegate.getLayout();
|
ArtifactRepositoryLayout layout = delegate.getLayout();
|
||||||
repo =
|
repo =
|
||||||
|
|
|
@ -24,8 +24,8 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.artifact.repository.metadata.Metadata;
|
import org.apache.maven.artifact.repository.metadata.Metadata;
|
||||||
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
|
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
@ -45,7 +45,7 @@ public class DefaultMetadataReader
|
||||||
public Metadata read( File input, Map<String, ?> options )
|
public Metadata read( File input, Map<String, ?> options )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( input, "input cannot be null" );
|
Objects.requireNonNull( input, "input cannot be null" );
|
||||||
|
|
||||||
Metadata metadata = read( ReaderFactory.newXmlReader( input ), options );
|
Metadata metadata = read( ReaderFactory.newXmlReader( input ), options );
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class DefaultMetadataReader
|
||||||
public Metadata read( Reader input, Map<String, ?> options )
|
public Metadata read( Reader input, Map<String, ?> options )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( input, "input cannot be null" );
|
Objects.requireNonNull( input, "input cannot be null" );
|
||||||
|
|
||||||
try ( final Reader in = input )
|
try ( final Reader in = input )
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ public class DefaultMetadataReader
|
||||||
public Metadata read( InputStream input, Map<String, ?> options )
|
public Metadata read( InputStream input, Map<String, ?> options )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( input, "input cannot be null" );
|
Objects.requireNonNull( input, "input cannot be null" );
|
||||||
|
|
||||||
try ( final InputStream in = input )
|
try ( final InputStream in = input )
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
@ -34,7 +35,6 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.artifact.ArtifactUtils;
|
import org.apache.maven.artifact.ArtifactUtils;
|
||||||
import org.apache.maven.classrealm.ClassRealmRequest.RealmType;
|
import org.apache.maven.classrealm.ClassRealmRequest.RealmType;
|
||||||
import org.apache.maven.extension.internal.CoreExportsProvider;
|
import org.apache.maven.extension.internal.CoreExportsProvider;
|
||||||
|
@ -227,7 +227,7 @@ public class DefaultClassRealmManager
|
||||||
|
|
||||||
public ClassRealm createProjectRealm( Model model, List<Artifact> artifacts )
|
public ClassRealm createProjectRealm( Model model, List<Artifact> artifacts )
|
||||||
{
|
{
|
||||||
Validate.notNull( model, "model cannot be null" );
|
Objects.requireNonNull( model, "model cannot be null" );
|
||||||
|
|
||||||
ClassLoader parent = getMavenApiRealm();
|
ClassLoader parent = getMavenApiRealm();
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ public class DefaultClassRealmManager
|
||||||
|
|
||||||
public ClassRealm createExtensionRealm( Plugin plugin, List<Artifact> artifacts )
|
public ClassRealm createExtensionRealm( Plugin plugin, List<Artifact> artifacts )
|
||||||
{
|
{
|
||||||
Validate.notNull( plugin, "plugin cannot be null" );
|
Objects.requireNonNull( plugin, "plugin cannot be null" );
|
||||||
|
|
||||||
ClassLoader parent = PARENT_CLASSLOADER;
|
ClassLoader parent = PARENT_CLASSLOADER;
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ public class DefaultClassRealmManager
|
||||||
public ClassRealm createPluginRealm( Plugin plugin, ClassLoader parent, List<String> parentImports,
|
public ClassRealm createPluginRealm( Plugin plugin, ClassLoader parent, List<String> parentImports,
|
||||||
Map<String, ClassLoader> foreignImports, List<Artifact> artifacts )
|
Map<String, ClassLoader> foreignImports, List<Artifact> artifacts )
|
||||||
{
|
{
|
||||||
Validate.notNull( plugin, "plugin cannot be null" );
|
Objects.requireNonNull( plugin, "plugin cannot be null" );
|
||||||
|
|
||||||
if ( parent == null )
|
if ( parent == null )
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,8 +20,8 @@ package org.apache.maven.configuration.internal;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.configuration.BeanConfigurationException;
|
import org.apache.maven.configuration.BeanConfigurationException;
|
||||||
import org.apache.maven.configuration.BeanConfigurationPathTranslator;
|
import org.apache.maven.configuration.BeanConfigurationPathTranslator;
|
||||||
import org.apache.maven.configuration.BeanConfigurationRequest;
|
import org.apache.maven.configuration.BeanConfigurationRequest;
|
||||||
|
@ -54,8 +54,8 @@ public class DefaultBeanConfigurator
|
||||||
public void configureBean( BeanConfigurationRequest request )
|
public void configureBean( BeanConfigurationRequest request )
|
||||||
throws BeanConfigurationException
|
throws BeanConfigurationException
|
||||||
{
|
{
|
||||||
Validate.notNull( request, "request cannot be null" );
|
Objects.requireNonNull( request, "request cannot be null" );
|
||||||
Validate.notNull( request.getBean(), "request.bean cannot be null" );
|
Objects.requireNonNull( request.getBean(), "request.bean cannot be null" );
|
||||||
|
|
||||||
Object configuration = request.getConfiguration();
|
Object configuration = request.getConfiguration();
|
||||||
if ( configuration == null )
|
if ( configuration == null )
|
||||||
|
|
|
@ -19,7 +19,8 @@ package org.apache.maven.execution;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +49,7 @@ public abstract class BuildSummary
|
||||||
*/
|
*/
|
||||||
protected BuildSummary( MavenProject project, long time )
|
protected BuildSummary( MavenProject project, long time )
|
||||||
{
|
{
|
||||||
this.project = Validate.notNull( project, "project cannot be null" );
|
this.project = Objects.requireNonNull( project, "project cannot be null" );
|
||||||
// TODO Validate for < 0?
|
// TODO Validate for < 0?
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,9 @@ import java.util.Date;
|
||||||
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 java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.eventspy.internal.EventSpyDispatcher;
|
import org.apache.maven.eventspy.internal.EventSpyDispatcher;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
|
@ -778,7 +778,7 @@ public class DefaultMavenExecutionRequest
|
||||||
@Override
|
@Override
|
||||||
public MavenExecutionRequest addProxy( Proxy proxy )
|
public MavenExecutionRequest addProxy( Proxy proxy )
|
||||||
{
|
{
|
||||||
Validate.notNull( proxy, "proxy cannot be null" );
|
Objects.requireNonNull( proxy, "proxy cannot be null" );
|
||||||
|
|
||||||
for ( Proxy p : getProxies() )
|
for ( Proxy p : getProxies() )
|
||||||
{
|
{
|
||||||
|
@ -821,7 +821,7 @@ public class DefaultMavenExecutionRequest
|
||||||
@Override
|
@Override
|
||||||
public MavenExecutionRequest addServer( Server server )
|
public MavenExecutionRequest addServer( Server server )
|
||||||
{
|
{
|
||||||
Validate.notNull( server, "server cannot be null" );
|
Objects.requireNonNull( server, "server cannot be null" );
|
||||||
|
|
||||||
for ( Server p : getServers() )
|
for ( Server p : getServers() )
|
||||||
{
|
{
|
||||||
|
@ -864,7 +864,7 @@ public class DefaultMavenExecutionRequest
|
||||||
@Override
|
@Override
|
||||||
public MavenExecutionRequest addMirror( Mirror mirror )
|
public MavenExecutionRequest addMirror( Mirror mirror )
|
||||||
{
|
{
|
||||||
Validate.notNull( mirror, "mirror cannot be null" );
|
Objects.requireNonNull( mirror, "mirror cannot be null" );
|
||||||
|
|
||||||
for ( Mirror p : getMirrors() )
|
for ( Mirror p : getMirrors() )
|
||||||
{
|
{
|
||||||
|
@ -1111,7 +1111,7 @@ public class DefaultMavenExecutionRequest
|
||||||
@Override
|
@Override
|
||||||
public MavenExecutionRequest addProfile( Profile profile )
|
public MavenExecutionRequest addProfile( Profile profile )
|
||||||
{
|
{
|
||||||
Validate.notNull( profile, "profile cannot be null" );
|
Objects.requireNonNull( profile, "profile cannot be null" );
|
||||||
|
|
||||||
for ( Profile p : getProfiles() )
|
for ( Profile p : getProfiles() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,9 +24,9 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.execution.ProjectDependencyGraph;
|
import org.apache.maven.execution.ProjectDependencyGraph;
|
||||||
import org.apache.maven.project.DuplicateProjectException;
|
import org.apache.maven.project.DuplicateProjectException;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
@ -95,7 +95,7 @@ public class DefaultProjectDependencyGraph
|
||||||
|
|
||||||
public List<MavenProject> getDownstreamProjects( MavenProject project, boolean transitive )
|
public List<MavenProject> getDownstreamProjects( MavenProject project, boolean transitive )
|
||||||
{
|
{
|
||||||
Validate.notNull( project, "project cannot be null" );
|
Objects.requireNonNull( project, "project cannot be null" );
|
||||||
|
|
||||||
Set<String> projectIds = new HashSet<>();
|
Set<String> projectIds = new HashSet<>();
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public class DefaultProjectDependencyGraph
|
||||||
|
|
||||||
public List<MavenProject> getUpstreamProjects( MavenProject project, boolean transitive )
|
public List<MavenProject> getUpstreamProjects( MavenProject project, boolean transitive )
|
||||||
{
|
{
|
||||||
Validate.notNull( project, "project cannot be null" );
|
Objects.requireNonNull( project, "project cannot be null" );
|
||||||
|
|
||||||
Set<String> projectIds = new HashSet<>();
|
Set<String> projectIds = new HashSet<>();
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ import java.util.Collection;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.IdentityHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.execution.ProjectDependencyGraph;
|
import org.apache.maven.execution.ProjectDependencyGraph;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class FilteredProjectDependencyGraph
|
||||||
Collection<? extends MavenProject> whiteList )
|
Collection<? extends MavenProject> whiteList )
|
||||||
{
|
{
|
||||||
this.projectDependencyGraph =
|
this.projectDependencyGraph =
|
||||||
Validate.notNull( projectDependencyGraph, "projectDependencyGraph cannot be null" );
|
Objects.requireNonNull( projectDependencyGraph, "projectDependencyGraph cannot be null" );
|
||||||
|
|
||||||
this.whiteList = new IdentityHashMap<MavenProject, Object>();
|
this.whiteList = new IdentityHashMap<MavenProject, Object>();
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@ import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.project.ExtensionDescriptor;
|
import org.apache.maven.project.ExtensionDescriptor;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
@ -126,7 +126,7 @@ public class DefaultExtensionRealmCache
|
||||||
public CacheRecord put( Key key, ClassRealm extensionRealm, ExtensionDescriptor extensionDescriptor,
|
public CacheRecord put( Key key, ClassRealm extensionRealm, ExtensionDescriptor extensionDescriptor,
|
||||||
List<Artifact> artifacts )
|
List<Artifact> artifacts )
|
||||||
{
|
{
|
||||||
Validate.notNull( extensionRealm, "extensionRealm cannot be null" );
|
Objects.requireNonNull( extensionRealm, "extensionRealm cannot be null" );
|
||||||
|
|
||||||
if ( cache.containsKey( key ) )
|
if ( cache.containsKey( key ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.RepositoryUtils;
|
import org.apache.maven.RepositoryUtils;
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.model.Plugin;
|
import org.apache.maven.model.Plugin;
|
||||||
|
@ -151,7 +150,7 @@ public class DefaultPluginArtifactsCache
|
||||||
|
|
||||||
public CacheRecord put( Key key, List<Artifact> pluginArtifacts )
|
public CacheRecord put( Key key, List<Artifact> pluginArtifacts )
|
||||||
{
|
{
|
||||||
Validate.notNull( pluginArtifacts, "pluginArtifacts cannot be null" );
|
Objects.requireNonNull( pluginArtifacts, "pluginArtifacts cannot be null" );
|
||||||
|
|
||||||
assertUniqueKey( key );
|
assertUniqueKey( key );
|
||||||
|
|
||||||
|
@ -173,7 +172,7 @@ public class DefaultPluginArtifactsCache
|
||||||
|
|
||||||
public CacheRecord put( Key key, PluginResolutionException exception )
|
public CacheRecord put( Key key, PluginResolutionException exception )
|
||||||
{
|
{
|
||||||
Validate.notNull( exception, "exception cannot be null" );
|
Objects.requireNonNull( exception, "exception cannot be null" );
|
||||||
|
|
||||||
assertUniqueKey( key );
|
assertUniqueKey( key );
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.RepositoryUtils;
|
import org.apache.maven.RepositoryUtils;
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.model.Plugin;
|
import org.apache.maven.model.Plugin;
|
||||||
|
@ -159,8 +158,8 @@ public class DefaultPluginRealmCache
|
||||||
|
|
||||||
public CacheRecord put( Key key, ClassRealm pluginRealm, List<Artifact> pluginArtifacts )
|
public CacheRecord put( Key key, ClassRealm pluginRealm, List<Artifact> pluginArtifacts )
|
||||||
{
|
{
|
||||||
Validate.notNull( pluginRealm, "pluginRealm cannot be null" );
|
Objects.requireNonNull( pluginRealm, "pluginRealm cannot be null" );
|
||||||
Validate.notNull( pluginArtifacts, "pluginArtifacts cannot be null" );
|
Objects.requireNonNull( pluginArtifacts, "pluginArtifacts cannot be null" );
|
||||||
|
|
||||||
if ( cache.containsKey( key ) )
|
if ( cache.containsKey( key ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.plugin.internal;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.RepositoryUtils;
|
import org.apache.maven.RepositoryUtils;
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.classrealm.ClassRealmManager;
|
import org.apache.maven.classrealm.ClassRealmManager;
|
||||||
|
@ -104,6 +103,7 @@ import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
|
|
||||||
|
@ -385,10 +385,11 @@ public class DefaultMavenPluginManager
|
||||||
Map<String, ClassLoader> foreignImports, DependencyFilter filter )
|
Map<String, ClassLoader> foreignImports, DependencyFilter filter )
|
||||||
throws PluginResolutionException, PluginContainerException
|
throws PluginResolutionException, PluginContainerException
|
||||||
{
|
{
|
||||||
Plugin plugin = Validate.notNull( pluginDescriptor.getPlugin(), "pluginDescriptor.plugin cannot be null" );
|
Plugin plugin =
|
||||||
|
Objects.requireNonNull( pluginDescriptor.getPlugin(), "pluginDescriptor.plugin cannot be null" );
|
||||||
|
|
||||||
Artifact pluginArtifact =
|
Artifact pluginArtifact = Objects.requireNonNull( pluginDescriptor.getPluginArtifact(),
|
||||||
Validate.notNull( pluginDescriptor.getPluginArtifact(), "pluginDescriptor.pluginArtifact cannot be null" );
|
"pluginDescriptor.pluginArtifact cannot be null" );
|
||||||
|
|
||||||
MavenProject project = session.getCurrentProject();
|
MavenProject project = session.getCurrentProject();
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ package org.apache.maven.project;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.building.AbstractModelBuildingListener;
|
import org.apache.maven.model.building.AbstractModelBuildingListener;
|
||||||
|
@ -55,10 +55,11 @@ public class DefaultModelBuildingListener
|
||||||
public DefaultModelBuildingListener( MavenProject project, ProjectBuildingHelper projectBuildingHelper,
|
public DefaultModelBuildingListener( MavenProject project, ProjectBuildingHelper projectBuildingHelper,
|
||||||
ProjectBuildingRequest projectBuildingRequest )
|
ProjectBuildingRequest projectBuildingRequest )
|
||||||
{
|
{
|
||||||
this.project = Validate.notNull( project, "project cannot be null" );
|
this.project = Objects.requireNonNull( project, "project cannot be null" );
|
||||||
this.projectBuildingHelper = Validate.notNull( projectBuildingHelper, "projectBuildingHelper cannot be null" );
|
this.projectBuildingHelper =
|
||||||
|
Objects.requireNonNull( projectBuildingHelper, "projectBuildingHelper cannot be null" );
|
||||||
this.projectBuildingRequest =
|
this.projectBuildingRequest =
|
||||||
Validate.notNull( projectBuildingRequest, "projectBuildingRequest cannot be null" );
|
Objects.requireNonNull( projectBuildingRequest, "projectBuildingRequest cannot be null" );
|
||||||
this.remoteRepositories = projectBuildingRequest.getRemoteRepositories();
|
this.remoteRepositories = projectBuildingRequest.getRemoteRepositories();
|
||||||
this.pluginRepositories = projectBuildingRequest.getPluginArtifactRepositories();
|
this.pluginRepositories = projectBuildingRequest.getPluginArtifactRepositories();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ package org.apache.maven.project;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.model.building.ModelBuildingRequest;
|
import org.apache.maven.model.building.ModelBuildingRequest;
|
||||||
|
@ -335,7 +335,7 @@ public class DefaultProjectBuildingRequest
|
||||||
|
|
||||||
public DefaultProjectBuildingRequest setRepositoryMerging( RepositoryMerging repositoryMerging )
|
public DefaultProjectBuildingRequest setRepositoryMerging( RepositoryMerging repositoryMerging )
|
||||||
{
|
{
|
||||||
this.repositoryMerging = Validate.notNull( repositoryMerging, "repositoryMerging cannot be null" );
|
this.repositoryMerging = Objects.requireNonNull( repositoryMerging, "repositoryMerging cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,9 @@ package org.apache.maven.project;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||||
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
|
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
@ -102,7 +102,7 @@ public class DefaultProjectRealmCache
|
||||||
|
|
||||||
public CacheRecord put( Key key, ClassRealm projectRealm, DependencyFilter extensionArtifactFilter )
|
public CacheRecord put( Key key, ClassRealm projectRealm, DependencyFilter extensionArtifactFilter )
|
||||||
{
|
{
|
||||||
Validate.notNull( projectRealm, "projectRealm cannot be null" );
|
Objects.requireNonNull( projectRealm, "projectRealm cannot be null" );
|
||||||
|
|
||||||
if ( cache.containsKey( key ) )
|
if ( cache.containsKey( key ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,6 @@ import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.RepositoryUtils;
|
import org.apache.maven.RepositoryUtils;
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.lifecycle.LifecycleExecutionException;
|
import org.apache.maven.lifecycle.LifecycleExecutionException;
|
||||||
|
@ -199,7 +198,7 @@ public class DefaultProjectArtifactsCache
|
||||||
@Override
|
@Override
|
||||||
public CacheRecord put( Key key, Set<Artifact> projectArtifacts )
|
public CacheRecord put( Key key, Set<Artifact> projectArtifacts )
|
||||||
{
|
{
|
||||||
Validate.notNull( projectArtifacts, "projectArtifacts cannot be null" );
|
Objects.requireNonNull( projectArtifacts, "projectArtifacts cannot be null" );
|
||||||
|
|
||||||
assertUniqueKey( key );
|
assertUniqueKey( key );
|
||||||
|
|
||||||
|
@ -222,7 +221,7 @@ public class DefaultProjectArtifactsCache
|
||||||
@Override
|
@Override
|
||||||
public CacheRecord put( Key key, LifecycleExecutionException exception )
|
public CacheRecord put( Key key, LifecycleExecutionException exception )
|
||||||
{
|
{
|
||||||
Validate.notNull( exception, "exception cannot be null" );
|
Objects.requireNonNull( exception, "exception cannot be null" );
|
||||||
|
|
||||||
assertUniqueKey( key );
|
assertUniqueKey( key );
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,11 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.toolchain.model.PersistedToolchains;
|
import org.apache.maven.toolchain.model.PersistedToolchains;
|
||||||
import org.apache.maven.toolchain.model.io.xpp3.MavenToolchainsXpp3Reader;
|
import org.apache.maven.toolchain.model.io.xpp3.MavenToolchainsXpp3Reader;
|
||||||
import org.codehaus.plexus.util.ReaderFactory;
|
import org.codehaus.plexus.util.ReaderFactory;
|
||||||
|
@ -50,7 +50,7 @@ public class DefaultToolchainsReader
|
||||||
public PersistedToolchains read( File input, Map<String, ?> options )
|
public PersistedToolchains read( File input, Map<String, ?> options )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( input, "input cannot be null" );
|
Objects.requireNonNull( input, "input cannot be null" );
|
||||||
|
|
||||||
return read( ReaderFactory.newXmlReader( input ), options );
|
return read( ReaderFactory.newXmlReader( input ), options );
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public class DefaultToolchainsReader
|
||||||
public PersistedToolchains read( Reader input, Map<String, ?> options )
|
public PersistedToolchains read( Reader input, Map<String, ?> options )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( input, "input cannot be null" );
|
Objects.requireNonNull( input, "input cannot be null" );
|
||||||
|
|
||||||
try ( final Reader in = input )
|
try ( final Reader in = input )
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ public class DefaultToolchainsReader
|
||||||
public PersistedToolchains read( InputStream input, Map<String, ?> options )
|
public PersistedToolchains read( InputStream input, Map<String, ?> options )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( input, "input cannot be null" );
|
Objects.requireNonNull( input, "input cannot be null" );
|
||||||
|
|
||||||
try ( final InputStream in = input )
|
try ( final InputStream in = input )
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,11 +21,11 @@ package org.apache.maven.project.harness;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.jxpath.JXPathContext;
|
import org.apache.commons.jxpath.JXPathContext;
|
||||||
import org.apache.commons.jxpath.JXPathNotFoundException;
|
import org.apache.commons.jxpath.JXPathNotFoundException;
|
||||||
import org.apache.commons.jxpath.ri.JXPathContextReferenceImpl;
|
import org.apache.commons.jxpath.ri.JXPathContextReferenceImpl;
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
public class PomTestWrapper
|
public class PomTestWrapper
|
||||||
|
@ -44,14 +44,14 @@ public class PomTestWrapper
|
||||||
|
|
||||||
public PomTestWrapper( File pomFile, MavenProject mavenProject )
|
public PomTestWrapper( File pomFile, MavenProject mavenProject )
|
||||||
{
|
{
|
||||||
this.mavenProject = Validate.notNull( mavenProject, "mavenProject cannot be null" );
|
this.mavenProject = Objects.requireNonNull( mavenProject, "mavenProject cannot be null" );
|
||||||
this.pomFile = pomFile;
|
this.pomFile = pomFile;
|
||||||
context = JXPathContext.newContext( mavenProject.getModel() );
|
context = JXPathContext.newContext( mavenProject.getModel() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public PomTestWrapper( MavenProject mavenProject )
|
public PomTestWrapper( MavenProject mavenProject )
|
||||||
{
|
{
|
||||||
this.mavenProject = Validate.notNull( mavenProject, "mavenProject cannot be null" );
|
this.mavenProject = Objects.requireNonNull( mavenProject, "mavenProject cannot be null" );
|
||||||
context = JXPathContext.newContext( mavenProject.getModel() );
|
context = JXPathContext.newContext( mavenProject.getModel() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ import static org.apache.maven.cli.CLIReportingUtils.formatTimestamp;
|
||||||
import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
|
import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.execution.AbstractExecutionListener;
|
import org.apache.maven.execution.AbstractExecutionListener;
|
||||||
import org.apache.maven.execution.BuildFailure;
|
import org.apache.maven.execution.BuildFailure;
|
||||||
import org.apache.maven.execution.BuildSuccess;
|
import org.apache.maven.execution.BuildSuccess;
|
||||||
|
@ -66,7 +66,7 @@ public class ExecutionEventLogger
|
||||||
// TODO should we deprecate?
|
// TODO should we deprecate?
|
||||||
public ExecutionEventLogger( Logger logger )
|
public ExecutionEventLogger( Logger logger )
|
||||||
{
|
{
|
||||||
this.logger = Validate.notNull( logger, "logger cannot be null" );
|
this.logger = Objects.requireNonNull( logger, "logger cannot be null" );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String chars( char c, int count )
|
private static String chars( char c, int count )
|
||||||
|
|
|
@ -62,10 +62,6 @@ under the License.
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.sisu</groupId>
|
<groupId>org.eclipse.sisu</groupId>
|
||||||
<artifactId>org.eclipse.sisu.plexus</artifactId>
|
<artifactId>org.eclipse.sisu.plexus</artifactId>
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.maven.model.building;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
||||||
import org.apache.maven.artifact.versioning.VersionRange;
|
import org.apache.maven.artifact.versioning.VersionRange;
|
||||||
|
@ -74,6 +73,7 @@ import java.util.Iterator;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import static org.apache.maven.model.building.Result.error;
|
import static org.apache.maven.model.building.Result.error;
|
||||||
|
@ -1042,9 +1042,10 @@ public class DefaultModelBuilder
|
||||||
String version = parent.getVersion();
|
String version = parent.getVersion();
|
||||||
|
|
||||||
ModelResolver modelResolver = request.getModelResolver();
|
ModelResolver modelResolver = request.getModelResolver();
|
||||||
|
Objects.requireNonNull( modelResolver,
|
||||||
Validate.notNull( modelResolver, "request.modelResolver cannot be null (parent POM %s and POM %s)",
|
String.format( "request.modelResolver cannot be null (parent POM %s and POM %s)",
|
||||||
ModelProblemUtils.toId( groupId, artifactId, version ), ModelProblemUtils.toSourceHint( childModel ) );
|
ModelProblemUtils.toId( groupId, artifactId, version ),
|
||||||
|
ModelProblemUtils.toSourceHint( childModel ) ) );
|
||||||
|
|
||||||
ModelSource modelSource;
|
ModelSource modelSource;
|
||||||
try
|
try
|
||||||
|
|
|
@ -23,8 +23,8 @@ import java.util.ArrayList;
|
||||||
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.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class DefaultModelBuildingResult
|
||||||
public DefaultModelBuildingResult addModelId( String modelId )
|
public DefaultModelBuildingResult addModelId( String modelId )
|
||||||
{
|
{
|
||||||
// Intentionally notNull because Super POM may not contain a modelId
|
// Intentionally notNull because Super POM may not contain a modelId
|
||||||
Validate.notNull( modelId, "modelId cannot null" );
|
Objects.requireNonNull( modelId, "modelId cannot null" );
|
||||||
|
|
||||||
modelIds.add( modelId );
|
modelIds.add( modelId );
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class DefaultModelBuildingResult
|
||||||
public DefaultModelBuildingResult setRawModel( String modelId, Model rawModel )
|
public DefaultModelBuildingResult setRawModel( String modelId, Model rawModel )
|
||||||
{
|
{
|
||||||
// Intentionally notNull because Super POM may not contain a modelId
|
// Intentionally notNull because Super POM may not contain a modelId
|
||||||
Validate.notNull( modelId, "modelId cannot null" );
|
Objects.requireNonNull( modelId, "modelId cannot null" );
|
||||||
|
|
||||||
rawModels.put( modelId, rawModel );
|
rawModels.put( modelId, rawModel );
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ class DefaultModelBuildingResult
|
||||||
public DefaultModelBuildingResult setActivePomProfiles( String modelId, List<Profile> activeProfiles )
|
public DefaultModelBuildingResult setActivePomProfiles( String modelId, List<Profile> activeProfiles )
|
||||||
{
|
{
|
||||||
// Intentionally notNull because Super POM may not contain a modelId
|
// Intentionally notNull because Super POM may not contain a modelId
|
||||||
Validate.notNull( modelId, "modelId cannot null" );
|
Objects.requireNonNull( modelId, "modelId cannot null" );
|
||||||
|
|
||||||
if ( activeProfiles != null )
|
if ( activeProfiles != null )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,8 @@ package org.apache.maven.model.building;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.maven.model.InputLocation;
|
import org.apache.maven.model.InputLocation;
|
||||||
import org.apache.maven.model.building.ModelProblem.Severity;
|
import org.apache.maven.model.building.ModelProblem.Severity;
|
||||||
import org.apache.maven.model.building.ModelProblem.Version;
|
import org.apache.maven.model.building.ModelProblem.Version;
|
||||||
|
@ -45,8 +46,8 @@ public final class ModelProblemCollectorRequest
|
||||||
*/
|
*/
|
||||||
public ModelProblemCollectorRequest( Severity severity, Version version )
|
public ModelProblemCollectorRequest( Severity severity, Version version )
|
||||||
{
|
{
|
||||||
this.severity = Validate.notNull( severity, "severity cannot be null" );
|
this.severity = Objects.requireNonNull( severity, "severity cannot be null" );
|
||||||
this.version = Validate.notNull( version, "version cannot be null" );
|
this.version = Objects.requireNonNull( version, "version cannot be null" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Severity getSeverity()
|
public Severity getSeverity()
|
||||||
|
|
|
@ -25,8 +25,8 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.model.InputSource;
|
import org.apache.maven.model.InputSource;
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||||
|
@ -50,7 +50,7 @@ public class DefaultModelReader
|
||||||
public Model read( File input, Map<String, ?> options )
|
public Model read( File input, Map<String, ?> options )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( input, "input cannot be null" );
|
Objects.requireNonNull( input, "input cannot be null" );
|
||||||
|
|
||||||
Model model = read( new FileInputStream( input ), options );
|
Model model = read( new FileInputStream( input ), options );
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class DefaultModelReader
|
||||||
public Model read( Reader input, Map<String, ?> options )
|
public Model read( Reader input, Map<String, ?> options )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( input, "input cannot be null" );
|
Objects.requireNonNull( input, "input cannot be null" );
|
||||||
|
|
||||||
try ( final Reader in = input )
|
try ( final Reader in = input )
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ public class DefaultModelReader
|
||||||
public Model read( InputStream input, Map<String, ?> options )
|
public Model read( InputStream input, Map<String, ?> options )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( input, "input cannot be null" );
|
Objects.requireNonNull( input, "input cannot be null" );
|
||||||
|
|
||||||
try ( final XmlStreamReader in = ReaderFactory.newXmlReader( input ) )
|
try ( final XmlStreamReader in = ReaderFactory.newXmlReader( input ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,8 +25,8 @@ import java.io.OutputStream;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
@ -46,8 +46,8 @@ public class DefaultModelWriter
|
||||||
public void write( File output, Map<String, Object> options, Model model )
|
public void write( File output, Map<String, Object> options, Model model )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( output, "output cannot be null" );
|
Objects.requireNonNull( output, "output cannot be null" );
|
||||||
Validate.notNull( model, "model cannot be null" );
|
Objects.requireNonNull( model, "model cannot be null" );
|
||||||
|
|
||||||
output.getParentFile().mkdirs();
|
output.getParentFile().mkdirs();
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ public class DefaultModelWriter
|
||||||
public void write( Writer output, Map<String, Object> options, Model model )
|
public void write( Writer output, Map<String, Object> options, Model model )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( output, "output cannot be null" );
|
Objects.requireNonNull( output, "output cannot be null" );
|
||||||
Validate.notNull( model, "model cannot be null" );
|
Objects.requireNonNull( model, "model cannot be null" );
|
||||||
|
|
||||||
try ( final Writer out = output )
|
try ( final Writer out = output )
|
||||||
{
|
{
|
||||||
|
@ -71,8 +71,8 @@ public class DefaultModelWriter
|
||||||
public void write( OutputStream output, Map<String, Object> options, Model model )
|
public void write( OutputStream output, Map<String, Object> options, Model model )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( output, "output cannot be null" );
|
Objects.requireNonNull( output, "output cannot be null" );
|
||||||
Validate.notNull( model, "model cannot be null" );
|
Objects.requireNonNull( model, "model cannot be null" );
|
||||||
|
|
||||||
String encoding = model.getModelEncoding();
|
String encoding = model.getModelEncoding();
|
||||||
// TODO Use StringUtils here
|
// TODO Use StringUtils here
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.apache.maven.model.profile.activation;
|
package org.apache.maven.model.profile.activation;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
@ -21,7 +23,6 @@ package org.apache.maven.model.profile.activation;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.model.building.SimpleProblemCollector;
|
import org.apache.maven.model.building.SimpleProblemCollector;
|
||||||
import org.apache.maven.model.profile.DefaultProfileActivationContext;
|
import org.apache.maven.model.profile.DefaultProfileActivationContext;
|
||||||
|
@ -46,7 +47,7 @@ public abstract class AbstractProfileActivatorTest<T extends ProfileActivator>
|
||||||
|
|
||||||
public AbstractProfileActivatorTest( Class<T> activatorClass )
|
public AbstractProfileActivatorTest( Class<T> activatorClass )
|
||||||
{
|
{
|
||||||
this.activatorClass = Validate.notNull( activatorClass, "activatorClass cannot be null" );;
|
this.activatorClass = Objects.requireNonNull( activatorClass, "activatorClass cannot be null" );;
|
||||||
|
|
||||||
roleHint = activatorClass.getAnnotation( Component.class ).hint();
|
roleHint = activatorClass.getAnnotation( Component.class ).hint();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,10 +42,6 @@ under the License.
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-utils</artifactId>
|
<artifactId>plexus-utils</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -24,9 +24,9 @@ import java.util.HashMap;
|
||||||
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 java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.model.Activation;
|
import org.apache.maven.model.Activation;
|
||||||
import org.apache.maven.model.Build;
|
import org.apache.maven.model.Build;
|
||||||
import org.apache.maven.model.BuildBase;
|
import org.apache.maven.model.BuildBase;
|
||||||
|
@ -105,7 +105,7 @@ public class ModelMerger
|
||||||
*/
|
*/
|
||||||
public void merge( Model target, Model source, boolean sourceDominant, Map<?, ?> hints )
|
public void merge( Model target, Model source, boolean sourceDominant, Map<?, ?> hints )
|
||||||
{
|
{
|
||||||
Validate.notNull( target, "target cannot be null" );
|
Objects.requireNonNull( target, "target cannot be null" );
|
||||||
|
|
||||||
if ( source == null )
|
if ( source == null )
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,10 +82,6 @@ under the License.
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- Testing -->
|
<!-- Testing -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.resolver</groupId>
|
<groupId>org.apache.maven.resolver</groupId>
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.maven.repository.internal;
|
||||||
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -28,7 +29,6 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.model.DistributionManagement;
|
import org.apache.maven.model.DistributionManagement;
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.Relocation;
|
import org.apache.maven.model.Relocation;
|
||||||
|
@ -145,41 +145,42 @@ public class DefaultArtifactDescriptorReader
|
||||||
|
|
||||||
public DefaultArtifactDescriptorReader setRemoteRepositoryManager( RemoteRepositoryManager remoteRepositoryManager )
|
public DefaultArtifactDescriptorReader setRemoteRepositoryManager( RemoteRepositoryManager remoteRepositoryManager )
|
||||||
{
|
{
|
||||||
this.remoteRepositoryManager = Validate.notNull( remoteRepositoryManager,
|
this.remoteRepositoryManager = Objects.requireNonNull( remoteRepositoryManager,
|
||||||
"remoteRepositoryManager cannot be null" );
|
"remoteRepositoryManager cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultArtifactDescriptorReader setVersionResolver( VersionResolver versionResolver )
|
public DefaultArtifactDescriptorReader setVersionResolver( VersionResolver versionResolver )
|
||||||
{
|
{
|
||||||
this.versionResolver = Validate.notNull( versionResolver, "versionResolver cannot be null" );
|
this.versionResolver = Objects.requireNonNull( versionResolver, "versionResolver cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @since 3.2.2 */
|
/** @since 3.2.2 */
|
||||||
public DefaultArtifactDescriptorReader setVersionRangeResolver( VersionRangeResolver versionRangeResolver )
|
public DefaultArtifactDescriptorReader setVersionRangeResolver( VersionRangeResolver versionRangeResolver )
|
||||||
{
|
{
|
||||||
this.versionRangeResolver = Validate.notNull( versionRangeResolver, "versionRangeResolver cannot be null" );
|
this.versionRangeResolver =
|
||||||
|
Objects.requireNonNull( versionRangeResolver, "versionRangeResolver cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultArtifactDescriptorReader setArtifactResolver( ArtifactResolver artifactResolver )
|
public DefaultArtifactDescriptorReader setArtifactResolver( ArtifactResolver artifactResolver )
|
||||||
{
|
{
|
||||||
this.artifactResolver = Validate.notNull( artifactResolver, "artifactResolver cannot be null" );
|
this.artifactResolver = Objects.requireNonNull( artifactResolver, "artifactResolver cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultArtifactDescriptorReader setRepositoryEventDispatcher(
|
public DefaultArtifactDescriptorReader setRepositoryEventDispatcher(
|
||||||
RepositoryEventDispatcher repositoryEventDispatcher )
|
RepositoryEventDispatcher repositoryEventDispatcher )
|
||||||
{
|
{
|
||||||
this.repositoryEventDispatcher = Validate.notNull( repositoryEventDispatcher,
|
this.repositoryEventDispatcher = Objects.requireNonNull( repositoryEventDispatcher,
|
||||||
"repositoryEventDispatcher cannot be null" );
|
"repositoryEventDispatcher cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultArtifactDescriptorReader setModelBuilder( ModelBuilder modelBuilder )
|
public DefaultArtifactDescriptorReader setModelBuilder( ModelBuilder modelBuilder )
|
||||||
{
|
{
|
||||||
this.modelBuilder = Validate.notNull( modelBuilder, "modelBuilder cannot be null" );
|
this.modelBuilder = Objects.requireNonNull( modelBuilder, "modelBuilder cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.repository.internal;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||||
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
|
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
|
||||||
import org.eclipse.aether.RepositoryEvent;
|
import org.eclipse.aether.RepositoryEvent;
|
||||||
|
@ -63,6 +62,7 @@ import java.util.Collections;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
|
@ -121,20 +121,20 @@ public class DefaultVersionRangeResolver
|
||||||
|
|
||||||
public DefaultVersionRangeResolver setMetadataResolver( MetadataResolver metadataResolver )
|
public DefaultVersionRangeResolver setMetadataResolver( MetadataResolver metadataResolver )
|
||||||
{
|
{
|
||||||
this.metadataResolver = Validate.notNull( metadataResolver, "metadataResolver cannot be null" );
|
this.metadataResolver = Objects.requireNonNull( metadataResolver, "metadataResolver cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultVersionRangeResolver setSyncContextFactory( SyncContextFactory syncContextFactory )
|
public DefaultVersionRangeResolver setSyncContextFactory( SyncContextFactory syncContextFactory )
|
||||||
{
|
{
|
||||||
this.syncContextFactory = Validate.notNull( syncContextFactory, "syncContextFactory cannot be null" );
|
this.syncContextFactory = Objects.requireNonNull( syncContextFactory, "syncContextFactory cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultVersionRangeResolver setRepositoryEventDispatcher(
|
public DefaultVersionRangeResolver setRepositoryEventDispatcher(
|
||||||
RepositoryEventDispatcher repositoryEventDispatcher )
|
RepositoryEventDispatcher repositoryEventDispatcher )
|
||||||
{
|
{
|
||||||
this.repositoryEventDispatcher = Validate.notNull( repositoryEventDispatcher,
|
this.repositoryEventDispatcher = Objects.requireNonNull( repositoryEventDispatcher,
|
||||||
"repositoryEventDispatcher cannot be null" );
|
"repositoryEventDispatcher cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.repository.internal;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.artifact.repository.metadata.Snapshot;
|
import org.apache.maven.artifact.repository.metadata.Snapshot;
|
||||||
import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
|
import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
|
||||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||||
|
@ -69,6 +68,7 @@ import java.util.Collections;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
|
@ -133,19 +133,19 @@ public class DefaultVersionResolver
|
||||||
|
|
||||||
public DefaultVersionResolver setMetadataResolver( MetadataResolver metadataResolver )
|
public DefaultVersionResolver setMetadataResolver( MetadataResolver metadataResolver )
|
||||||
{
|
{
|
||||||
this.metadataResolver = Validate.notNull( metadataResolver, "metadataResolver cannot be null" );
|
this.metadataResolver = Objects.requireNonNull( metadataResolver, "metadataResolver cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultVersionResolver setSyncContextFactory( SyncContextFactory syncContextFactory )
|
public DefaultVersionResolver setSyncContextFactory( SyncContextFactory syncContextFactory )
|
||||||
{
|
{
|
||||||
this.syncContextFactory = Validate.notNull( syncContextFactory, "syncContextFactory cannot be null" );
|
this.syncContextFactory = Objects.requireNonNull( syncContextFactory, "syncContextFactory cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultVersionResolver setRepositoryEventDispatcher( RepositoryEventDispatcher repositoryEventDispatcher )
|
public DefaultVersionResolver setRepositoryEventDispatcher( RepositoryEventDispatcher repositoryEventDispatcher )
|
||||||
{
|
{
|
||||||
this.repositoryEventDispatcher = Validate.notNull( repositoryEventDispatcher,
|
this.repositoryEventDispatcher = Objects.requireNonNull( repositoryEventDispatcher,
|
||||||
"repositoryEventDispatcher cannot be null" );
|
"repositoryEventDispatcher cannot be null" );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ package org.apache.maven.repository.internal;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.eclipse.aether.artifact.AbstractArtifact;
|
import org.eclipse.aether.artifact.AbstractArtifact;
|
||||||
import org.eclipse.aether.artifact.Artifact;
|
import org.eclipse.aether.artifact.Artifact;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ final class RelocatedArtifact
|
||||||
|
|
||||||
RelocatedArtifact( Artifact artifact, String groupId, String artifactId, String version )
|
RelocatedArtifact( Artifact artifact, String groupId, String artifactId, String version )
|
||||||
{
|
{
|
||||||
this.artifact = Validate.notNull( artifact, "artifact cannot be null" );
|
this.artifact = Objects.requireNonNull( artifact, "artifact cannot be null" );
|
||||||
// TODO Use StringUtils here
|
// TODO Use StringUtils here
|
||||||
this.groupId = ( groupId != null && groupId.length() > 0 ) ? groupId : null;
|
this.groupId = ( groupId != null && groupId.length() > 0 ) ? groupId : null;
|
||||||
this.artifactId = ( artifactId != null && artifactId.length() > 0 ) ? artifactId : null;
|
this.artifactId = ( artifactId != null && artifactId.length() > 0 ) ? artifactId : null;
|
||||||
|
|
|
@ -65,10 +65,6 @@ under the License.
|
||||||
<groupId>org.sonatype.plexus</groupId>
|
<groupId>org.sonatype.plexus</groupId>
|
||||||
<artifactId>plexus-sec-dispatcher</artifactId>
|
<artifactId>plexus-sec-dispatcher</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -24,8 +24,8 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.settings.Settings;
|
import org.apache.maven.settings.Settings;
|
||||||
import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
|
import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
@ -46,7 +46,7 @@ public class DefaultSettingsReader
|
||||||
public Settings read( File input, Map<String, ?> options )
|
public Settings read( File input, Map<String, ?> options )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( input, "input cannot be null" );
|
Objects.requireNonNull( input, "input cannot be null" );
|
||||||
|
|
||||||
Settings settings = read( ReaderFactory.newXmlReader( input ), options );
|
Settings settings = read( ReaderFactory.newXmlReader( input ), options );
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class DefaultSettingsReader
|
||||||
public Settings read( Reader input, Map<String, ?> options )
|
public Settings read( Reader input, Map<String, ?> options )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( input, "input cannot be null" );
|
Objects.requireNonNull( input, "input cannot be null" );
|
||||||
|
|
||||||
try ( final Reader in = input )
|
try ( final Reader in = input )
|
||||||
{
|
{
|
||||||
|
@ -73,7 +73,7 @@ public class DefaultSettingsReader
|
||||||
public Settings read( InputStream input, Map<String, ?> options )
|
public Settings read( InputStream input, Map<String, ?> options )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( input, "input cannot be null" );
|
Objects.requireNonNull( input, "input cannot be null" );
|
||||||
|
|
||||||
try ( final InputStream in = input )
|
try ( final InputStream in = input )
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,8 +25,8 @@ import java.io.OutputStream;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.maven.settings.Settings;
|
import org.apache.maven.settings.Settings;
|
||||||
import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
|
import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
@ -46,8 +46,8 @@ public class DefaultSettingsWriter
|
||||||
public void write( File output, Map<String, Object> options, Settings settings )
|
public void write( File output, Map<String, Object> options, Settings settings )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( output, "output cannot be null" );
|
Objects.requireNonNull( output, "output cannot be null" );
|
||||||
Validate.notNull( settings, "settings cannot be null" );
|
Objects.requireNonNull( settings, "settings cannot be null" );
|
||||||
|
|
||||||
output.getParentFile().mkdirs();
|
output.getParentFile().mkdirs();
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ public class DefaultSettingsWriter
|
||||||
public void write( Writer output, Map<String, Object> options, Settings settings )
|
public void write( Writer output, Map<String, Object> options, Settings settings )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( output, "output cannot be null" );
|
Objects.requireNonNull( output, "output cannot be null" );
|
||||||
Validate.notNull( settings, "settings cannot be null" );
|
Objects.requireNonNull( settings, "settings cannot be null" );
|
||||||
|
|
||||||
try ( final Writer out = output )
|
try ( final Writer out = output )
|
||||||
{
|
{
|
||||||
|
@ -71,8 +71,8 @@ public class DefaultSettingsWriter
|
||||||
public void write( OutputStream output, Map<String, Object> options, Settings settings )
|
public void write( OutputStream output, Map<String, Object> options, Settings settings )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Validate.notNull( output, "output cannot be null" );
|
Objects.requireNonNull( output, "output cannot be null" );
|
||||||
Validate.notNull( settings, "settings cannot be null" );
|
Objects.requireNonNull( settings, "settings cannot be null" );
|
||||||
|
|
||||||
String encoding = settings.getModelEncoding();
|
String encoding = settings.getModelEncoding();
|
||||||
// TODO Use StringUtils here
|
// TODO Use StringUtils here
|
||||||
|
|
Loading…
Reference in New Issue