CPD Results
The following document contains the results of PMD's CPD 6.55.0.
Duplications
File |
Line |
org/eclipse/aether/internal/impl/DefaultDeployer.java |
165 |
org/eclipse/aether/internal/impl/DefaultInstaller.java |
108 |
List<Artifact> artifacts = new ArrayList<>(request.getArtifacts());
List<? extends ArtifactGenerator> artifactGenerators =
Utils.getArtifactGenerators(session, artifactFactories, request);
try {
List<Artifact> generatedArtifacts = new ArrayList<>();
for (ArtifactGenerator artifactGenerator : artifactGenerators) {
Collection<? extends Artifact> generated = artifactGenerator.generate(generatedArtifacts);
for (Artifact generatedArtifact : generated) {
Map<String, String> properties = new HashMap<>(generatedArtifact.getProperties());
properties.put(
ArtifactGeneratorFactory.ARTIFACT_GENERATOR_ID,
requireNonNull(artifactGenerator.generatorId(), "generatorId"));
Artifact ga = generatedArtifact.setProperties(properties);
generatedArtifacts.add(ga);
}
}
artifacts.addAll(generatedArtifacts);
List<? extends MetadataGenerator> metadataGenerators =
Utils.getMetadataGenerators(session, metadataFactories, request); |
File |
Line |
org/eclipse/aether/internal/impl/DefaultFileProcessor.java |
94 |
org/eclipse/aether/internal/impl/DefaultPathProcessor.java |
78 |
FileUtils.CollocatedTempFile tempTarget = FileUtils.newTempFile(target.toPath());
OutputStream out = new BufferedOutputStream(Files.newOutputStream(tempTarget.getPath()))) {
long result = copy(out, in, listener);
tempTarget.move();
return result;
}
}
private long copy(OutputStream os, InputStream is, ProgressListener listener) throws IOException {
long total = 0L;
byte[] buffer = new byte[1024 * 32];
while (true) {
int bytes = is.read(buffer);
if (bytes < 0) {
break;
}
os.write(buffer, 0, bytes);
total += bytes;
if (listener != null && bytes > 0) {
try {
listener.progressed(ByteBuffer.wrap(buffer, 0, bytes));
} catch (Exception e) {
// too bad
}
}
}
return total;
}
@Override
public void move(File source, File target) throws IOException { |
File |
Line |
org/eclipse/aether/internal/impl/DefaultChecksumProcessor.java |
53 |
org/eclipse/aether/internal/impl/DefaultFileProcessor.java |
143 |
try (BufferedReader br = Files.newBufferedReader(checksumPath, StandardCharsets.UTF_8)) {
while (true) {
String line = br.readLine();
if (line == null) {
break;
}
line = line.trim();
if (!line.isEmpty()) {
checksum = line;
break;
}
}
}
if (checksum.matches(".+= [0-9A-Fa-f]+")) {
int lastSpacePos = checksum.lastIndexOf(' ');
checksum = checksum.substring(lastSpacePos + 1);
} else {
int spacePos = checksum.indexOf(' ');
if (spacePos != -1) {
checksum = checksum.substring(0, spacePos);
}
}
return checksum;
}
@Override
public void writeChecksum(Path target, String checksum) throws IOException { |
File |
Line |
org/eclipse/aether/internal/impl/DefaultLocalPathComposer.java |
72 |
org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java |
172 |
StringBuilder path = new StringBuilder(128);
if (!metadata.getGroupId().isEmpty()) {
path.append(metadata.getGroupId().replace('.', '/')).append('/');
if (!metadata.getArtifactId().isEmpty()) {
path.append(metadata.getArtifactId()).append('/');
if (!metadata.getVersion().isEmpty()) {
path.append(metadata.getVersion()).append('/');
}
}
}
path.append(insertRepositoryKey(metadata.getType(), repositoryKey)); |