Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
import org.apache.maven.artifact.versioning.VersionRange;
import org.codehaus.plexus.util.StringUtils;

import static org.apache.commons.lang3.StringUtils.isNotEmpty;

/**
* @author Jason van Zyl
Expand Down Expand Up @@ -163,7 +164,7 @@ public String getClassifier()

public boolean hasClassifier()
{
return StringUtils.isNotEmpty( classifier );
return isNotEmpty( classifier );
}

public String getScope()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.codehaus.plexus.util.FileUtils;
import org.eclipse.aether.RepositoryException;
import org.eclipse.aether.metadata.AbstractMetadata;
import org.eclipse.aether.metadata.MergeableMetadata;
import org.eclipse.aether.metadata.Metadata;

import static org.apache.commons.io.FileUtils.copyFile;

/**
* <strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part
* of the public API. In particular, this class can be changed or deleted without prior notice.
Expand Down Expand Up @@ -59,7 +60,7 @@ public void merge( File current, File result )
{
if ( current.exists() )
{
FileUtils.copyFile( current, result );
copyFile( current, result );
}
ArtifactRepository localRepo = new MetadataRepository( result );
metadata.storeInLocalRepository( localRepo, localRepo );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.codehaus.plexus.util.StringUtils;

import static org.apache.commons.lang3.StringUtils.isEmpty;

/**
* Describes runtime information about the application.
Expand Down Expand Up @@ -53,7 +54,7 @@ public void initialize()
{
String mavenVersion = rtInfo.getMavenVersion();

if ( StringUtils.isEmpty( mavenVersion ) )
if ( isEmpty( mavenVersion ) )
{
throw new InitializationException( "Unable to read Maven version from maven-core" );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
import org.codehaus.plexus.logging.LogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;

import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import static org.apache.commons.lang3.StringUtils.replace;

/**
* FileProfileActivator
Expand Down Expand Up @@ -72,18 +74,18 @@ public boolean isActive( Profile profile )

try
{
if ( StringUtils.isNotEmpty( fileString ) )
if ( isNotEmpty( fileString ) )
{
fileString = StringUtils.replace( interpolator.interpolate( fileString, "" ), "\\", "/" );
fileString = replace( interpolator.interpolate( fileString, "" ), "\\", "/" );
return FileUtils.fileExists( fileString );
}

// check if the file is missing, if it is then the profile will be active
fileString = actFile.getMissing();

if ( StringUtils.isNotEmpty( fileString ) )
if ( isNotEmpty( fileString ) )
{
fileString = StringUtils.replace( interpolator.interpolate( fileString, "" ), "\\", "/" );
fileString = replace( interpolator.interpolate( fileString, "" ), "\\", "/" );
return !FileUtils.fileExists( fileString );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.model.Activation;
import org.apache.maven.model.Profile;
import org.codehaus.plexus.util.StringUtils;

import static org.apache.commons.lang3.StringUtils.isNotEmpty;

/**
* JdkPrefixProfileActivator
Expand Down Expand Up @@ -94,7 +95,7 @@ protected String getJdkVersion()

protected boolean canDetectActivation( Profile profile )
{
return profile.getActivation() != null && StringUtils.isNotEmpty( profile.getActivation().getJdk() );
return profile.getActivation() != null && isNotEmpty( profile.getActivation().getJdk() );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
import org.codehaus.plexus.context.Context;
import org.codehaus.plexus.context.ContextException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import org.codehaus.plexus.util.StringUtils;

import static org.apache.commons.lang3.StringUtils.isNotEmpty;

/**
* SystemPropertyProfileActivator
Expand Down Expand Up @@ -75,7 +76,7 @@ public boolean isActive( Profile profile )
String sysValue = properties.getProperty( name );

String propValue = property.getValue();
if ( StringUtils.isNotEmpty( propValue ) )
if ( isNotEmpty( propValue ) )
{
boolean reverseValue = false;
if ( propValue.startsWith( "!" ) )
Expand All @@ -98,7 +99,7 @@ public boolean isActive( Profile profile )
}
else
{
boolean result = StringUtils.isNotEmpty( sysValue );
boolean result = isNotEmpty( sysValue );

if ( reverseName )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@
import org.apache.maven.model.Site;
import org.apache.maven.project.ModelUtils;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;

import static org.apache.commons.lang3.StringUtils.isEmpty;

/**
* DefaultModelInheritanceAssembler
*/
Expand Down Expand Up @@ -151,21 +152,21 @@ private void assembleScmInheritance( Model child, Model parent, String childPath
child.setScm( childScm );
}

