Skip to content

Conversation

@zhiqiang-dev
Copy link
Contributor

…eptions

Purpose of this pull request

Which issue you fix

Fixes # (issue).

Checklist:

  • I have executed the 'mvn spotless:apply' command to format my code.
  • I have a meaningful commit message (including the issue id, the template of commit message is '[label-type-#issue-id][fixed-module] a meaningful commit message.')
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have checked my code and corrected any misspellings.
  • My commit is only one. (If there are multiple commits, you can use 'git squash' to compress multiple commits into one.)

@zhiqiang-dev zhiqiang-dev self-assigned this Dec 1, 2025
@github-actions github-actions bot added the CORE label Dec 1, 2025
@yanghuaiGit yanghuaiGit merged commit e5ca758 into DTStack:master Dec 1, 2025
5 of 7 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces configurable timezone handling in the DateUtil class to fix ARRAY and LARGEINT type conversion exceptions. The change allows users to optionally use the system's local timezone instead of the hardcoded GMT+8 timezone by setting the USE_LOCAL_TIMEZONE system property.

  • Adds a system property flag to control timezone behavior
  • Modifies the ThreadLocal date formatter initialization to conditionally use local or default timezone
  • Maintains backward compatibility by defaulting to GMT+8 when the property is not set

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.


private static final String TIME_ZONE = "GMT+8";

private static final boolean isUseLocalTimeZone =
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name isUseLocalTimeZone does not follow Java naming conventions. Boolean variables should not have the "is" prefix when they are constants. According to Java naming conventions and the codebase style (e.g., DEFAULT_IS_DAEMON in ExecutorUtils.java), this should be named USE_LOCAL_TIMEZONE or USE_LOCAL_TIME_ZONE.

Suggested change
private static final boolean isUseLocalTimeZone =
private static final boolean USE_LOCAL_TIMEZONE =

Copilot uses AI. Check for mistakes.
Comment on lines +103 to +108
TimeZone timeZone;
if (isUseLocalTimeZone) {
timeZone = TimeZone.getDefault();
} else {
timeZone = TimeZone.getTimeZone(TIME_ZONE);
}
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new timezone selection logic based on the USE_LOCAL_TIMEZONE system property lacks test coverage. The DateUtilTest.java file contains tests for the DateUtil class, but none verify the behavior when this system property is set. Consider adding tests to validate:

  1. The default behavior when USE_LOCAL_TIMEZONE is not set (should use GMT+8)
  2. The behavior when USE_LOCAL_TIMEZONE is set to "true" (should use system default timezone)
  3. The behavior when USE_LOCAL_TIMEZONE is set to "false" (should use GMT+8)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants