snuyanzin commented on code in PR #3113:
URL: https://github.com/apache/calcite/pull/3113#discussion_r1213265269


##########
core/src/main/java/org/apache/calcite/util/Util.java:
##########
@@ -1717,16 +1719,14 @@ private static void appendPosixTime(StringBuilder buf, 
int millis) {
    * @return Java locale object
    */
   public static Locale parseLocale(String localeString) {
-    String[] strings = localeString.split("_");
-    switch (strings.length) {
-    case 1:
-      return new Locale(strings[0]);
-    case 2:
-      return new Locale(strings[0], strings[1]);
-    case 3:
-      return new Locale(strings[0], strings[1], strings[2]);
-    default:
-      throw new AssertionError("bad locale string '" + localeString + "'");
+    if (localeString.isEmpty()) {
+      return Locale.ROOT;

Review Comment:
   if we are using `Locale.Builder.setLanguageTag` as was suggested in other 
comment https://github.com/apache/calcite/pull/3113/files#r1212934318 then yes.
   
   The issue with `Locale.Builder.setLanguageTag` is that it does not allow 
empty `lcoalStr` and fails.
   I mentioned it in same thread, probably should do it here  as well



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to