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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

ashish-18
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