svn commit: r1812350 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java

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

svn commit: r1812350 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java

Deepak Dixit-5
Author: deepak
Date: Tue Oct 17 06:06:56 2017
New Revision: 1812350

URL: http://svn.apache.org/viewvc?rev=1812350&view=rev
Log:
Improved: Usage of factory method or Builder pattern for Locale object creation and usage.
Thanks Yash Sharma for your contribution. (OFBIZ-9488)

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java?rev=1812350&r1=1812349&r2=1812350&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java Tue Oct 17 06:06:56 2017
@@ -523,12 +523,12 @@ public final class UtilMisc {
         Locale locale = null;
         if (localeString.length() == 2) {
             // two letter language code
-            locale = new Locale(localeString);
+            locale = new Locale.Builder().setLanguage(localeString).build();
         } else if (localeString.length() == 5) {
             // positions 0-1 language, 3-4 are country
             String language = localeString.substring(0, 2);
             String country = localeString.substring(3, 5);
-            locale = new Locale(language, country);
+            locale = new Locale.Builder().setLanguage(language).setRegion(country).build();
         } else if (localeString.length() > 6) {
             // positions 0-1 language, 3-4 are country, 6 and on are special extensions
             String language = localeString.substring(0, 2);