CPD Results
The following document contains the results of PMD's CPD 5.0.5.
Duplications
File |
Line |
org/apache/maven/SessionScope.java |
74 |
org/apache/maven/execution/scope/internal/MojoExecutionScope.java |
96 |
{
final LinkedList<ScopeState> stack = values.get();
if ( stack == null || stack.isEmpty() )
{
throw new IllegalStateException();
}
stack.removeFirst();
if ( stack.isEmpty() )
{
values.remove();
}
}
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/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 |
36 |
org/apache/maven/plugin/version/PluginVersionResolutionException.java |
78 |
}
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;
}
} |