[jira] [Reopened] (OFBIZ-6884) Replace Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue in .ftl files with EntityUtilProperties variant

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Reopened] (OFBIZ-6884) Replace Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue in .ftl files with EntityUtilProperties variant

Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-6884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux reopened OFBIZ-6884:
------------------------------------

After fixing a typo at
{code}
<#assign jGrowlPosition = Static["org.ofbiz.entity.util.EntityUtilProperties"].getPropertyValuee("widget.properties", "widget.jgrowl.position")>
{code}
I got an error on the same line:
{code}
     [java] 2016-02-07 14:40:02,672 |http-bio-8443-exec-2 |runtime                       |E| Error executing FreeMarker template
     [java] freemarker.core._TemplateModelException: No compatible overloaded variation was found; can't convert (unwrap) the 1st argument to the desired Java type.
     [java] The FTL type of the argument values were: string (wrapper: f.t.SimpleScalar), string (wrapper: f.t.SimpleScalar).
     [java] The matching overload was searched among these members:
     [java]     static org.ofbiz.entity.util.EntityUtilProperties.getPropertyValue(java.net.URL, String, String),
     [java]     static org.ofbiz.entity.util.EntityUtilProperties.getPropertyValue(String, String, org.ofbiz.entity.Delegator),
     [java]     static org.ofbiz.entity.util.EntityUtilProperties.getPropertyValue(java.net.URL, String),
     [java]     static org.ofbiz.entity.util.EntityUtilProperties.getPropertyValue(String, String, String, org.ofbiz.entity.Delegator)
     [java]
     [java] ----
     [java] FTL stack trace ("~" means nesting-related):
     [java]     - Failed at: #assign jGrowlPosition = Static["org...  [in template "component://common/webcommon/includes/messages.ftl" at line 52, column 3]
     [java] ----
{code}
I fixed it again by adding
{code}
Index: EntityUtilProperties.java
===================================================================
--- EntityUtilProperties.java (revision 1728638)
+++ EntityUtilProperties.java (working copy)
@@ -168,6 +168,10 @@
         return UtilProperties.getPropertyValue(url, name);
     }

+    public static String getPropertyValue(String url, String name) {
+        return UtilProperties.getPropertyValue(url, name);
+    }
+
     public static String getSplitPropertyValue(URL url, String name) {
         return UtilProperties.getSplitPropertyValue(url, name);
     }
{code}
But then got this error
{code}
     [java] 2016-02-07 14:54:28,734 |http-bio-8443-exec-1 |runtime                       |E| Error executing FreeMarker template
     [java] freemarker.core._TemplateModelException: No compatible overloaded variation was found; declared parameter types and argument value types mismatch.
     [java] The FTL type of the argument values were: string (wrapper: f.t.SimpleScalar), string (wrapper: f.t.SimpleScalar), string (wrapper: f.t.SimpleScalar).
     [java] The Java type of the argument values were: String, String, String.
     [java] The matching overload was searched among these members:
     [java]     static org.ofbiz.entity.util.EntityUtilProperties.getPropertyValue(String, String),
     [java]     static org.ofbiz.entity.util.EntityUtilProperties.getPropertyValue(String, String, String, org.ofbiz.entity.Delegator),
     [java]     static org.ofbiz.entity.util.EntityUtilProperties.getPropertyValue(java.net.URL, String),
     [java]     static org.ofbiz.entity.util.EntityUtilProperties.getPropertyValue(java.net.URL, String, String),
     [java]     static org.ofbiz.entity.util.EntityUtilProperties.getPropertyValue(String, String, org.ofbiz.entity.Delegator)
     [java]
     [java] ----
     [java] FTL stack trace ("~" means nesting-related):
     [java]     - Failed at: #local showDescriptionProp = Static["...  [in template "component://widget/templates/htmlFormMacroLibrary.ftl" in macro "renderLookupField" at line 643, column 5]
     [java]     - Reached through: @renderLookupField name, formName, fi...  [in template "component://common/webcommon/includes/htmlTemplate.ftl" in macro "lookupField" at line 40, column 5]
     [java]     - Reached through: @htmlTemplate.lookupField value="\${r...  [in template "component://product/webapp/catalog/find/keywordsearchbox.ftl" at line 43, column 7]
     {code}
So I decided to revert r1728959 at r1728961, this needs more work

> Replace Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue in .ftl files with EntityUtilProperties variant
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-6884
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-6884
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: ALL COMPONENTS
>    Affects Versions: Trunk
>            Reporter: Pierre Smits
>            Assignee: Jacques Le Roux
>              Labels: multi-tenant
>             Fix For: Upcoming Branch
>
>         Attachments: OFBIZ-6884-PropertiesInFtl.patch
>
>
> Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue is used in several .ftl files.
> Replace with EnittyUtilProperties variant where appropriate.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)