From db2d36dac54e0e1f0678f988bc7fbb9bd7bbd771 Mon Sep 17 00:00:00 2001 From: Alfred Maxwell Byers Date: Tue, 25 Sep 2007 20:39:33 +0000 Subject: [PATCH] Fixing a really lame bug that I introduced. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@579373 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/ofbiz/content/content/ContentWorker.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/applications/content/src/org/ofbiz/content/content/ContentWorker.java b/applications/content/src/org/ofbiz/content/content/ContentWorker.java index 8e1da954c4..0b374820fd 100644 --- a/applications/content/src/org/ofbiz/content/content/ContentWorker.java +++ b/applications/content/src/org/ofbiz/content/content/ContentWorker.java @@ -113,6 +113,10 @@ public class ContentWorker implements org.ofbiz.widget.ContentWorkerInterface { public static void renderContentAsText(LocalDispatcher dispatcher, GenericDelegator delegator, String contentId, Writer out, Map templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException { GenericValue content; + if (UtilValidate.isEmpty(contentId)) { + Debug.logError("No content ID found.", module); + return; + } if (cache) { content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentId)); } else { @@ -178,6 +182,10 @@ public class ContentWorker implements org.ofbiz.widget.ContentWorkerInterface { String templateDataResourceId = content.getString("templateDataResourceId"); String dataResourceId = content.getString("dataResourceId"); contentId = content.getString("contentId"); + if (UtilValidate.isEmpty(contentId)) { + Debug.logError("No dataResourceId found.", module); + return; + } if (templateContext == null) { templateContext = FastMap.newInstance(); @@ -216,6 +224,10 @@ public class ContentWorker implements org.ofbiz.widget.ContentWorkerInterface { // now if no template; just render the data if (UtilValidate.isEmpty(templateDataResourceId) || templateContext.containsKey("ignoreTemplate")) { + if (UtilValidate.isEmpty(contentId)) { + Debug.logError("No content ID found.", module); + return; + } DataResourceWorker.renderDataResourceAsText(delegator, dataResourceId, out, templateContext, locale, mimeTypeId, cache); // there is a template; render the data and then the template