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

Default Freemarker theme on top of unstyled fails with Freemarker error

    Details

    • Type: Bug
    • Status: Verified
    • Resolution: Unresolved
    • Affects Version/s: 7.0.0 DXP GA1
    • Fix Version/s: None
    • Component/s: Themes
    • Labels:
    • Fix Priority:
      2

      Description

      Created an empty theme with the Yeoman Theme Generator.
      Upon build, init.ftl from unstyled theme is used.
      This contains an error, apparently introduced in https://github.com/liferay/liferay-portal/commit/eb3cc261bce25b7fbe2dc12f9c6929ff35a46d49 (fix for LPS-69980).
      There, StringUtil.equals() is tried to call, but apparently Freemarker defaults to the instance method Object.equals(Object) instead of the static method from StringUtil (equals(x, y), with two arguments).

      The code to blame (init.ftl, line 156):
      https://github.com/liferay/liferay-portal/blob/master/modules/apps/foundation/frontend-theme/frontend-theme-unstyled/src/main/resources/META-INF/resources/_unstyled/templates/init.ftl

         <#if stringUtil.equals(page.getType(), "portlet")>
      

      The occurring error:

      freemarker.core._TemplateModelException: Java method "Object.equals(Object)" takes 1 argument, but 2 was given.
      
      ----
      FTL stack trace ("~" means nesting-related):
      	- Failed at: #if stringUtil.equals(page.getType(),...  [in template "x-theme_SERVLET_CONTEXT_/templates/init.ftl" at line 156, column 9]
      	- Reached through: #include init  [in template "x-theme_SERVLET_CONTEXT_/templates/portal_normal.ftl" at line 3, column 1]
      ----
      	freemarker.ext.beans.SimpleMethod.unwrapArguments(SimpleMethod.java:67)
      	freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:72)
      	freemarker.core.MethodCall._eval(MethodCall.java:62)
      	freemarker.core.Expression.eval(Expression.java:78)
      

      To reproduce:

      yo liferay-theme
      gulp build
      gulp deploy
      

      Base on 'classic', no modifications needed to reproduce.

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since last comment:
                2 years, 30 weeks, 2 days ago

                Packages

                Version Package