diff --git a/pom.xml b/pom.xml index 5ae991b..c737b7d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 io.github.yezhihao protostar - 1.0.3.RELEASE + 1.0.4.RELEASE jar Protostar @@ -62,7 +62,7 @@ io.netty netty-buffer - 4.1.58.Final + 4.1.63.Final provided diff --git a/src/main/java/io/github/yezhihao/protostar/util/Bcd.java b/src/main/java/io/github/yezhihao/protostar/util/Bcd.java index e215c61..01ba79d 100644 --- a/src/main/java/io/github/yezhihao/protostar/util/Bcd.java +++ b/src/main/java/io/github/yezhihao/protostar/util/Bcd.java @@ -64,13 +64,17 @@ public class Bcd { int year = HUNDRED_YEAR + num(bcd[i - 5]); if (year < YEAR_RANGE) year += 100; - return LocalDateTime.of( - year, - num(bcd[i - 4]), - num(bcd[i - 3]), - num(bcd[i - 2]), - num(bcd[i - 1]), - num(bcd[i])); + try { + return LocalDateTime.of( + year, + num(bcd[i - 4]), + num(bcd[i - 3]), + num(bcd[i - 2]), + num(bcd[i - 1]), + num(bcd[i])); + } catch (Exception e) { + return null; + } } /** 日期转BCD (yyMMdd) */