Skip to content

Commit

Permalink
fix unit test failed
Browse files Browse the repository at this point in the history
Signed-off-by: xuwenping <wenpingxu123@163.com>
  • Loading branch information
xuwenping123 committed Jan 19, 2024
1 parent c8cd9aa commit 1c749f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import java.time.ZoneId;
import java.util.List;
import java.util.Locale;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.core.CoreConstants;
Expand Down Expand Up @@ -44,13 +45,19 @@ public void start() {
zoneId = ZoneId.of(zoneIdString);
}

Locale locale = null;
if (optionList != null && optionList.size() > 2) {
String localeIdStr = optionList.get(2);
locale = Locale.forLanguageTag(localeIdStr);
}

try {
cachingDateFormatter = new CachingDateFormatter(datePattern, zoneId);
cachingDateFormatter = new CachingDateFormatter(datePattern, zoneId, locale);
// maximumCacheValidity = CachedDateFormat.getMaximumCacheValidity(pattern);
} catch (IllegalArgumentException e) {
addWarn("Could not instantiate SimpleDateFormat with pattern " + datePattern, e);
addWarn("Defaulting to " + CoreConstants.CLF_DATE_PATTERN);
cachingDateFormatter = new CachingDateFormatter(CoreConstants.CLF_DATE_PATTERN, zoneId);
cachingDateFormatter = new CachingDateFormatter(CoreConstants.CLF_DATE_PATTERN, zoneId, locale);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void testDateConverter() {
@Test
public void testDateConverter_AU_locale() {
DateConverter converter = new DateConverter();
List<String> optionsList = Lists.list(CoreConstants.CLF_DATE_PATTERN, "Australia/Sydney", "en-AU");
List<String> optionsList = Lists.list(CoreConstants.CLF_DATE_PATTERN, "Australia/Sydney", "en_AU");

converter.setOptionList(optionsList);
converter.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public void dailySizeBasedRolloverWithSizeCap() {
// 2016-03-05 00:14:39 CET
long simulatedTime = 1457133279186L;
ConfigParameters params = new ConfigParameters(simulatedTime);
String fileNamePattern = randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}-clean.%i";
String fileNamePattern = randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + ", CET}-clean.%i";
params.maxHistory(60).fileNamePattern(fileNamePattern).simulatedNumberOfPeriods(10).sizeCap(sizeCap);
logOverMultiplePeriods(params);

Expand Down

0 comments on commit 1c749f7

Please sign in to comment.