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 971b3b85ec Fixed: Survey PDF services throw a NullPointerException
when contentId matches no Content (OFBIZ-13692)
971b3b85ec is described below
commit 971b3b85ecdce035ba82b833e39cabb616dc3f05
Author: Mridul Pathak <[email protected]>
AuthorDate: Fri Oct 16 19:06:21 2026 +0530
Fixed: Survey PDF services throw a NullPointerException when contentId
matches no Content (OFBIZ-13692)
PdfSurveyServices.getInputByteBuffer now returns no input when the
contentId matches no Content, or a Content without a DataResource, so the
survey PDF services return the "No PDF was given." error instead of failing
with a NullPointerException or an unexpected exception.
---
.../java/org/apache/ofbiz/content/survey/PdfSurveyServices.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git
a/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java
b/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java
index 16f217359f..cc1e6ec3d4 100644
---
a/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java
+++
b/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java
@@ -576,8 +576,11 @@ public class PdfSurveyServices {
String webSiteId = (String) context.get("webSiteId");
String rootDir = (String) context.get("rootDir");
GenericValue content =
EntityQuery.use(delegator).from("Content").where("contentId",
contentId).cache().queryOne();
- String dataResourceId =
content.getString("dataResourceId");
- inputByteBuffer =
DataResourceWorker.getContentAsByteBuffer(delegator, dataResourceId, https,
webSiteId, locale, rootDir);
+ String dataResourceId = content != null ?
content.getString("dataResourceId") : null;
+ if (UtilValidate.isNotEmpty(dataResourceId)) {
+ inputByteBuffer =
DataResourceWorker.getContentAsByteBuffer(delegator, dataResourceId, https,
webSiteId, locale,
+ rootDir);
+ }
} catch (GenericEntityException | IOException e) {
throw(new GeneralException(e.getMessage()));
}