This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release24.09 by this push:
new 49038f0c2a Copy nested attributes and validators when copying a
service parameter
49038f0c2a is described below
commit 49038f0c2a19b0d96c2c13db038e5ee833aceba3
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 28dc20e06a..de39b33c57 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.setDefaultValue(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));
+ }
+ }
}
/**