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

Print this page
rev 6999 : imported patch 8013086

*** 1,7 **** /* ! * Copyright (c) 2005, 2012, 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 --- 1,7 ---- /* ! * 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
*** 29,38 **** --- 29,39 ---- import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; + import java.util.TimeZone; import java.util.concurrent.ConcurrentHashMap; import java.util.spi.TimeZoneNameProvider; import sun.util.calendar.ZoneInfo; /**
*** 234,255 **** } private static String[] buildZoneStrings(TimeZoneNameProvider tznp, 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) { ! // this id seems not localized by this provider ! names = null; } return names; } } --- 235,266 ---- } private static String[] buildZoneStrings(TimeZoneNameProvider tznp, Locale locale, String id) { String[] names = new String[5]; + names[1] = tznp.getDisplayName(id, false, TimeZone.LONG, locale); ! if (names[1] == null) { ! // this id seems not localized by this provider ! return null; ! } ! ! for (int i = 2; i <= 4; i ++) { names[i] = tznp.getDisplayName(id, i>=3, i%2, locale); + + // If the display name for DST is not supplied, copy the "standard" + // name. if (i >= 3 && names[i] == null) { names[i] = names[i-2]; } ! // If the display name for SHORT is not supplied, copy the LONG ! // name. ! if (i % 2 == 0 && names[i] == null) { ! names[i] = names[i-1]; } + } return names; } }