ruanwenjun commented on code in PR #13050:
URL:
https://github.com/apache/dolphinscheduler/pull/13050#discussion_r1322801872
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java:
##########
@@ -75,6 +75,15 @@ private static LocalDateTime date2LocalDateTime(Date date) {
* @return local datetime
*/
private static LocalDateTime date2LocalDateTime(Date date, ZoneId zoneId) {
+ // In the internal implementation of JDK, java.sql.Date is inherited
from java.util.Date, and java.sql.Date has
+ // not been implemented toInstant() method. If call this method, it
will throw new
+ // java.lang.UnsupportedOperationException(). Here just convert
java.sql.Date to java.util.Date
+ // to avoid the error.
+ if (date instanceof java.sql.Date) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ date = calendar.getTime();
+ }
return LocalDateTime.ofInstant(date.toInstant(), zoneId);
Review Comment:
```suggestion
return LocalDateTime.ofInstant(Instant.of(date.getTime()), zoneId);
```
##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/json/DateJsonSerializer.java:
##########
@@ -17,17 +17,15 @@
package org.apache.dolphinscheduler.service.json;
+import com.fasterxml.jackson.core.JsonGenerator;
Review Comment:
Please revert this change.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]