if ( StringUtils.isEmpty( childScm.getConnection() ) && !StringUtils.isEmpty( parentScm.getConnection() ) )
if ( isEmpty( childScm.getConnection() ) && !isEmpty( parentScm.getConnection() ) )
{
childScm.setConnection(
appendPath( parentScm.getConnection(), child.getArtifactId(), childPathAdjustment, appendPaths ) );
}

if ( StringUtils.isEmpty( childScm.getDeveloperConnection() )
&& !StringUtils.isEmpty( parentScm.getDeveloperConnection() ) )
if ( isEmpty( childScm.getDeveloperConnection() )
&& !isEmpty( parentScm.getDeveloperConnection() ) )
{
childScm
.setDeveloperConnection( appendPath( parentScm.getDeveloperConnection(), child.getArtifactId(),
childPathAdjustment, appendPaths ) );
}

if ( StringUtils.isEmpty( childScm.getUrl() ) && !StringUtils.isEmpty( parentScm.getUrl() ) )
if ( isEmpty( childScm.getUrl() ) && !isEmpty( parentScm.getUrl() ) )
{
childScm.setUrl(
appendPath( parentScm.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) );
Expand Down Expand Up @@ -357,7 +358,7 @@ private void assembleReportingInheritance( Model child, Model parent )

childReporting.setExcludeDefaults( parentReporting.isExcludeDefaults() );

if ( StringUtils.isEmpty( childReporting.getOutputDirectory() ) )
if ( isEmpty( childReporting.getOutputDirectory() ) )
{
childReporting.setOutputDirectory( parentReporting.getOutputDirectory() );
}
Expand Down Expand Up @@ -629,7 +630,7 @@ private void assembleDistributionInheritance( Model child, Model parent, String
}
}

