deployed 2.0.7.RELEASE,增加MapConverter鲁棒性,并记录错误信息
parent
a802097a21
commit
aad9821481
8
pom.xml
8
pom.xml
|
@ -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>2.0.6.RELEASE</version>
|
<version>2.0.7.RELEASE</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Protostar</name>
|
<name>Protostar</name>
|
||||||
|
@ -33,10 +33,10 @@
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<resource.delimiter>@</resource.delimiter>
|
<resource.delimiter>@</resource.delimiter>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
|
||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<maven.test.skip>true</maven.test.skip>
|
<maven.test.skip>true</maven.test.skip>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
@ -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.68.Final</version>
|
<version>4.1.69.Final</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -25,9 +25,14 @@ public abstract class MapConverter<K, V> extends PrepareLoadStrategy implements
|
||||||
if (!input.isReadable())
|
if (!input.isReadable())
|
||||||
return null;
|
return null;
|
||||||
Map<K, V> map = new TreeMap<>();
|
Map<K, V> map = new TreeMap<>();
|
||||||
|
K key = null;
|
||||||
|
int length = 0;
|
||||||
|
try {
|
||||||
do {
|
do {
|
||||||
K key = readKey(input);
|
key = readKey(input);
|
||||||
int length = ByteBufUtils.readInt(input, valueSize());
|
length = ByteBufUtils.readInt(input, valueSize());
|
||||||
|
if (length <= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (input.isReadable(length)) {
|
if (input.isReadable(length)) {
|
||||||
int writerIndex = input.writerIndex();
|
int writerIndex = input.writerIndex();
|
||||||
|
@ -38,6 +43,9 @@ public abstract class MapConverter<K, V> extends PrepareLoadStrategy implements
|
||||||
map.put(key, (V) readValue(key, input));
|
map.put(key, (V) readValue(key, input));
|
||||||
}
|
}
|
||||||
} while (input.isReadable());
|
} while (input.isReadable());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("解析出错:KEY[{}], LENGTH[{}]", key, length);
|
||||||
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue