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

Duplications

File Line
io/wcm/handler/mediasource/dam/impl/DamUriTemplate.java 107
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;
    }
  }
File Line
io/wcm/handler/mediasource/dam/impl/DamRendition.java 270
io/wcm/handler/mediasource/inline/InlineRendition.java 523
}

  @Override
  public boolean isImage() {
    return MediaFileType.isImage(getFileExtension());
  }

  @Override
  public boolean isBrowserImage() {
    return MediaFileType.isBrowserImage(getFileExtension());
  }

  @Override
  public boolean isVectorImage() {
    return MediaFileType.isVectorImage(getFileExtension());
  }

  @Override
  public boolean isVideo() {
    return MediaFileType.isVideo(getFileExtension());
  }

  @Override
  public boolean isDownload() {
    return !isImage() && !isVideo();
  }

  @Override
  public long getWidth() {
    if (this.rendition != null) {

Back to top

Version: 2.8.1-SNAPSHOT. Last Published: 2026-02-24.