You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by by...@apache.org on 2007/09/25 22:39:34 UTC

svn commit: r579373 - /ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java

Author: byersa
Date: Tue Sep 25 13:39:33 2007
New Revision: 579373

URL: http://svn.apache.org/viewvc?rev=579373&view=rev
Log:
Fixing a really lame bug that I introduced.

Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java?rev=579373&r1=579372&r2=579373&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java Tue Sep 25 13:39:33 2007
@@ -113,6 +113,10 @@
     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 @@
         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 @@
 
             // 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