The following document contains the results of PMD's CPD 7.2.0.
Duplications
File |
Line |
io/wcm/handler/mediasource/dam/impl/DamUriTemplate.java |
106 |
io/wcm/handler/mediasource/inline/InlineUriTemplate.java |
83 |
.buildExternalResourceUrl(damContext.getAsset().adaptTo(Resource.class));
// replace dummy width/height parameters with actual placeholders
switch (type) {
case CROP_CENTER:
url = StringUtils.replace(url, Long.toString(DUMMY_WIDTH), URI_TEMPLATE_PLACEHOLDER_WIDTH);
url = StringUtils.replace(url, Long.toString(DUMMY_HEIGHT), URI_TEMPLATE_PLACEHOLDER_HEIGHT);
break;
case SCALE_WIDTH:
url = StringUtils.replace(url, Long.toString(DUMMY_WIDTH), URI_TEMPLATE_PLACEHOLDER_WIDTH);
url = StringUtils.replace(url, Long.toString(DUMMY_HEIGHT), "0");
break;
case SCALE_HEIGHT:
url = StringUtils.replace(url, Long.toString(DUMMY_WIDTH), "0");
url = StringUtils.replace(url, Long.toString(DUMMY_HEIGHT), URI_TEMPLATE_PLACEHOLDER_HEIGHT);
break;
default:
throw new IllegalArgumentException("Unsupported type: " + type);
}
return url;
}
|
File |
Line |
io/wcm/handler/mediasource/dam/impl/DamAsset.java |
158 |
io/wcm/handler/mediasource/inline/InlineAsset.java |
106 |
Rendition rendition = getDamRendition(mediaArgs);
// check if rendition is valid - otherwise return null
if (StringUtils.isEmpty(rendition.getUrl())) {
rendition = null;
}
return rendition;
}
@Override
public Rendition getImageRendition(@NotNull MediaArgs mediaArgs) {
Rendition rendition = getRendition(mediaArgs);
if (rendition != null && rendition.isImage()) {
return rendition;
}
else {
return null;
}
}
@Override
public Rendition getDownloadRendition(@NotNull MediaArgs mediaArgs) {
Rendition rendition = getRendition(mediaArgs);
if (rendition != null && rendition.isDownload()) {
return rendition;
}
else {
return null;
}
}
|