-
Bug
-
Resolution: Done
-
Neutral
-
None
-
None
-
None
-
MariaDB, CentOS
This ticket is related to the Dam Templating Functions.
damfn in docu
DamTemplatingFunctions.java in git
First thing we've noticed is that the method below is not null-safe, so when an asset does not exist, it will throw a NullPointerException which will break the rendering process.
Map<String, Object> getAssetMap(Asset asset)
And consequently, this other method is also unsafe, as it calls the aforementioned one:
Map<String, Object> getAssetMap(String itemKey)
This can be avoided by using the following method instead:
Map<String, Object> getAssetMapForAssetId(String assetKey)
, as long as the asset is referred by its id.
This leads also to the misleading documentation, as it is stated in https://documentation.magnolia-cms.com/display/DOCS/damfn that
*) getAssetMapForAssetId(String itemKey) and getAssetMap(String itemKey) are both identical.
, which is not completely true, as getAssetMapForAssetId is null-safe, while getAssetMap is not.