You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2026/09/16 14:27:42 UTC
(ofbiz-framework) branch trunk updated: Fixed: Two regressions in saveExtFileDataResource's handling of a missing DataResource (OFBIZ-13597)
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 613043d657 Fixed: Two regressions in saveExtFileDataResource's handling of a missing DataResource (OFBIZ-13597)
613043d657 is described below
commit 613043d657bb16dd4191dc5949b67b0727ccd3a2
Author: Mridul Pathak <mr...@gmail.com>
AuthorDate: Wed Sep 16 18:42:19 2026 +0530
Fixed: Two regressions in saveExtFileDataResource's handling of a missing DataResource (OFBIZ-13597)
saveExtFileDataResource's isUpdate flag is determined by the caller from a different, related entity, decoupled from whether the base DataResource row actually exists. When that row is missing and no upload file is supplied, dereferencing it for the early-return result threw an NPE where the original minilang's dotted-field access on the absent value was tolerant; it now uses safe navigation to preserve that same success-with-null-fields behavior. Separately, when the row is missing a [...]
---
.../groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/applications/content/src/main/groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy b/applications/content/src/main/groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy
index 8be16a4f95..9129520dd6 100644
--- a/applications/content/src/main/groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy
+++ b/applications/content/src/main/groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy
@@ -292,12 +292,15 @@ Map saveExtFileDataResource(boolean isUpdate, String mode) {
if (!parameters._uploadedFile_fileName) {
if (isUpdate) {
// upload is found on an update; its okay, don't do anything just return
- result.dataResourceId = dataResource.dataResourceId
- result.mimeTypeId = dataResource.mimeTypeId
+ result.dataResourceId = dataResource?.dataResourceId
+ result.mimeTypeId = dataResource?.mimeTypeId
return result
}
errorList.add(UtilProperties.getMessage('ContentUiLabels', 'ContentNoUploadedContentFound', parameters.locale))
}
+ if (errorList) {
+ return ServiceUtil.returnError(errorList)
+ }
// update the data resource with file data
dataResource.dataResourceTypeId = parameters.dataResourceTypeId
dataResource.dataResourceName = parameters._uploadedFile_fileName