You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2017/11/07 13:58:58 UTC

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

Author: jleroux
Date: Tue Nov  7 13:58:58 2017
New Revision: 1814501

URL: http://svn.apache.org/viewvc?rev=1814501&view=rev
Log:
Fixed: NullPointer Access in CategoryContentWrapper.getProductCategoryContentAsText 
when locale parameter is missing
(OFBIZ-9970)

The said method is not nullpointer-safe; it is possible, that the method crashes
 and produces a nullpointer-exception at this point:
String sessionLocale = locale.toString();

Thanks: Dennis Balkir

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

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java?rev=1814501&r1=1814500&r2=1814501&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java Tue Nov  7 13:58:58 2017
@@ -147,9 +147,9 @@ public class CategoryContentWrapper impl
 
         List<GenericValue> categoryContentList = EntityQuery.use(delegator).from("ProductCategoryContent").where("productCategoryId", productCategoryId, "prodCatContentTypeId", prodCatContentTypeId).orderBy("-fromDate").cache(cache).queryList();
         categoryContentList = EntityUtil.filterByDate(categoryContentList);
-        
+
         GenericValue categoryContent = null;
-        String sessionLocale = locale.toString();
+        String sessionLocale = (locale != null ? locale.toString() : null);
         String fallbackLocale = UtilProperties.getFallbackLocale().toString();
         if ( sessionLocale == null ) sessionLocale = fallbackLocale;
         // look up all content found for locale