src/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java

Print this page
rev 7036 : imported patch 8013086

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -237,19 +237,30 @@
                                                  Locale locale, String id) {
             String[] names = new String[5];
 
             for (int i = 1; i <= 4; i ++) {
                 names[i] = tznp.getDisplayName(id, i>=3, i%2, locale);
-                if (i >= 3 && names[i] == null) {
-                    names[i] = names[i-2];
-                }
-            }
 
-            if (names[1] == null) {
+                if (names[i] == null) {
+                    switch (i) {
+                    case 1:
                 // this id seems not localized by this provider
-                names = null;
+                        return null;
+                    case 2:
+                    case 4:
+                        // If the display name for SHORT is not supplied,
+                        // copy the LONG name.
+                        names[i] = names[i-1];
+                        break;
+                    case 3:
+                        // If the display name for DST is not supplied,
+                        // copy the "standard" name.
+                        names[3] = names[1];
+                        break;
             }
+                }
+            }
 
             return names;
         }
     }