byIdCache.put(id, byNameKeyCache = createCache()); String[][] zoneStringsEn = DateTimeUtils.getDateFormatSymbols(Locale.ENGLISH).getZoneStrings(); String[] setEn = null; for (String[] strings : zoneStringsEn) { String[][] zoneStringsLoc = DateTimeUtils.getDateFormatSymbols(locale).getZoneStrings(); String[] setLoc = null; for (String[] strings : zoneStringsLoc) {
/** * Wrapper method to the getZoneStrings(), which is called from inside * the java.text package and not to mutate the returned arrays, so that * it does not need to create a defensive copy. */ final String[][] getZoneStringsWrapper() { if (isSubclassObject()) { return getZoneStrings(); } else { return getZoneStringsImpl(false); } }
byIdCache.put(id, byNameKeyCache = createCache()); String[][] zoneStringsEn = DateTimeUtils.getDateFormatSymbols(Locale.ENGLISH).getZoneStrings(); String[] setEn = null; for (String[] strings : zoneStringsEn) { String[][] zoneStringsLoc = DateTimeUtils.getDateFormatSymbols(locale).getZoneStrings(); String[] setLoc = null; for (String[] strings : zoneStringsLoc) {
byIdCache.put(id, byNameKeyCache = createCache()); String[][] zoneStringsEn = DateTimeUtils.getDateFormatSymbols(Locale.ENGLISH).getZoneStrings(); String[] setEn = null; for (String[] strings : zoneStringsEn) { String[][] zoneStringsLoc = DateTimeUtils.getDateFormatSymbols(locale).getZoneStrings(); String[] setLoc = null; for (String[] strings : zoneStringsLoc) {
TimeZoneStrategy(final Locale locale) { final String[][] zones = DateFormatSymbols.getInstance(locale).getZoneStrings(); for (String[] zone : zones) { if (zone[ID].startsWith("GMT")) { continue; } final TimeZone tz = TimeZone.getTimeZone(zone[ID]); if (!tzNames.containsKey(zone[LONG_STD])) { tzNames.put(zone[LONG_STD], tz); } if (!tzNames.containsKey(zone[SHORT_STD])) { tzNames.put(zone[SHORT_STD], tz); } if (tz.useDaylightTime()) { if (!tzNames.containsKey(zone[LONG_DST])) { tzNames.put(zone[LONG_DST], tz); } if (!tzNames.containsKey(zone[SHORT_DST])) { tzNames.put(zone[SHORT_DST], tz); } } } final StringBuilder sb = new StringBuilder(); sb.append("(GMT[+\\-]\\d{0,1}\\d{2}|[+\\-]\\d{2}:?\\d{2}|"); for (final String id : tzNames.keySet()) { escapeRegex(sb, id, false).append('|'); } sb.setCharAt(sb.length() - 1, ')'); validTimeZoneChars = sb.toString(); }
TimeZoneStrategy(final Locale locale) { final String[][] zones = DateFormatSymbols.getInstance(locale).getZoneStrings(); for (String[] zone : zones) { if (zone[ID].startsWith("GMT")) { continue; } final TimeZone tz = TimeZone.getTimeZone(zone[ID]); if (!tzNames.containsKey(zone[LONG_STD])) { tzNames.put(zone[LONG_STD], tz); } if (!tzNames.containsKey(zone[SHORT_STD])) { tzNames.put(zone[SHORT_STD], tz); } if (tz.useDaylightTime()) { if (!tzNames.containsKey(zone[LONG_DST])) { tzNames.put(zone[LONG_DST], tz); } if (!tzNames.containsKey(zone[SHORT_DST])) { tzNames.put(zone[SHORT_DST], tz); } } } final StringBuilder sb = new StringBuilder(); sb.append("(GMT[+\\-]\\d{0,1}\\d{2}|[+\\-]\\d{2}:?\\d{2}|"); for (final String id : tzNames.keySet()) { escapeRegex(sb, id, false).append('|'); } sb.setCharAt(sb.length() - 1, ')'); validTimeZoneChars = sb.toString(); }
byIdCache.put(id, byNameKeyCache = createCache()); String[][] zoneStringsEn = DateTimeUtils.getDateFormatSymbols(Locale.ENGLISH).getZoneStrings(); String[] setEn = null; for (String[] strings : zoneStringsEn) { String[][] zoneStringsLoc = DateTimeUtils.getDateFormatSymbols(locale).getZoneStrings(); String[] setLoc = null; for (String[] strings : zoneStringsLoc) {
byIdCache.put(id, byNameKeyCache = createCache()); String[][] zoneStringsEn = DateTimeUtils.getDateFormatSymbols(Locale.ENGLISH).getZoneStrings(); String[] setEn = null; for (String[] strings : zoneStringsEn) { String[][] zoneStringsLoc = DateTimeUtils.getDateFormatSymbols(locale).getZoneStrings(); String[] setLoc = null; for (String[] strings : zoneStringsLoc) {
final String[][] zones = DateFormatSymbols.getInstance(locale).getZoneStrings(); for (final String[] zoneNames : zones) {
byIdCache.put(id, byNameKeyCache = createCache()); String[][] zoneStringsEn = DateTimeUtils.getDateFormatSymbols(Locale.ENGLISH).getZoneStrings(); String[] setEn = null; for (String[] strings : zoneStringsEn) { String[][] zoneStringsLoc = DateTimeUtils.getDateFormatSymbols(locale).getZoneStrings(); String[] setLoc = null; for (String[] strings : zoneStringsLoc) {
final String[][] zones = DateFormatSymbols.getInstance(locale).getZoneStrings(); for (final String[] zoneNames : zones) {
final String[][] zones = DateFormatSymbols.getInstance(locale).getZoneStrings(); for (final String[] zoneNames : zones) {
@Test public void testTimeZoneStrategyPattern() { for(final Locale locale : Locale.getAvailableLocales()) { final FastDateParser parser = new FastDateParser("z", TimeZone.getDefault(), locale); final String[][] zones = DateFormatSymbols.getInstance(locale).getZoneStrings(); for(final String[] zone : zones) { for(int t = 1; t<zone.length; ++t) { final String tzDisplay = zone[t]; if (tzDisplay == null) { break; } try { parser.parse(tzDisplay); } catch(final Exception ex) { fail("'" + tzDisplay + "'" + " Locale: '" + locale.getDisplayName() + "'" + " TimeZone: " + zone[0] + " offset: " + t + " defaultLocale: " + Locale.getDefault() + " defaultTimeZone: " + TimeZone.getDefault().getDisplayName() ); } } } } }
String[][] zoneStrings = new DateFormatSymbols(Locale.ENGLISH).getZoneStrings(); for (int j = 0; j < zoneStrings.length; j++) { String[] set = zoneStrings[j];
String[][] zoneStrings = new DateFormatSymbols(Locale.ENGLISH).getZoneStrings(); for (int j = 0; j < zoneStrings.length; j++) { String[] set = zoneStrings[j];
String[][] zoneStrings = new DateFormatSymbols(Locale.ENGLISH).getZoneStrings(); for (int j = 0; j < zoneStrings.length; j++) { String[] set = zoneStrings[j];
@Test public void testTimeZoneStrategyPattern() { for(final Locale locale : Locale.getAvailableLocales()) { final FastDateParser parser = new FastDateParser("z", TimeZone.getDefault(), locale); final String[][] zones = DateFormatSymbols.getInstance(locale).getZoneStrings(); for(final String[] zone : zones) { for(int t = 1; t<zone.length; ++t) { final String tzDisplay = zone[t]; if (tzDisplay == null) { break; } try { parser.parse(tzDisplay); } catch(final Exception ex) { Assert.fail("'" + tzDisplay + "'" + " Locale: '" + locale.getDisplayName() + "'" + " TimeZone: " + zone[0] + " offset: " + t + " defaultLocale: " + Locale.getDefault() + " defaultTimeZone: " + TimeZone.getDefault().getDisplayName() ); } } } } }
byIdCache.put(id, byNameKeyCache = createCache()); String[][] zoneStringsEn = DateTimeUtils.getDateFormatSymbols(Locale.ENGLISH).getZoneStrings(); String[] setEn = null; for (String[] strings : zoneStringsEn) { String[][] zoneStringsLoc = DateTimeUtils.getDateFormatSymbols(locale).getZoneStrings(); String[] setLoc = null; for (String[] strings : zoneStringsLoc) {
String[][] zoneStrings = new DateFormatSymbols(Locale.ENGLISH).getZoneStrings(); for (int j = 0; j < zoneStrings.length; j++) { String[] set = zoneStrings[j];
@Override public String[][] getZoneStrings() { if (fIcuDfs == null) { return super.getZoneStrings(); } return fIcuDfs.getZoneStrings(); }