You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/09/29 14:59:45 UTC

[GitHub] [dolphinscheduler] DarkAssassinator opened a new pull request, #12220: [fix#12195] Change date to timestamp to support cross diff time zones

DarkAssassinator opened a new pull request, #12220:
URL: https://github.com/apache/dolphinscheduler/pull/12220

   <!--Thanks very much for contributing to Apache DolphinScheduler. Please review https://dolphinscheduler.apache.org/en-us/community/development/pull-request.html before opening a pull request.-->
   
   ## Purpose of the pull request
   
   fix #12195 
   
   ## Brief change log
   
   1. Change date to timestamp in `TaskExecutionContext`
   2. Change date to timestamp in `TaskExecuteResultCommand`  and `TaskExecuteRunningCommand `
   3. Change all set and get. 
   4. Change UT
   5. Add timeStamp2Date and date2TimeStamp utils function.
   
   ## Verify this pull request
   
   
   This pull request is already covered by existing tests
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] github-code-scanning[bot] commented on a diff in pull request #12220: [fix#12195] Change date to timestamp to support cross diff time zones

Posted by GitBox <gi...@apache.org>.
github-code-scanning[bot] commented on code in PR #12220:
URL: https://github.com/apache/dolphinscheduler/pull/12220#discussion_r983746182


##########
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java:
##########
@@ -437,4 +437,14 @@
     public static String getTimestampString() {
         return String.valueOf(System.currentTimeMillis());
     }
+
+    /**
+     * transform timestamp to date
+     *
+     * @param timeStamp timeStamp
+     * @return date
+     */
+    public static Date timeStampToLocalDate(long timeStamp) {
+        return timeStamp == 0L ? null : new Date(Long.parseLong(String.valueOf(timeStamp)));

Review Comment:
   ## Missing catch of NumberFormatException
   
   Potential uncaught 'java.lang.NumberFormatException'.
   
   [Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/1584)



##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java:
##########
@@ -646,4 +646,23 @@
 
     }
 
+    /**
+     * transform timeStamp to local date
+     *
+     * @param timeStamp time stamp (milliseconds)
+     * @return local date
+     */
+    public static Date timeStampToLocalDate(long timeStamp) {
+        return timeStamp == 0L ? null : new Date(Long.parseLong(String.valueOf(timeStamp)));

Review Comment:
   ## Missing catch of NumberFormatException
   
   Potential uncaught 'java.lang.NumberFormatException'.
   
   [Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/1583)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] DarkAssassinator closed pull request #12220: [fix#12195] Change date to timestamp to support cross diff time zones

Posted by GitBox <gi...@apache.org>.
DarkAssassinator closed pull request #12220: [fix#12195] Change date to timestamp to support cross diff time zones
URL: https://github.com/apache/dolphinscheduler/pull/12220


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] DarkAssassinator commented on pull request #12220: [fix#12195] Change date to timestamp to support cross diff time zones

Posted by GitBox <gi...@apache.org>.
DarkAssassinator commented on PR #12220:
URL: https://github.com/apache/dolphinscheduler/pull/12220#issuecomment-1263506313

   close it


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] ruanwenjun commented on a diff in pull request #12220: [fix#12195] Change date to timestamp to support cross diff time zones

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on code in PR #12220:
URL: https://github.com/apache/dolphinscheduler/pull/12220#discussion_r984127935


##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java:
##########
@@ -646,4 +646,23 @@ public static long toDurationHours(long d) {
 
     }
 
+    /**
+     * transform timeStamp to local date
+     *
+     * @param timeStamp time stamp (milliseconds)
+     * @return local date
+     */
+    public static Date timeStampToLocalDate(long timeStamp) {
+        return timeStamp == 0L ? null : new Date(Long.parseLong(String.valueOf(timeStamp)));
+    }

Review Comment:
   ```suggestion
       public static @Nuallable Date timeStampToDate(long timeStamp) {
           return timeStamp <= 0L ? null : new Date(timeStamp);
       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org