1.日期解析失败返回null; 2.升级netty依赖.

master
剑器近 2021-04-07 17:46:51 +08:00
parent d69b5169e8
commit 635b9d8b82
2 changed files with 13 additions and 9 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>io.github.yezhihao</groupId> <groupId>io.github.yezhihao</groupId>
<artifactId>protostar</artifactId> <artifactId>protostar</artifactId>
<version>1.0.3.RELEASE</version> <version>1.0.4.RELEASE</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Protostar</name> <name>Protostar</name>
@ -62,7 +62,7 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId> <artifactId>netty-buffer</artifactId>
<version>4.1.58.Final</version> <version>4.1.63.Final</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -64,6 +64,7 @@ public class Bcd {
int year = HUNDRED_YEAR + num(bcd[i - 5]); int year = HUNDRED_YEAR + num(bcd[i - 5]);
if (year < YEAR_RANGE) if (year < YEAR_RANGE)
year += 100; year += 100;
try {
return LocalDateTime.of( return LocalDateTime.of(
year, year,
num(bcd[i - 4]), num(bcd[i - 4]),
@ -71,6 +72,9 @@ public class Bcd {
num(bcd[i - 2]), num(bcd[i - 2]),
num(bcd[i - 1]), num(bcd[i - 1]),
num(bcd[i])); num(bcd[i]));
} catch (Exception e) {
return null;
}
} }
/** 日期转BCD (yyMMdd) */ /** 日期转BCD (yyMMdd) */