This commit is contained in:
Looly 2021-06-24 08:44:39 +08:00
parent 1750dcaf38
commit c94375e922
2 changed files with 15 additions and 30 deletions

View File

@ -11,6 +11,7 @@
### 🐞Bug修复 ### 🐞Bug修复
* 【json 】 修复XML转义字符的问题issue#I3XH09@Gitee * 【json 】 修复XML转义字符的问题issue#I3XH09@Gitee
* 【core 】 修复FormatCache中循环引用异常pr#1673@Github
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------

View File

@ -30,6 +30,7 @@ abstract class FormatCache<F extends Format> {
/** /**
* 使用默认的patterntimezone和locale获得缓存中的实例 * 使用默认的patterntimezone和locale获得缓存中的实例
*
* @return a date/time formatter * @return a date/time formatter
*/ */
public F getInstance() { public F getInstance() {
@ -46,7 +47,7 @@ abstract class FormatCache<F extends Format> {
* @throws IllegalArgumentException pattern 无效或{@code null} * @throws IllegalArgumentException pattern 无效或{@code null}
*/ */
public F getInstance(final String pattern, TimeZone timeZone, Locale locale) { public F getInstance(final String pattern, TimeZone timeZone, Locale locale) {
Assert.notBlank(pattern, "pattern must not be blank") ; Assert.notBlank(pattern, "pattern must not be blank");
if (timeZone == null) { if (timeZone == null) {
timeZone = TimeZone.getDefault(); timeZone = TimeZone.getDefault();
} }
@ -91,7 +92,7 @@ abstract class FormatCache<F extends Format> {
* @throws IllegalArgumentException if the Locale has no date/time pattern defined * @throws IllegalArgumentException if the Locale has no date/time pattern defined
*/ */
// This must remain private, see LANG-884 // This must remain private, see LANG-884
private F getDateTimeInstance(final Integer dateStyle, final Integer timeStyle, final TimeZone timeZone, Locale locale) { F getDateTimeInstance(final Integer dateStyle, final Integer timeStyle, final TimeZone timeZone, Locale locale) {
if (locale == null) { if (locale == null) {
locale = Locale.getDefault(); locale = Locale.getDefault();
} }
@ -99,23 +100,6 @@ abstract class FormatCache<F extends Format> {
return getInstance(pattern, timeZone, locale); return getInstance(pattern, timeZone, locale);
} }
/**
* <p>
* Gets a date/time formatter instance using the specified style, time zone and locale.
* </p>
*
* @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
* @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
* @param timeZone optional time zone, overrides time zone of formatted date, null means use default Locale
* @param locale optional locale, overrides system locale
* @return a localized standard date/time formatter
* @throws IllegalArgumentException if the Locale has no date/time pattern defined
*/
// package protected, for access from FastDateFormat; do not make public or protected
F getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) {
return getDateTimeInstance(Integer.valueOf(dateStyle), Integer.valueOf(timeStyle), timeZone, locale);
}
/** /**
* <p> * <p>
* Gets a date formatter instance using the specified style, time zone and locale. * Gets a date formatter instance using the specified style, time zone and locale.