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 16:14:09 UTC

[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

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