if ( StringUtils.isEmpty( childDistMgmt.getDownloadUrl() ) )
if ( isEmpty( childDistMgmt.getDownloadUrl() ) )
{
childDistMgmt.setDownloadUrl( parentDistMgmt.getDownloadUrl() );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.settings.Mirror;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.StringUtils;

import static org.apache.commons.lang3.StringUtils.isEmpty;

/**
* DefaultMirrorSelector
Expand Down Expand Up @@ -164,7 +165,7 @@ static boolean matchesLayout( String repoLayout, String mirrorLayout )
boolean result = false;

// simple checks first to short circuit processing below.
if ( StringUtils.isEmpty( mirrorLayout ) || WILDCARD.equals( mirrorLayout ) )
if ( isEmpty( mirrorLayout ) || WILDCARD.equals( mirrorLayout ) )
{
result = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.AuthenticationContext;
import org.eclipse.aether.repository.AuthenticationSelector;
import org.eclipse.aether.repository.ProxySelector;
import org.eclipse.aether.repository.RemoteRepository;

import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;

/**
* @author Jason van Zyl
*/
Expand Down Expand Up @@ -202,7 +204,7 @@ public Artifact createParentArtifact( String groupId, String artifactId, String
public Artifact createPluginArtifact( Plugin plugin )
{
String version = plugin.getVersion();
if ( StringUtils.isEmpty( version ) )
if ( isEmpty( version ) )
{
version = "RELEASE";
}
Expand Down Expand Up @@ -534,7 +536,7 @@ private void injectMirror( ArtifactRepository repository, Mirror mirror )
repository.setId( mirror.getId() );
repository.setUrl( mirror.getUrl() );

if ( StringUtils.isNotEmpty( mirror.getLayout() ) )
if ( isNotEmpty( mirror.getLayout() ) )
{
repository.setLayout( getLayout( mirror.getLayout() ) );
}
Expand Down Expand Up @@ -636,7 +638,7 @@ private org.apache.maven.settings.Proxy getProxy( ArtifactRepository repository,
{
if ( proxy.isActive() && repository.getProtocol().equalsIgnoreCase( proxy.getProtocol() ) )
{
if ( StringUtils.isNotEmpty( proxy.getNonProxyHosts() ) )
if ( isNotEmpty( proxy.getNonProxyHosts() ) )
{
ProxyInfo pi = new ProxyInfo();
pi.setNonProxyHosts( proxy.getNonProxyHosts() );
Expand Down Expand Up @@ -788,14 +790,14 @@ public ArtifactRepository buildArtifactRepository( Repository repo )
{
String id = repo.getId();

if ( StringUtils.isEmpty( id ) )
if ( isEmpty( id ) )
{
throw new InvalidRepositoryException( "Repository identifier missing", "" );
}

String url = repo.getUrl();

if ( StringUtils.isEmpty( url ) )
if ( isEmpty( url ) )
{
throw new InvalidRepositoryException( "URL missing for repository " + id, id );
}
Expand Down Expand Up @@ -849,7 +851,7 @@ private static String getMessage( Throwable error, String def )
return def;
}
String msg = error.getMessage();
if ( StringUtils.isNotEmpty( msg ) )
if ( isNotEmpty( msg ) )
{
return msg;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
import org.apache.maven.artifact.repository.metadata.Versioning;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.StringUtils;

import static org.apache.commons.lang3.StringUtils.replace;

/**
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
Expand Down Expand Up @@ -133,7 +134,7 @@ protected String constructVersion( Versioning versioning, String baseVersion )
if ( snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0 )
{
String newVersion = snapshot.getTimestamp() + "-" + snapshot.getBuildNumber();
version = StringUtils.replace( baseVersion, Artifact.SNAPSHOT_VERSION, newVersion );
version = replace( baseVersion, Artifact.SNAPSHOT_VERSION, newVersion );
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@
import java.util.List;

import junit.framework.Assert;
import org.apache.commons.io.FileUtils;

import org.codehaus.plexus.util.FileUtils;
import static org.apache.commons.io.FileUtils.deleteDirectory;
import static org.apache.maven.shared.utils.io.FileUtils.fileRead;
import static org.apache.maven.shared.utils.io.FileUtils.fileWrite;

public class TestFileManager
{
Expand Down Expand Up @@ -146,7 +149,7 @@ public void cleanUp()
{
if ( file.isDirectory() )
{
FileUtils.deleteDirectory( file );
deleteDirectory( file );
}
else
{
Expand Down Expand Up @@ -181,7 +184,7 @@ public void assertFileContents( File dir, String filename, String contentsTest,

File file = new File( dir, filename );

String contents = FileUtils.fileRead( file, encoding );
String contents = fileRead( file, encoding );

Assert.assertEquals( contentsTest, contents );
}
Expand All @@ -193,7 +196,7 @@ public File createFile( File dir, String filename, String contents, String encod

file.getParentFile().mkdirs();

FileUtils.fileWrite( file.getPath(), encoding, contents );
fileWrite( file.getPath(), encoding, contents );

markForDeletion( file );

Expand All @@ -203,7 +206,7 @@ public File createFile( File dir, String filename, String contents, String encod
public String getFileContents( File file, String encoding )
throws IOException
{
return FileUtils.fileRead( file, encoding );
return fileRead( file, encoding );
}

protected void finalize()
Expand Down
Loading