[OFBiz] SVN: r7811 - trunk/framework/widget/src/org/ofbiz/widget/screen

jonesde@svn.ofbiz.org jonesde at svn.ofbiz.org
Sat Jun 17 22:04:04 CDT 2006


Author: jonesde
Date: 2006-06-17 22:04:01 -0500 (Sat, 17 Jun 2006)
New Revision: 7811

Modified:
   trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
Log:
Applied patch from Hans Bakker to fix NPE in content rendering by ID in the screen widget; changed the handling to throw and exception instead of just logging an error, using the same pattern as elsewhere in the screen widget widgets; ASF Jira #OFBIZ-10

Modified: trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
===================================================================
--- trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java	2006-06-18 00:13:49 UTC (rev 7810)
+++ trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java	2006-06-18 03:04:01 UTC (rev 7811)
@@ -858,7 +858,13 @@
                     if (UtilValidate.isNotEmpty(expandedContentId)) {
                     	content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", expandedContentId));
                     }
-                    expandedDataResourceId = content.getString("dataResourceId");
+                    if (content != null) {
+                        expandedDataResourceId = content.getString("dataResourceId");
+                    } else {
+                        String errMsg = "Could not find content with contentId [" + expandedContentId + "] ";
+                        Debug.logError(errMsg, module);
+                        throw new RuntimeException(errMsg);
+                    }
                 }
                 GenericValue dataResource = null;
                 if (UtilValidate.isNotEmpty(expandedDataResourceId)) {



More information about the Svn mailing list