src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
changeset 54097 9fc262a75638
parent 47216 71c04702a3d5
child 59043 1a79b4bfc85a
--- a/src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java	Wed Mar 13 12:02:04 2019 +0000
+++ b/src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java	Wed Mar 13 13:05:37 2019 +0900
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -510,8 +510,15 @@
             public String getDisplayCountry(String countryCode, Locale locale) {
                 // Retrieves the display country name by calling
                 // GetLocaleInfoEx(LOCALE_SLOCALIZEDCOUNTRYNAME).
-                return getDisplayString(locale.toLanguageTag(),
-                            DN_LOCALE_REGION, nativeDisplayLanguage+"-"+countryCode);
+                String str = getDisplayString(locale.toLanguageTag(),
+                                 DN_LOCALE_REGION,
+                                 nativeDisplayLanguage+"-"+countryCode);
+                // Hack: Windows 10 returns translated "Unknown Region (XX)"
+                // for localized XX region name. Take that as not known.
+                if (str != null && str.endsWith("("+countryCode+")")) {
+                    return null;
+                }
+                return str;
             }
 
             @Override