Details
-
Bug
-
Resolution: Fixed
-
Neutral
-
2.0.2
-
None
Description
In:
public AssetRendition getRendition(String itemKey, String renditionName) {
Asset asset = getAsset(itemKey);
return getRendition(asset, MediaType.parse(asset.getMimeType()), renditionName);
}
the asset mus be null checked, as later is called "MediaType.parse(asset.getMimeType())" on it. Like this a un-handled exception is thrown which is not really catch-able in the freemarker script (null pointer check doesn't work).
Change to:
public AssetRendition getRendition(String itemKey, String renditionName) {
Asset asset = getAsset(itemKey);
if (asset == null) {
return null;
}
return getRendition(asset, MediaType.parse(asset.getMimeType()), renditionName);
}
Possible workaround:
- Use the info.magnolia.dam.templating.functions.DamTemplatingFunctions.getAsset(String)
- do a null check on the returned asset
- if not null use the info.magnolia.dam.templating.functions.DamTemplatingFunctions.getRendition(Asset, String)
Checklists
Acceptance criteria