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 a8b9de444a Improved: Improvement of the Check XML tag (OFBIZ-12821) a8b9de444a is described below commit a8b9de444a026b083f5dbaa06fd08f7fa7845307 Author: Jacques Le Roux <jacques.le.r...@les7arts.com> AuthorDate: Fri Feb 16 18:32:33 2024 +0100 Improved: Improvement of the Check XML tag (OFBIZ-12821) This should fix the integration tests and the WebtoolsLayoutDemo page --- .../apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java index 8cdb63779c..fafdfd4821 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java @@ -23,6 +23,7 @@ import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLEncoder; +import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; @@ -530,9 +531,12 @@ public final class MacroFormRenderer implements FormStringRenderer { String event = modelFormField.getEvent(); String action = modelFormField.getAction(context); StringBuilder items = new StringBuilder(); - List<String> checkedByDefault = context.containsKey(checkField.getModelFormField().getAttributeName()) - ? StringUtil.toList(context.get(checkField.getModelFormField().getAttributeName()).toString()) - : List.of(); + String checkBox = checkField.getModelFormField().getAttributeName(); + List<String> checkedByDefault = new ArrayList<String>(); + if (context.containsKey(checkBox) && !context.get(checkBox).getClass().equals(String.class)) { + checkedByDefault = context.containsKey(checkBox) ? StringUtil.toList(context.get(checkBox).toString()) + : List.of(); + } if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle())) { className = modelFormField.getWidgetStyle(); if (modelFormField.shouldBeRed(context)) {