1.日期解析失败返回null; 2.升级netty依赖.
parent
d69b5169e8
commit
635b9d8b82
4
pom.xml
4
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.github.yezhihao</groupId>
|
||||
<artifactId>protostar</artifactId>
|
||||
<version>1.0.3.RELEASE</version>
|
||||
<version>1.0.4.RELEASE</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Protostar</name>
|
||||
|
@ -62,7 +62,7 @@
|
|||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-buffer</artifactId>
|
||||
<version>4.1.58.Final</version>
|
||||
<version>4.1.63.Final</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -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) */
|
||||
|
|
Loading…
Reference in New Issue