Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-6164 Improve configurability of OFBiz regarding multi-tenancy
  3. OFBIZ-6884

Replace Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue in .ftl files with EntityUtilProperties variant

    Details

    • Sprint:
      Community Day 1 - 2015

      Description

      Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue is used in several .ftl files.

      Replace with EnittyUtilProperties variant where appropriate.

      1. OFBIZ-6884-PropertiesInFtl.patch
        15 kB
        Pierre Smits
      2. OFBIZ-6884-PropertiesInFtl-v2.patch
        15 kB
        Pierre Smits
      3. OFBIZ-6884-PropertiesInFtl-v3.patch
        15 kB
        Pierre Smits

        Issue Links

          Activity

          Hide
          pfm.smits Pierre Smits added a comment -

          This patch addresses the issue.

          Show
          pfm.smits Pierre Smits added a comment - This patch addresses the issue.
          Hide
          jacques.le.roux Jacques Le Roux added a comment -

          Thanks Pierre, your patch is in trunk at revision: 1728959

          Show
          jacques.le.roux Jacques Le Roux added a comment - Thanks Pierre, your patch is in trunk at revision: 1728959
          Hide
          jacques.le.roux Jacques Le Roux added a comment -

          After fixing a typo at

          <#assign jGrowlPosition = Static["org.ofbiz.entity.util.EntityUtilProperties"].getPropertyValuee("widget.properties", "widget.jgrowl.position")>
          

          I got an error on the same line:

               [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] ----
          

          I fixed it again by adding

          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);
               }
          

          But then got this error

               [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]
               

          So I decided to revert r1728959 at r1728961, this needs more work

          Show
          jacques.le.roux Jacques Le Roux added a comment - After fixing a typo at <#assign jGrowlPosition = Static[ "org.ofbiz.entity.util.EntityUtilProperties" ].getPropertyValuee( "widget.properties" , "widget.jgrowl.position" )> I got an error on the same line: [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] ---- I fixed it again by adding 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); } But then got this error [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] So I decided to revert r1728959 at r1728961, this needs more work
          Hide
          pfm.smits Pierre Smits added a comment -

          Thanks Jacques Le Roux, for the feedback. I will look into it.

          Show
          pfm.smits Pierre Smits added a comment - Thanks Jacques Le Roux , for the feedback. I will look into it.
          Hide
          pfm.smits Pierre Smits added a comment -

          Found the root cause. I will submit a new patch file.

          Show
          pfm.smits Pierre Smits added a comment - Found the root cause. I will submit a new patch file.
          Hide
          pfm.smits Pierre Smits added a comment -

          Due to a missing reference to the delegator the previous patch file didn't work. This patch file fixes that issue.

          Show
          pfm.smits Pierre Smits added a comment - Due to a missing reference to the delegator the previous patch file didn't work. This patch file fixes that issue.
          Hide
          jacques.le.roux Jacques Le Roux added a comment -

          Ha yes, I see!

          Show
          jacques.le.roux Jacques Le Roux added a comment - Ha yes, I see!
          Hide
          pfm.smits Pierre Smits added a comment -

          This patch supersedes the v2 patch file as that one was generated on a dev instance that was not in sync with trunk.

          Show
          pfm.smits Pierre Smits added a comment - This patch supersedes the v2 patch file as that one was generated on a dev instance that was not in sync with trunk.
          Hide
          jacques.le.roux Jacques Le Roux added a comment - - edited

          Thanks Pierre,

          Your modified patch is in trunk at revision: 1729002 + 1729004

          In this is the 2nd commit I fixed 2 "typos" I spotted while reviewing in
          ecommerce/customer/editcontactmech.ftl
          ecommerce/customer/newcustomer.ftl
          where "UtilProperties" was not replaced

          Show
          jacques.le.roux Jacques Le Roux added a comment - - edited Thanks Pierre, Your modified patch is in trunk at revision: 1729002 + 1729004 In this is the 2nd commit I fixed 2 "typos" I spotted while reviewing in ecommerce/customer/editcontactmech.ftl ecommerce/customer/newcustomer.ftl where "UtilProperties" was not replaced
          Hide
          jacques.le.roux Jacques Le Roux added a comment -

          Breaks OFBIZ-9230. I guess it's a missing delegator in some special cases...

          Show
          jacques.le.roux Jacques Le Roux added a comment - Breaks OFBIZ-9230 . I guess it's a missing delegator in some special cases...
          Hide
          jacques.le.roux Jacques Le Roux added a comment -

          Indeed in the context of a FTL macro we miss to pass the delegator.

          Show
          jacques.le.roux Jacques Le Roux added a comment - Indeed in the context of a FTL macro we miss to pass the delegator.
          Hide
          jacques.le.roux Jacques Le Roux added a comment -

          Fixed in OFBIZ-9230

          Show
          jacques.le.roux Jacques Le Roux added a comment - Fixed in OFBIZ-9230

            People

            • Assignee:
              pfm.smits Pierre Smits
              Reporter:
              pfm.smits Pierre Smits
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development

                  Agile