ruanwenjun commented on code in PR #13050:
URL:
https://github.com/apache/dolphinscheduler/pull/13050#discussion_r1321630114
##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/json/DateJsonSerializer.java:
##########
@@ -33,6 +34,15 @@ public class DateJsonSerializer extends JsonSerializer<Date>
{
@Override
public void serialize(Date value, JsonGenerator gen, SerializerProvider
serializers) throws IOException {
- gen.writeString(DateUtils.dateToString(value));
+ Date temp = value;
+ // In the internal implementation of JDK, java.sql.Date is inherited
from java.util.Date, and java.sql.Date has
+ // rewritten many methods in java.util.Date, but it has not been
implemented.
+ // Later, when formatting, you need to call the method in Date to
report an error.
+ if (value instanceof java.sql.Date) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(value);
+ temp = calendar.getTime();
+ }
Review Comment:
The right way is to fix this at `DateUtils.dateToString`, rather than modify
this class.
--
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]