svn commit: r1784259 - /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java

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

svn commit: r1784259 - /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java

jleroux@apache.org
Author: jleroux
Date: Fri Feb 24 10:52:09 2017
New Revision: 1784259

URL: http://svn.apache.org/viewvc?rev=1784259&view=rev
Log:
No functional change, related with "Missing reference to the delegator in
framework/widget/templates/HtmlFormMacroLibrary.ftl"
(OFBIZ-9230)

To reproduce

1. Load test data <SystemProperty systemResourceId="widget"
systemPropertyId="widget.autocompleter.defaultMinLength"
systemPropertyValue="3"/>
2. Open https://localhost:8443/partymgr/control/main
3. You will still get warning below in log file


|EntityUtilProperties          |I| Could not get a system property for
widget.autocompleter.defaultMinLength : null


jleroux: the reason is in the context of a FTL macro we lose the delegator
(in context) when calling  
executeMacro(writer, sr.toString());
from
MacroFormRenderer.renderTextField()
So we need to find a way to pass the delegator to be used when evaluating
the Freemarker template. For now I have simply added a clearer explanation
of the reason.

Thanks: Wei Zhang for report

Modified:
    ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java?rev=1784259&r1=1784258&r2=1784259&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java Fri Feb 24 10:52:09 2017
@@ -61,6 +61,10 @@ public final class EntityUtilProperties
             return results;
         }
         resource = resource.replace(".properties", "");
+        if (delegator == null) {
+            Debug.logInfo("Could not get a system property for " + name + ". Reason: the delegator is null", module);
+            return results;
+        }
         try {
             GenericValue systemProperty = EntityQuery.use(delegator)
                     .from("SystemProperty")