svn commit: r1865924 - /ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java

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

svn commit: r1865924 - /ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java

nmalin
Author: nmalin
Date: Mon Aug 26 09:54:55 2019
New Revision: 1865924

URL: http://svn.apache.org/viewvc?rev=1865924&view=rev
Log:
Fixed: CategoryServices returns null when opening Product main page
(OFBIZ-11175)
Increase parsing control to don't realize it on null value for viewSizeString
when call service getProductCategoryAndLimitedMembers.

Thanks Jacques Leroux for raise this issue

Modified:
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java?rev=1865924&r1=1865923&r2=1865924&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java Mon Aug 26 09:54:55 2019
@@ -236,17 +236,23 @@ public class CategoryServices {
 
         Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
         int viewIndex = 0;
-        try {
-            viewIndex = Integer.parseInt((String) context.get("viewIndexString"));
-        } catch (Exception e) {
-            viewIndex = 0;
+        if (context.containsKey("viewIndexString")) {
+            try {
+                viewIndex = Integer.parseInt((String) context.get("viewIndexString"));
+            } catch (Exception e) {
+                viewIndex = 0;
+            }
         }
 
         int viewSize = defaultViewSize;
-        try {
-            viewSize = Integer.parseInt((String) context.get("viewSizeString"));
-        } catch (NumberFormatException e) {
-            Debug.logError(e.getMessage(), module);
+        if (context.containsKey("viewSizeString")) {
+            try {
+                viewSize = Integer.parseInt((String) context.get("viewSizeString"));
+            } catch (NumberFormatException e) {
+                Debug.logWarning("Fail to parse viewSizeString "
+                        + context.get("viewSizeString")
+                        + " " + e.getMessage(), module);
+            }
         }
 
         GenericValue productCategory;