Skip to content

Commit

Permalink
Minor simplification of StdDateFormat init: no need for ISO-8601 `S…
Browse files Browse the repository at this point in the history
…impleDateFormat` unless requested
  • Loading branch information
cowtowncoder committed Mar 6, 2020
1 parent 90d38a7 commit c9453de
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ public class StdDateFormat

protected final static DateFormat DATE_FORMAT_RFC1123;

protected final static DateFormat DATE_FORMAT_ISO8601;

/* Let's construct "blueprint" date format instances: cannot be used
* as is, due to thread-safety issues, but can be used for constructing
* actual instances more cheaply (avoids re-parsing).
Expand All @@ -107,8 +105,6 @@ public class StdDateFormat
// baseline DataFormat objects
DATE_FORMAT_RFC1123 = new SimpleDateFormat(DATE_FORMAT_STR_RFC1123, DEFAULT_LOCALE);
DATE_FORMAT_RFC1123.setTimeZone(DEFAULT_TIMEZONE);
DATE_FORMAT_ISO8601 = new SimpleDateFormat(DATE_FORMAT_STR_ISO8601, DEFAULT_LOCALE);
DATE_FORMAT_ISO8601.setTimeZone(DEFAULT_TIMEZONE);
}

/**
Expand Down Expand Up @@ -276,7 +272,9 @@ public StdDateFormat clone() {
*/
@Deprecated // since 2.9
public static DateFormat getISO8601Format(TimeZone tz, Locale loc) {
return _cloneFormat(DATE_FORMAT_ISO8601, DATE_FORMAT_STR_ISO8601, tz, loc, null);
DateFormat df = new SimpleDateFormat(DATE_FORMAT_STR_ISO8601, loc);
df.setTimeZone(DEFAULT_TIMEZONE);
return df;
}

/**
Expand Down

0 comments on commit c9453de

Please sign in to comment.