Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-121581

Freemarker errors in themes cause 500 server errors

    Details

    • Type: Feature Request
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Liferay Themes
    • Labels:
      None

      Description

      Freemarker errors causes pages to render 500 server errors due to Freemarker being terrible at handling errors. Velocity would skip over errors and still render a page however when using Freemarker in theme portals then become much more vunerable to 500 errors. Put this in a custom site theme in portal_normal.ftl somewhere near the bottom of the HTML source order. This is an example you can trigger any kind of Freemarker error to reproduce.

       

      I purposefully made an error here ... "??has_content"

      <#if propsUtil.get("mycustomfield.googleanalytics.globalkey")??has_content>
       <#assign gkey = propsUtil.get("mycustomfield.googleanalytics.globalkey") />
      <#else>
       <#assign gkey = "UA-4324324234234234324234234234-4">
      </#if>

       

      This will trigger a 500 server error that takes the whole portal offline.

       

      Expected
      Better error handling

      Actual
      Appalling error handling.

       

       

      HTTP Status 500 – Internal Server Error


      Type Exception Report

      Message Unable to process template mercury-theme_SERVLET_CONTEXT_/templates/portal_normal.ftl

      Description The server encountered an unexpected condition that prevented it from fulfilling the request.

      Exception

       

        Attachments

          Activity

            People

            Assignee:
            support-lep@liferay.com SE Support
            Reporter:
            lee.jordan1 Lee Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:

                Packages

                Version Package