This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 73785d3ba1 Improved: avoids error message related to call to 
getUiLabels w/o parameters
73785d3ba1 is described below

commit 73785d3ba141485106aec30719f45ab35ddae0e0
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Mon Dec 9 11:49:01 2024 +0100

    Improved: avoids error message related to call to getUiLabels w/o parameters
    
    I discovered this by chance while looking for the behaviour of Freemarker 
<#sep>
    tag.
    
    Error running script at location [...GetUiLabels.groovy]:
    java.lang.IllegalArgumentException: Text must not be null or empty
      at groovy.json.JsonSlurper.parseText(JsonSlurper.java:203)
      at 
org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
      at org.apache.ofbiz.common.GetUiLabels.run(GetUiLabels.groovy:21) 
~[main/:?]
    
    I guess this should not happen because calls to getUiLabels w/o parameters
    should not happen. Anyway, prevents that in case (no Jira, no backport)
---
 themes/common-theme/template/GetUiLabels.ftl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/themes/common-theme/template/GetUiLabels.ftl 
b/themes/common-theme/template/GetUiLabels.ftl
index 34733f61e9..cb682e63da 100644
--- a/themes/common-theme/template/GetUiLabels.ftl
+++ b/themes/common-theme/template/GetUiLabels.ftl
@@ -17,5 +17,6 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-
-{<#if requiredLabels?has_content && requiredLabels?is_sequence><#list 
requiredLabels as label>"${label}": 
"${Static["org.apache.ofbiz.base.util.StringUtil"].wrapString(uiLabelMap[label])}"<#sep>,</#list></#if>}
+<#if parameters.requiredLabels??>
+  {<#if requiredLabels?? && requiredLabels?is_sequence><#list requiredLabels 
as label>"${label}": 
"${Static["org.apache.ofbiz.base.util.StringUtil"].wrapString(uiLabelMap[label])}"<#sep>,</#list></#if>}
+</#if>

Reply via email to