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 6f64c433cb Fixed: createEmailAddress and updateEmailAddress accept 
blank email addresses (OFBIZ-13582)
6f64c433cb is described below

commit 6f64c433cbc166ca3df2f7348d3e94b811f42fc9
Author: Mridul Pathak <[email protected]>
AuthorDate: Tue Sep 15 15:49:25 2026 +0530

    Fixed: createEmailAddress and updateEmailAddress accept blank email 
addresses (OFBIZ-13582)
    
    Both methods gated only on UtilValidate.isEmail(parameters.emailAddress), 
which returns true for a null or blank string by design. Combined with the 
servicedef declaring emailAddress required but with no type-validate rule, and 
the service engine's required-parameter check only rejecting null rather than 
blank, a caller passing an empty string sailed through and created or updated a 
real ContactMech with a blank infoString. The original minilang had two 
explicit checks, not-empty then [...]
---
 .../org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy
 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy
index 4126f25546..c815df2e34 100644
--- 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy
+++ 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy
@@ -189,6 +189,9 @@ Map updateTelecomNumber() {
  * Create an email address contact mechanism
  */
 Map createEmailAddress() {
+    if (!parameters.emailAddress) {
+        return error(UtilProperties.getMessage('PartyUiLabels', 
'PartyEmailAddressMissing', locale))
+    }
     if (UtilValidate.isEmail(parameters.emailAddress)) {
         Map createContactMechMap = [contactMechTypeId: 'EMAIL_ADDRESS',
                                     contactMechId: parameters.contactMechId,
@@ -206,6 +209,9 @@ Map createEmailAddress() {
  * Update an email address contact mechanism
  */
 Map updateEmailAddress() {
+    if (!parameters.emailAddress) {
+        return error(UtilProperties.getMessage('PartyUiLabels', 
'PartyEmailAddressMissing', locale))
+    }
     if (UtilValidate.isEmail(parameters.emailAddress)) {
         Map updateContactMechMap = [contactMechTypeId: 'EMAIL_ADDRESS',
                                     contactMechId: parameters.contactMechId,

Reply via email to