CPD Results
The following document contains the results of PMD's CPD 6.38.0.
Duplications
File |
Line |
org\apache\maven\plugin\internal\DefaultPluginDependenciesResolver.java |
247 |
org\apache\maven\project\DefaultProjectDependenciesResolver.java |
250 |
public boolean visitEnter( DependencyNode node )
{
StringBuilder buffer = new StringBuilder( 128 );
buffer.append( indent );
org.eclipse.aether.graph.Dependency dep = node.getDependency();
if ( dep != null )
{
org.eclipse.aether.artifact.Artifact art = dep.getArtifact();
buffer.append( art );
if ( StringUtils.isNotEmpty( dep.getScope() ) )
{
buffer.append( ':' ).append( dep.getScope() );
}
if ( dep.isOptional() )
{
buffer.append( " (optional)" );
}
// TODO We currently cannot tell which <dependencyManagement> section contained the management
// information. When the resolver provides this information, these log messages should be updated
// to contain it.
if ( ( node.getManagedBits() & DependencyNode.MANAGED_SCOPE ) == DependencyNode.MANAGED_SCOPE )
{
final String premanagedScope = DependencyManagerUtils.getPremanagedScope( node );
buffer.append( " (scope managed from " );
buffer.append( Objects.toString( premanagedScope, "default" ) );
buffer.append( ')' );
}
if ( ( node.getManagedBits() & DependencyNode.MANAGED_VERSION ) == DependencyNode.MANAGED_VERSION )
{
final String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node );
buffer.append( " (version managed from " );
buffer.append( Objects.toString( premanagedVersion, "default" ) );
buffer.append( ')' );
}
if ( ( node.getManagedBits() & DependencyNode.MANAGED_OPTIONAL ) == DependencyNode.MANAGED_OPTIONAL )
{
final Boolean premanagedOptional = DependencyManagerUtils.getPremanagedOptional( node );
buffer.append( " (optionality managed from " );
buffer.append( Objects.toString( premanagedOptional, "default" ) );
buffer.append( ')' );
}
if ( ( node.getManagedBits() & DependencyNode.MANAGED_EXCLUSIONS )
== DependencyNode.MANAGED_EXCLUSIONS )
{
final Collection<org.eclipse.aether.graph.Exclusion> premanagedExclusions =
DependencyManagerUtils.getPremanagedExclusions( node );
buffer.append( " (exclusions managed from " );
buffer.append( Objects.toString( premanagedExclusions, "default" ) );
buffer.append( ')' );
}
if ( ( node.getManagedBits() & DependencyNode.MANAGED_PROPERTIES )
== DependencyNode.MANAGED_PROPERTIES )
{
final Map<String, String> premanagedProperties =
DependencyManagerUtils.getPremanagedProperties( node );
buffer.append( " (properties managed from " );
buffer.append( Objects.toString( premanagedProperties, "default" ) );
buffer.append( ')' );
}
} |
File |
Line |
org\apache\maven\execution\scope\internal\MojoExecutionScope.java |
100 |
org\apache\maven\session\scope\internal\SessionScope.java |
123 |
}
public <T> void seed( Class<T> clazz, Provider<T> value )
{
getScopeState().seeded.put( Key.get( clazz ), value );
}
public <T> void seed( Class<T> clazz, final T value )
{
getScopeState().seeded.put( Key.get( clazz ), Providers.of( value ) );
}
public <T> Provider<T> scope( final Key<T> key, final Provider<T> unscoped )
{
return new Provider<T>()
{
@SuppressWarnings( "unchecked" )
public T get()
{
LinkedList<ScopeState> stack = values.get();
if ( stack == null || stack.isEmpty() )
{
throw new OutOfScopeException( "Cannot access " + key + " outside of a scoping block" );
}
ScopeState state = stack.getFirst();
Provider<?> seeded = state.seeded.get( key );
if ( seeded != null )
{
return (T) seeded.get();
}
T provided = (T) state.provided.get( key );
if ( provided == null && unscoped != null )
{
provided = unscoped.get();
state.provided.put( key, provided );
}
return provided;
}
};
}
@SuppressWarnings( { "unchecked" } )
public static <T> Provider<T> seededKeyProvider()
{
return (Provider<T>) SEEDED_KEY_PROVIDER;
} |
File |
Line |
org\apache\maven\artifact\factory\DefaultArtifactFactory.java |
125 |
org\apache\maven\bridge\MavenRepositorySystem.java |
525 |
private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
String classifier, String scope, String inheritedScope, boolean optional )
{
String desiredScope = Artifact.SCOPE_RUNTIME;
if ( inheritedScope == null )
{
desiredScope = scope;
}
else if ( Artifact.SCOPE_TEST.equals( scope ) || Artifact.SCOPE_PROVIDED.equals( scope ) )
{
return null;
}
else if ( Artifact.SCOPE_COMPILE.equals( scope ) && Artifact.SCOPE_COMPILE.equals( inheritedScope ) )
{
// added to retain compile artifactScope. Remove if you want compile inherited as runtime
desiredScope = Artifact.SCOPE_COMPILE;
}
if ( Artifact.SCOPE_TEST.equals( inheritedScope ) )
{
desiredScope = Artifact.SCOPE_TEST;
}
if ( Artifact.SCOPE_PROVIDED.equals( inheritedScope ) )
{
desiredScope = Artifact.SCOPE_PROVIDED;
}
if ( Artifact.SCOPE_SYSTEM.equals( scope ) )
{
// system scopes come through unchanged...
desiredScope = Artifact.SCOPE_SYSTEM;
}
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type );
return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier, handler,
optional );
} |
File |
Line |
org\apache\maven\plugin\internal\DefaultPluginManager.java |
94 |
org\apache\maven\plugin\internal\DefaultPluginManager.java |
126 |
{
MavenSession session = legacySupport.getSession();
PluginDescriptor pluginDescriptor;
try
{
pluginDescriptor =
pluginManager.getPluginDescriptor( plugin, session.getCurrentProject().getRemotePluginRepositories(),
session.getRepositorySession() );
pluginManager.setupPluginRealm( pluginDescriptor, session, null, null, null );
}
catch ( Exception e )
{
throw new PluginManagerException( plugin, e.getMessage(), e );
}
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader( pluginDescriptor.getClassRealm() );
return container.lookup( role, roleHint ); |
File |
Line |
org\apache\maven\plugin\prefix\NoPluginFoundForPrefixException.java |
39 |
org\apache\maven\plugin\version\PluginVersionResolutionException.java |
81 |
}
private static String format( LocalRepository localRepository, List<RemoteRepository> remoteRepositories )
{
String repos = "[";
if ( localRepository != null )
{
repos += localRepository.getId() + " (" + localRepository.getBasedir() + ")";
}
if ( remoteRepositories != null && !remoteRepositories.isEmpty() )
{
for ( RemoteRepository repository : remoteRepositories )
{
repos += ", ";
if ( repository != null )
{
repos += repository.getId() + " (" + repository.getUrl() + ")";
}
}
}
repos += "]";
return repos;
}
} |
File |
Line |
org\apache\maven\project\MavenProject.java |
1628 |
org\apache\maven\project\MavenProject.java |
1704 |
|| Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
{
Dependency dependency = new Dependency();
dependency.setArtifactId( a.getArtifactId() );
dependency.setGroupId( a.getGroupId() );
dependency.setVersion( a.getVersion() );
dependency.setScope( a.getScope() );
dependency.setType( a.getType() );
dependency.setClassifier( a.getClassifier() );
list.add( dependency );
}
}
return Collections.unmodifiableList( list );
}
@Deprecated
public List<Artifact> getTestArtifacts() |
File |
Line |
org\apache\maven\project\MavenProject.java |
1628 |
org\apache\maven\project\MavenProject.java |
1800 |
|| Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
{
Dependency dependency = new Dependency();
dependency.setArtifactId( a.getArtifactId() );
dependency.setGroupId( a.getGroupId() );
dependency.setVersion( a.getVersion() );
dependency.setScope( a.getScope() );
dependency.setType( a.getType() );
dependency.setClassifier( a.getClassifier() );
list.add( dependency );
}
}
return Collections.unmodifiableList( list );
}
@Deprecated
public List<Artifact> getTestArtifacts() |