svn commit: r1800832 - /ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java

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

svn commit: r1800832 - /ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java

mbrohl
Author: mbrohl
Date: Tue Jul  4 22:11:55 2017
New Revision: 1800832

URL: http://svn.apache.org/viewvc?rev=1800832&view=rev
Log:
Reverted: ContentWorker#findAlternateLocaleContent(Delegator, GenericValue, Locale)
does not use fallback locale.
(OFBIZ-9445)

r1800780 introduced a bug which breaks the functionality.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java?rev=1800832&r1=1800831&r2=1800832&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java Tue Jul  4 22:11:55 2017
@@ -39,7 +39,6 @@ import org.apache.ofbiz.base.util.UtilCo
 import org.apache.ofbiz.base.util.UtilDateTime;
 import org.apache.ofbiz.base.util.UtilGenerics;
 import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilProperties;
 import org.apache.ofbiz.base.util.UtilValidate;
 import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
 import org.apache.ofbiz.content.ContentManagementWorker;
@@ -400,9 +399,9 @@ public class ContentWorker implements or
     }
 
     public static GenericValue findAlternateLocaleContent(Delegator delegator, GenericValue view, Locale locale) {
-        GenericValue contentAssocDataResourceViewFrom = null;
+        GenericValue contentAssocDataResourceViewFrom = view;
         if (locale == null) {
-            return view;
+            return contentAssocDataResourceViewFrom;
         }
 
         String localeStr = locale.toString();
@@ -413,12 +412,9 @@ public class ContentWorker implements or
             alternateViews = view.getRelated("ContentAssocDataResourceViewTo", UtilMisc.toMap("caContentAssocTypeId", "ALTERNATE_LOCALE"), UtilMisc.toList("-caFromDate"), true);
         } catch (GenericEntityException e) {
             Debug.logError(e, "Error finding alternate locale content: " + e.toString(), module);
-            return view;
+            return contentAssocDataResourceViewFrom;
         }
 
-        // also check the given view for a matching locale
-        alternateViews.add(0, view);
-
         alternateViews = EntityUtil.filterByDate(alternateViews, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true);
         for (GenericValue thisView : alternateViews) {
             String currentLocaleString = thisView.getString("localeString");
@@ -458,14 +454,6 @@ public class ContentWorker implements or
             }
         }
 
-        if (contentAssocDataResourceViewFrom == null) {
-            // no content matching the given locale found.
-            Locale fallbackLocale = UtilProperties.getFallbackLocale();
-            contentAssocDataResourceViewFrom = locale.equals(fallbackLocale) ? view
-                    // only search for a content with the fallbackLocale if it is different to the given locale
-                    : findAlternateLocaleContent(delegator, view, fallbackLocale);
-        }
-
         return contentAssocDataResourceViewFrom;
     }