This is an automated email from the ASF dual-hosted git repository.
mridulpathak 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 9c0dd5f115 Copy nested attributes and validators when copying a
service parameter
9c0dd5f115 is described below
commit 9c0dd5f115d6f0f77289c301e891ef20a89d8e78
Author: Mridul Pathak <[email protected]>
AuthorDate: Sat Oct 31 18:31:32 2026 +0530
Copy nested attributes and validators when copying a service parameter
The ModelParam copy constructor left out the nested attributes and shared
the original's validator list, so copied parameters and parameters inherited
through implements lost the validation and type conversion of their nested
attributes. The copy now copies its children and has its own validator list.
---
.../src/main/java/org/apache/ofbiz/service/ModelParam.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git
a/framework/service/src/main/java/org/apache/ofbiz/service/ModelParam.java
b/framework/service/src/main/java/org/apache/ofbiz/service/ModelParam.java
index 55057dddf3..e1b832bf50 100644
--- a/framework/service/src/main/java/org/apache/ofbiz/service/ModelParam.java
+++ b/framework/service/src/main/java/org/apache/ofbiz/service/ModelParam.java
@@ -112,7 +112,9 @@ public class ModelParam implements Serializable {
this.sessionAttributeName = param.sessionAttributeName;
this.stringMapPrefix = param.stringMapPrefix;
this.stringListSuffix = param.stringListSuffix;
- this.validators = param.validators;
+ if (param.validators != null) {
+ this.validators = new ArrayList<>(param.validators);
+ }
if (param.defaultValue != null) {
this.defaultValue =
FlexibleStringExpander.getInstance(param.defaultValue.getOriginal());
}
@@ -122,6 +124,12 @@ public class ModelParam implements Serializable {
this.overrideFormDisplay = param.overrideFormDisplay;
this.allowHtml = param.allowHtml;
this.internal = param.internal;
+ if (param.children != null) {
+ this.children = new ArrayList<>(param.children.size());
+ for (ModelParam child : param.children) {
+ this.children.add(new ModelParam(child));
+ }
+ }
}
/**