You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Xiaoxiang Yu (Jira)" <ji...@apache.org> on 2023/04/26 02:49:00 UTC
[jira] [Resolved] (KYLIN-5519) DateFormatTest shouldn't rely on user's timezone
[ https://issues.apache.org/jira/browse/KYLIN-5519?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xiaoxiang Yu resolved KYLIN-5519.
---------------------------------
Resolution: Fixed
> DateFormatTest shouldn't rely on user's timezone
> ------------------------------------------------
>
> Key: KYLIN-5519
> URL: https://issues.apache.org/jira/browse/KYLIN-5519
> Project: Kylin
> Issue Type: Improvement
> Components: Tools, Build and Test
> Affects Versions: 5.0-alpha
> Reporter: Shao Feng Shi
> Assignee: Shao Feng Shi
> Priority: Major
> Fix For: 5.0-alpha
>
>
> When I run "mvn clean test", I got the following error:
>
> {code:java}
> [INFO] Results:
> [INFO]
> [ERROR] Failures:
> [ERROR] DateFormatTest.testStringToMillis:200 expected:<1669824000000> but was:<1669852800000>
> [ERROR] DateFormatTest.testStringToMillisSupplement:220 expected:<1669824000000> but was:<1669852800000> {code}
> When look into the "DateFormatTest.testStringToMillis", it has no timezone specified when converting a Date time to epoch time. In the DateFormat.getDateFormat(), it uses the default timezone:
> {code:java}
> public static FastDateFormat getDateFormat(String datePattern) {
> FastDateFormat r = formatMap.get(datePattern);
> if (r == null) {
> r = FastDateFormat.getInstance(datePattern, TimeZone.getDefault());
> formatMap.put(datePattern, r);
> }
> return r;
> } {code}
>
> The function and test case shouldn't rely on user's default timezone. Which caused it may fail on another timezone.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)