CPD Results

The following document contains the results of PMD's CPD 6.55.0.

Duplications

File Line
org/eclipse/aether/artifact/AbstractArtifact.java 108
org/eclipse/aether/metadata/AbstractMetadata.java 50
return newInstance(getVersion(), copyProperties(properties), getFile());
    }

    public String getProperty(String key, String defaultValue) {
        String value = getProperties().get(key);
        return (value != null) ? value : defaultValue;
    }

    /**
     * Copies the specified artifact properties. This utility method should be used when creating new artifact instances
     * with caller-supplied properties.
     *
     * @param properties The properties to copy, may be {@code null}.
     * @return The copied and read-only properties, never {@code null}.
     */
    protected static Map<String, String> copyProperties(Map<String, String> properties) {
        if (properties != null && !properties.isEmpty()) {
            return Collections.unmodifiableMap(new HashMap<>(properties));
        } else {
            return Collections.emptyMap();
        }
    }

    @Override
    public String toString() {
        StringBuilder buffer = new StringBuilder(128);