fix: encoding code review

This commit is contained in:
ChessNineeee
2021-04-22 13:40:14 +08:00
parent d213bda096
commit 4ed7cf57d9
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -254,6 +254,8 @@ public class Block {
try {
tlvType = TLV.readType(this.value, new VlInt(start));
} catch (TLVException e) {
// go 版本 先清空再抛出异常 这里是否需要清空?
this.clearElements();
throw new BlockException("parseSubElements" + e.getMessage());
}
if (tlvType == null) {
@@ -267,6 +269,8 @@ public class Block {
try {
tlvLength = TLV.readVarNumber(this.value, new VlInt(start));
} catch (TLVException e) {
// go 版本 先清空再抛出异常 这里是否需要清空?
this.clearElements();
throw new BlockException("parseSubElements" + e.getMessage());
}
if (tlvType == null) {
@@ -290,6 +294,8 @@ public class Block {
try {
block = createBlockByTypeLengthBuffer(tlvType, tlvLength, subBlockValue, true);
} catch (BlockException e) {
// go 版本 先清空再抛出异常 这里是否需要清空?
this.clearElements();
return false;
}
if (block == null) {
@@ -21,7 +21,7 @@ import static minsecurity.crypto.TestSM4.SRC_DATA_16B;
@BenchmarkMode(Mode.AverageTime)
@State(Scope.Thread)
@Fork(4)
@Fork(1)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(iterations = 3)
@Measurement(iterations = 5)