Skip to content

Commit

Permalink
fixed files form Time #21
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 836f588 commit 96cf5f0
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions projects/Time/21/org/joda/time/tz/DefaultNameProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,32 @@ private synchronized String[] getNameSet(Locale locale, String id, String nameKe
if (byNameKeyCache == null) {
byIdCache.put(id, byNameKeyCache = createCache());

String[][] zoneStringsEn = DateTimeUtils.getDateFormatSymbols(Locale.ENGLISH).getZoneStrings();
String[] setEn = null;
for (String[] strings : zoneStringsEn) {
if (strings != null && strings.length == 5 && id.equals(strings[0])) {
setEn = strings;
break;
}
}
String[][] zoneStringsLoc = DateTimeUtils.getDateFormatSymbols(locale).getZoneStrings();
String[] setLoc = null;
for (String[] strings : zoneStringsLoc) {
if (strings != null && strings.length == 5 && id.equals(strings[0])) {
setLoc = strings;
break;
}
}

byNameKeyCache.put(setLoc[2], new String[] {setLoc[2], setLoc[1]});
if (setEn != null && setLoc != null) {
byNameKeyCache.put(setEn[2], new String[] {setLoc[2], setLoc[1]});
// need to handle case where summer and winter have the same
// abbreviation, such as EST in Australia [1716305]
// we handle this by appending "-Summer", cf ZoneInfoCompiler
if (setLoc[2].equals(setLoc[4])) {
byNameKeyCache.put(setLoc[4] + "-Summer", new String[] {setLoc[4], setLoc[3]});
if (setEn[2].equals(setEn[4])) {
byNameKeyCache.put(setEn[4] + "-Summer", new String[] {setLoc[4], setLoc[3]});
} else {
byNameKeyCache.put(setLoc[4], new String[] {setLoc[4], setLoc[3]});
}
break;
byNameKeyCache.put(setEn[4], new String[] {setLoc[4], setLoc[3]});
}
}
}
Expand Down

0 comments on commit 96cf5f0

Please sign in to comment.