You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2008/10/08 09:06:55 UTC

svn commit: r702740 - /ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java

Author: ashish
Date: Wed Oct  8 00:06:54 2008
New Revision: 702740

URL: http://svn.apache.org/viewvc?rev=702740&view=rev
Log:
Applied patch from JIRA issue no.(https://issues.apache.org/jira/browse/OFBIZ-1989) -: Give NPE in rendering the Survey page.  

Thanks Sumit Pandit for your contribution.

Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java?rev=702740&r1=702739&r2=702740&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java Wed Oct  8 00:06:54 2008
@@ -592,15 +592,21 @@
                     switch (type) {
                         case 1:
                             Long n = value.getLong("numericResponse");
-                            result[1] += n.longValue();
+                            if (UtilValidate.isNotEmpty(n)) {
+                                result[1] += n.longValue();
+                            }
                             break;
                         case 2:
                             Double c = value.getDouble("currencyResponse");
-                            result[1] += (((double) Math.round((c.doubleValue() - c.doubleValue()) * 100)) / 100);
+                            if (UtilValidate.isNotEmpty(c)) {
+                                result[1] += (((double) Math.round((c.doubleValue() - c.doubleValue()) * 100)) / 100);
+                            }
                             break;
                         case 3:
                             Double f = value.getDouble("floatResponse");
-                            result[1] += f.doubleValue();
+                            if (UtilValidate.isNotEmpty(f)) {
+                                result[1] += f.doubleValue();
+                            }
                             break;
                     }
                     result[0]++; // increment the count