Permalink
Browse files

robust handling of customized platform zone ids

  • Loading branch information...
MenoData committed Jul 22, 2018
1 parent 86e486a commit 4fa67baedfbb945cd4251d366bd2fe1579cc6deb
View
@@ -1,5 +1,9 @@
## [v3.45-2018?] not yet released
## [v3.44.2-2018e] published on 2018-07-22
### Fixed
- NPE-Fix for loading time zone based on system time zone identifier [#803]
## [v3.44.1-2018e] published on 2018-07-20
### Fixed
- NPE-Fix for premature assignment of system time zone [#802]
@@ -2275,7 +2275,10 @@ public Format toFormat() {
* @param type the type of the pattern to be used
* @param locale format locale
* @param tzid timezone id
* @return new format object for formatting {@code Moment}-objects using given locale and timezone
* @return new format object for formatting {@code Moment}-objects
* using given locale and timezone
* @throws IllegalArgumentException if resolving of pattern fails
* or the timezone cannot be loaded
* @throws IllegalArgumentException if resolving of pattern fails
* @see #ofPattern(String, PatternType, Locale, Chronology)
* @since 3.1
@@ -2290,8 +2293,10 @@ public Format toFormat() {
* @param type the type of the pattern to be used
* @param locale format locale
* @param tzid timezone id
* @return new format object for formatting {@code Moment}-objects using given locale and timezone
* @return new format object for formatting {@code Moment}-objects
* using given locale and timezone
* @throws IllegalArgumentException if resolving of pattern fails
* or the timezone cannot be loaded
* @see #ofPattern(String, PatternType, Locale, Chronology)
* @since 3.1
*/
@@ -2488,6 +2493,7 @@ public Format toFormat() {
* @param locale format locale
* @param tzid timezone identifier
* @return new {@code ChronoFormatter}-instance
* @throws IllegalArgumentException if given timezone cannot be loaded
* @see CalendarText#patternForMoment(DisplayMode, DisplayMode, Locale)
* @since 3.10/4.7
*/
@@ -2499,6 +2505,7 @@ public Format toFormat() {
* @param locale format locale
* @param tzid timezone identifier
* @return new {@code ChronoFormatter}-instance
* @throws IllegalArgumentException if given timezone cannot be loaded
* @see CalendarText#patternForMoment(DisplayMode, DisplayMode, Locale)
* @since 3.10/4.7
*/
@@ -1394,7 +1394,7 @@ private static Timezone getDefaultTZ() {
Timezone ret = Timezone.getTZ(null, zoneID, false);
if (ret == null) {
// exception case if the tzid cannot be resolved
// exception case if the zoneID cannot be resolved
ret = new PlatformTimezone(new NamedID(zoneID));
}
@@ -1522,8 +1522,11 @@ private static Timezone getTZ(
// Ungültige ID?
if (tz == null) {
if (!wantsException || java.util.TimeZone.getDefault().getID().equals(zoneID)) {
return null; // edge case: platform zone with customized id
if (!wantsException) {
return null;
} else if (java.util.TimeZone.getDefault().getID().equals(zoneID)) {
// edge case: platform zone with customized id
return new PlatformTimezone(new NamedID(zoneID));
} else {
throw new IllegalArgumentException("Unknown timezone: " + zoneID);
}

0 comments on commit 4fa67ba

Please sign in to comment.