Uploaded image for project: 'Magnolia DAM Module'
  1. Magnolia DAM Module
  2. MGNLDAM-937

DamTemplatingFunctions - ItemKey is null or blank

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Done
    • Minor
    • 3.0.8
    • None
    • DAM Templating

    Description

      Rendering error that is sometimes observed in log files damfn-error.txt.

      12:36:03,551 INFO  [stdout] (default task-3) WARN   info.magnolia.dam.templating.functions.DamTemplatingFunctions 11.02.2021 12:36:03 -- The following ItemKey 'null' generated exceptions when trying to retrieve the associated Item : ItemKey is null or blank.
      12:36:03,551 INFO  [stdout] (default task-3) java.lang.IllegalArgumentException: ItemKey is null or blank.
      12:36:03,551 INFO  [stdout] (default task-3) 	at info.magnolia.dam.templating.functions.DamTemplatingFunctions.validateItemKey(DamTemplatingFunctions.java:498) ~[magnolia-dam-templating-3.0.3.jar:?]
      12:36:03,551 INFO  [stdout] (default task-3) 	at info.magnolia.dam.templating.functions.DamTemplatingFunctions.getItem(DamTemplatingFunctions.java:458) ~[magnolia-dam-templating-3.0.3.jar:?]
      12:36:03,551 INFO  [stdout] (default task-3) 	at info.magnolia.dam.templating.functions.DamTemplatingFunctions.getAsset(DamTemplatingFunctions.java:115) ~[magnolia-dam-templating-3.0.3.jar:?]
      12:36:03,551 INFO  [stdout] (default task-3) 	at info.magnolia.dam.templating.functions.DamTemplatingFunctions.getAssetMapForAssetId(DamTemplatingFunctions.java:310) ~[magnolia-dam-templating-3.0.3.jar:?]
      

      It would be helpful to do some rendering level logging for the template and content being rendered. The downside is the additional log file size.

      Workaround
      Search all template scripts for usages of "damfn.getAsset(" and change the script logic to check for the missing ItemKey before calling damfn.

      See also Freemarker attempt-recover: https://freemarker.apache.org/docs/ref_directive_attempt.html

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                rgange Richard Gange
                rgange Richard Gange
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Task DoD