更新时间:2023-02-03 22:29:18
A java.time.LocalDate
是ISO-8601日历系统中没有时区的日期,例如2007-12-03,因此那里没有足够的信息。请改用 java.time.ZonedDateTime
。
A java.time.LocalDate
is "a date without a time-zone in the ISO-8601 calendar system, such as 2007-12-03" so there is not enough information there. Use java.time.ZonedDateTime
instead.
此外,吞下这样的例外情况会使故障排除更加困难。当您不打算处理异常时,要么根本不捕获它,捕获并重新抛出它包装在RuntimeException中或至少记录它( e.printStackTrace()
或类似的)。
Also, swallowing exceptions like that makes it much harder to troubleshoot. When you don't intend to handle an exception either don't catch it at all, catch and re-throw it wrapped in a RuntimeException or at the very least log it (e.printStackTrace()
or similar) .