error handle to all: VlIntException

This commit is contained in:
free will committed 2021-03-18 20:12:27 +08:00
1 parent 96650c8f42
commit 30dd00ffb4
5 files changed
+21 -20

No files matched your search

+8 -8
View File
@@ -37,7 +37,7 @@ public class MINPacket implements IEncodingAble {
@Override
public int wireEncode(Encoder encoder) throws EncoderException {
if(!this.isPacketValid()){
return 0;
return -1;
}
int totalLength=0;
@@ -46,42 +46,42 @@ public class MINPacket implements IEncodingAble {
// 可变区
int tmplen=this.mutableField.wireEncode(encoder);
if(tmplen<=0){
return 0;
return -1;
}
totalLength+=tmplen;
// 只读区
tmplen=this.readOnlyField.wireEncode(encoder);
if(tmplen<=0){
return 0;
return -1;
}
totalLength+=tmplen;
// 签名区
tmplen=this.signatureField.wireEncode(encoder);
if(tmplen<=0){
return 0;
return -1;
}
totalLength+=tmplen;
// 标识区
tmplen=this.identifierField.wireEncode(encoder);
if(tmplen<=0){
return 0;
return -1;
}
totalLength+=tmplen;
// 编码包 TLV-LENGTH
tmplen=encoder.prependVarNumber(new VlInt(totalLength));
if(tmplen<=0){
return 0;
return -1;
}
totalLength+=tmplen;
// 编码包 TLV-TYPE
tmplen=encoder.prependVarNumber(this.packetType);
if(tmplen<=0){
return 0;
return -1;
}
totalLength+=tmplen;
@@ -98,7 +98,7 @@ public class MINPacket implements IEncodingAble {
* @return
*/
@Override
public boolean wireDecode(Block block) {
public boolean wireDecode(Block block) throws VlIntException {
// 首先判断包是否有效
if(!block.isValid()){
return false;