CPD Results
The following document contains the results of PMD's CPD 5.6.1.
Duplications
File |
Line |
org/apache/maven/model/interpolation/StringSearchModelInterpolator.java |
87 |
org/apache/maven/model/interpolation/StringVisitorModelInterpolator.java |
108 |
}
private InnerInterpolator createInterpolator( List<? extends ValueSource> valueSources,
List<? extends InterpolationPostProcessor> postProcessors,
final ModelProblemCollector problems )
{
final Map<String, String> cache = new HashMap<>();
final StringSearchInterpolator interpolator = new StringSearchInterpolator();
interpolator.setCacheAnswers( true );
for ( ValueSource vs : valueSources )
{
interpolator.addValueSource( vs );
}
for ( InterpolationPostProcessor postProcessor : postProcessors )
{
interpolator.addPostProcessor( postProcessor );
}
final RecursionInterceptor recursionInterceptor = createRecursionInterceptor();
return new InnerInterpolator()
{
@Override
public String interpolate( String value )
{
if ( value != null && value.contains( "${" ) )
{
String c = cache.get( value );
if ( c == null )
{
try
{
c = interpolator.interpolate( value, recursionInterceptor );
}
catch ( InterpolationException e )
{
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
.setMessage( e.getMessage() ).setException( e ) );
}
cache.put( value, c );
}
return c;
}
return value;
}
};
} |
File |
Line |
org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java |
276 |
org/apache/maven/model/profile/DefaultProfileInjector.java |
120 |
master.put( key, element );
if ( !pending.isEmpty() )
{
predecessors.put( key, pending );
pending = new ArrayList<>();
}
}
else
{
pending.add( element );
}
}
List<Plugin> result = new ArrayList<>( src.size() + tgt.size() );
for ( Map.Entry<Object, Plugin> entry : master.entrySet() )
{
List<Plugin> pre = predecessors.get( entry.getKey() );
if ( pre != null )
{
result.addAll( pre );
}
result.add( entry.getValue() );
}
result.addAll( pending );
target.setPlugins( result );
}
}
@Override
protected void mergePlugin( Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context ) |
File |
Line |
org/apache/maven/model/interpolation/StringVisitorModelInterpolator.java |
750 |
org/apache/maven/model/interpolation/StringVisitorModelInterpolator.java |
1345 |
private void visit( Plugin plugin )
{
if ( plugin != null )
{
String org, val;
// Inherited
org = plugin.getInherited();
val = interpolate( org );
if ( org != val )
{
plugin.setInherited( val );
}
// Configuration
visit( (Xpp3Dom) plugin.getConfiguration() );
// GroupId
org = plugin.getGroupId();
val = interpolate( org );
if ( org != val )
{
plugin.setGroupId( val );
}
// ArtifactId
org = plugin.getArtifactId();
val = interpolate( org );
if ( org != val )
{
plugin.setArtifactId( val );
}
// Version
org = plugin.getVersion();
val = interpolate( org );
if ( org != val )
{
plugin.setVersion( val );
} |
File |
Line |
org/apache/maven/model/merge/MavenModelMerger.java |
280 |
org/apache/maven/model/merge/MavenModelMerger.java |
321 |
List<Repository> tgt = target.getRepositories();
Map<Object, Repository> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
List<Repository> dominant, recessive;
if ( sourceDominant )
{
dominant = src;
recessive = tgt;
}
else
{
dominant = tgt;
recessive = src;
}
for ( Repository element : dominant )
{
Object key = getRepositoryKey( element );
merged.put( key, element );
}
for ( Repository element : recessive )
{
Object key = getRepositoryKey( element );
if ( !merged.containsKey( key ) )
{
merged.put( key, element );
}
}
target.setRepositories( new ArrayList<>( merged.values() ) ); |